Skip to content

Commit

Permalink
typing-utils seems to be required for all python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorpela committed Apr 24, 2021
1 parent a1ec3c5 commit d90d1be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions overrides/enforce.py
Expand Up @@ -2,8 +2,7 @@
import inspect
from inspect import Parameter, Signature
from typing import Callable

import typing_utils
from typing_utils import issubtype


def ensure_compatible(
Expand Down Expand Up @@ -68,7 +67,7 @@ def ensure_all_args_defined_in_sub(super_sig, sub_sig):
elif (
super_param.annotation != Parameter.empty
and sub_param.annotation != Parameter.empty
and not typing_utils.issubtype(super_param.annotation, sub_param.annotation)
and not issubtype(super_param.annotation, sub_param.annotation)
):
raise TypeError(
f"`{name} must be a supertype of `{super_param.annotation}`"
Expand Down Expand Up @@ -114,7 +113,7 @@ def ensure_return_type_compatibility(super_sig, sub_sig):
if (
super_sig.return_annotation != Signature.empty
and sub_sig.return_annotation != Signature.empty
and not typing_utils.issubtype(sub_sig.return_annotation, super_sig.return_annotation)
and not issubtype(sub_sig.return_annotation, super_sig.return_annotation)
):
raise TypeError(
f"`{sub_sig.return_annotation}` is not a `{super_sig.return_annotation}`."
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -23,7 +23,7 @@
author_email=address,
url='https://github.com/mkorpela/overrides',
packages=find_packages(),
install_requires=['typing;python_version<"3.5"', 'typing-utils>=0.0.3;python_version<"3.8"'],
install_requires=['typing;python_version<"3.5"', 'typing-utils>=0.0.3'],
license='Apache License, Version 2.0',
keywords=['override', 'inheritence', 'OOP'],
classifiers=[
Expand Down

0 comments on commit d90d1be

Please sign in to comment.