diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-06-04 00:18:30 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-06-04 00:18:30 +0900 |
commit | 068b9b5738b4d41a25e14d56d6f6b55f3bc8d443 (patch) | |
tree | f58f2d43d8a54545ae8a0c51ffe99c310864710d /sphinx/util/typing.py | |
parent | 88a3548a8268d3b99f2d79db08fe65da7d691592 (diff) | |
parent | 9b45b00bd4cee7dad96b98cec0224f88a84ef40a (diff) | |
download | sphinx-git-068b9b5738b4d41a25e14d56d6f6b55f3bc8d443.tar.gz |
Merge branch '3.x'
Diffstat (limited to 'sphinx/util/typing.py')
-rw-r--r-- | sphinx/util/typing.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py index 8ad8bf75d..6f12a453a 100644 --- a/sphinx/util/typing.py +++ b/sphinx/util/typing.py @@ -53,7 +53,7 @@ def stringify(annotation: Any) -> str: return annotation.__name__ elif not annotation: return repr(annotation) - elif annotation is NoneType: # type: ignore + elif annotation is NoneType: return 'None' elif (getattr(annotation, '__module__', None) == 'builtins' and hasattr(annotation, '__qualname__')): @@ -91,7 +91,7 @@ def _stringify_py37(annotation: Any) -> str: if getattr(annotation, '__args__', None): if qualname == 'Union': - if len(annotation.__args__) > 1 and annotation.__args__[-1] is NoneType: # type: ignore # NOQA + if len(annotation.__args__) > 1 and annotation.__args__[-1] is NoneType: if len(annotation.__args__) > 2: args = ', '.join(stringify(a) for a in annotation.__args__[:-1]) return 'Optional[Union[%s]]' % args @@ -159,7 +159,7 @@ def _stringify_py36(annotation: Any) -> str: annotation.__origin__ is typing.Union): params = annotation.__args__ if params is not None: - if len(params) > 1 and params[-1] is NoneType: # type: ignore + if len(params) > 1 and params[-1] is NoneType: if len(params) > 2: param_str = ", ".join(stringify(p) for p in params[:-1]) return 'Optional[Union[%s]]' % param_str |