diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-07-13 11:14:44 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-07-13 11:14:44 +0900 |
commit | 1d2d295a93db73f9648f016ee7fc0152efdaa9a7 (patch) | |
tree | 17e0aef03ce5108b0145b419d7b7ac495d43131f /sphinx/util/inspect.py | |
parent | 5d89c30dab810117421b6262362b1b45432c9f8e (diff) | |
parent | 68973e803a4a79e54918e9bcbbfae8c535576c70 (diff) | |
download | sphinx-git-1d2d295a93db73f9648f016ee7fc0152efdaa9a7.tar.gz |
Merge branch '2.1.3' into 2.0
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 c1fc0e960..3e403d9d1 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -536,7 +536,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__ @@ -567,7 +567,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: @@ -587,7 +587,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 @@ -603,7 +603,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__ |