diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-07-13 11:14:17 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-13 11:14:17 +0900 |
commit | 68973e803a4a79e54918e9bcbbfae8c535576c70 (patch) | |
tree | 3daa13f8f775b1ee3e298ab7e8236cf96e672520 /sphinx/util/inspect.py | |
parent | f443fb5579d64340b87c595e9cd87895bbc90f65 (diff) | |
parent | fd74594f5337b2f28ab40521d255958c14ca6ef6 (diff) | |
download | sphinx-git-68973e803a4a79e54918e9bcbbfae8c535576c70.tar.gz |
Merge pull request #6575 from tk0miya/mypy-0.720
Fix mypy violations (for mypy-0.720)
Diffstat (limited to 'sphinx/util/inspect.py')
-rw-r--r-- | sphinx/util/inspect.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 42530eb40..ea329d76a 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -560,7 +560,7 @@ class Signature: qualname = repr(annotation) if (hasattr(typing, 'TupleMeta') and - isinstance(annotation, typing.TupleMeta) and # type: ignore + isinstance(annotation, typing.TupleMeta) and not hasattr(annotation, '__tuple_params__')): # This is for Python 3.6+, 3.5 case is handled below params = annotation.__args__ @@ -591,7 +591,7 @@ class Signature: param_str = ', '.join(self.format_annotation(p) for p in params) return '%s[%s]' % (qualname, param_str) elif (hasattr(typing, 'UnionMeta') and # for py35 or below - isinstance(annotation, typing.UnionMeta) and # type: ignore + isinstance(annotation, typing.UnionMeta) and hasattr(annotation, '__union_params__')): params = annotation.__union_params__ if params is not None: @@ -611,7 +611,7 @@ class Signature: param_str = ', '.join(self.format_annotation(p) for p in params) return 'Union[%s]' % param_str elif (hasattr(typing, 'CallableMeta') and # for py36 or below - isinstance(annotation, typing.CallableMeta) and # type: ignore + isinstance(annotation, typing.CallableMeta) and getattr(annotation, '__args__', None) is not None and hasattr(annotation, '__result__')): # Skipped in the case of plain typing.Callable @@ -627,7 +627,7 @@ class Signature: args_str, self.format_annotation(annotation.__result__)) elif (hasattr(typing, 'TupleMeta') and # for py36 or below - isinstance(annotation, typing.TupleMeta) and # type: ignore + isinstance(annotation, typing.TupleMeta) and hasattr(annotation, '__tuple_params__') and hasattr(annotation, '__tuple_use_ellipsis__')): params = annotation.__tuple_params__ |