diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-06-03 23:25:17 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-06-03 23:31:43 +0900 |
| commit | b8fbd3d9c64b8bf12d2cdc091798faad7513e820 (patch) | |
| tree | 0c0ddfd27e4dbe86ad73994523e941ffee5c03e8 /sphinx/util/typing.py | |
| parent | e3f9bf43f617b17937df255519337ebda897f46b (diff) | |
| download | sphinx-git-b8fbd3d9c64b8bf12d2cdc091798faad7513e820.tar.gz | |
Fix mypy violations (with mypy-0.780)
Diffstat (limited to 'sphinx/util/typing.py')
| -rw-r--r-- | sphinx/util/typing.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py index 08bf7203b..f23ed4ce1 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__) == 2 and annotation.__args__[1] is NoneType: # type: ignore # NOQA + if len(annotation.__args__) == 2 and annotation.__args__[1] is NoneType: return 'Optional[%s]' % stringify(annotation.__args__[0]) else: args = ', '.join(stringify(a) for a in annotation.__args__) @@ -161,7 +161,7 @@ def _stringify_py36(annotation: Any) -> str: hasattr(annotation, '__union_params__')): # for Python 3.5 params = annotation.__union_params__ if params is not None: - if len(params) == 2 and params[1] is NoneType: # type: ignore + if len(params) == 2 and params[1] is NoneType: return 'Optional[%s]' % stringify(params[0]) else: param_str = ', '.join(stringify(p) for p in params) @@ -170,7 +170,7 @@ def _stringify_py36(annotation: Any) -> str: annotation.__origin__ is typing.Union): # for Python 3.5.2+ params = annotation.__args__ if params is not None: - if len(params) == 2 and params[1] is NoneType: # type: ignore + if len(params) == 2 and params[1] is NoneType: return 'Optional[%s]' % stringify(params[0]) else: param_str = ', '.join(stringify(p) for p in params) |
