diff options
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | sphinx/ext/doctest.py | 2 | ||||
-rw-r--r-- | sphinx/ext/intersphinx.py | 2 | ||||
-rw-r--r-- | sphinx/pycode/parser.py | 2 | ||||
-rw-r--r-- | sphinx/roles.py | 2 | ||||
-rw-r--r-- | sphinx/testing/util.py | 8 | ||||
-rw-r--r-- | sphinx/util/__init__.py | 2 | ||||
-rw-r--r-- | sphinx/util/docutils.py | 16 | ||||
-rw-r--r-- | sphinx/util/inspect.py | 8 | ||||
-rw-r--r-- | sphinx/writers/text.py | 2 |
10 files changed, 23 insertions, 23 deletions
@@ -47,7 +47,7 @@ extras_require = { 'html5lib', 'flake8>=3.5.0', 'flake8-import-order', - 'mypy>=0.711', + 'mypy>=0.720', 'docutils-stubs', ], } diff --git a/sphinx/ext/doctest.py b/sphinx/ext/doctest.py index 01ab38efe..22301e66d 100644 --- a/sphinx/ext/doctest.py +++ b/sphinx/ext/doctest.py @@ -292,7 +292,7 @@ class DocTestBuilder(Builder): # for doctest examples but unusable for multi-statement code such # as setup code -- to be able to use doctest error reporting with # that code nevertheless, we monkey-patch the "compile" it uses. - doctest.compile = self.compile # type: ignore + doctest.compile = self.compile sys.path[0:0] = self.config.doctest_path diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index 6b9bc3825..9c02a93cd 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -414,6 +414,6 @@ def inspect_main(argv): if __name__ == '__main__': import logging # type: ignore - logging.basicConfig() # type: ignore + logging.basicConfig() inspect_main(argv=sys.argv[1:]) diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py index 1746537bb..a96fe593f 100644 --- a/sphinx/pycode/parser.py +++ b/sphinx/pycode/parser.py @@ -298,7 +298,7 @@ class VariableCommentPicker(ast.NodeVisitor): """Handles Assign node and pick up a variable comment.""" try: targets = get_assign_targets(node) - varnames = sum([get_lvar_names(t, self=self.get_self()) for t in targets], []) + varnames = sum([get_lvar_names(t, self=self.get_self()) for t in targets], []) # type: List[str] # NOQA current_line = self.get_line(node.lineno) except TypeError: return # this assignment is not new definition! diff --git a/sphinx/roles.py b/sphinx/roles.py index 1a2daa36a..1b80e1ec3 100644 --- a/sphinx/roles.py +++ b/sphinx/roles.py @@ -400,7 +400,7 @@ class GUILabel(SphinxRole): class MenuSelection(GUILabel): def run(self): # type: () -> Tuple[List[nodes.Node], List[nodes.system_message]] - self.text = self.text.replace('-->', '\N{TRIANGULAR BULLET}') # type: ignore + self.text = self.text.replace('-->', '\N{TRIANGULAR BULLET}') return super().run() diff --git a/sphinx/testing/util.py b/sphinx/testing/util.py index 7b73059e9..b0b8eb11d 100644 --- a/sphinx/testing/util.py +++ b/sphinx/testing/util.py @@ -130,8 +130,8 @@ class SphinxTestApp(application.Sphinx): warningiserror = False self._saved_path = sys.path[:] - self._saved_directives = directives._directives.copy() # type: ignore - self._saved_roles = roles._roles.copy() # type: ignore + self._saved_directives = directives._directives.copy() + self._saved_roles = roles._roles.copy() self._saved_nodeclasses = {v for v in dir(nodes.GenericNodeVisitor) if v.startswith('visit_')} @@ -151,8 +151,8 @@ class SphinxTestApp(application.Sphinx): locale.translators.clear() sys.path[:] = self._saved_path sys.modules.pop('autodoc_fodder', None) - directives._directives = self._saved_directives # type: ignore - roles._roles = self._saved_roles # type: ignore + directives._directives = self._saved_directives + roles._roles = self._saved_roles for method in dir(nodes.GenericNodeVisitor): if method.startswith('visit_') and \ method not in self._saved_nodeclasses: diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 2ebae8768..3657f2624 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -260,7 +260,7 @@ def save_traceback(app): platform.python_version(), platform.python_implementation(), docutils.__version__, docutils.__version_details__, - jinja2.__version__, # type: ignore + jinja2.__version__, last_msgs)).encode()) if app is not None: for ext in app.extensions.values(): diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index eebfec464..60f3c73d1 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -54,13 +54,13 @@ def docutils_namespace(): # type: () -> Generator[None, None, None] """Create namespace for reST parsers.""" try: - _directives = copy(directives._directives) # type: ignore - _roles = copy(roles._roles) # type: ignore + _directives = copy(directives._directives) + _roles = copy(roles._roles) yield finally: - directives._directives = _directives # type: ignore - roles._roles = _roles # type: ignore + directives._directives = _directives + roles._roles = _roles for node in list(additional_nodes): unregister_node(node) @@ -70,7 +70,7 @@ def docutils_namespace(): def is_directive_registered(name): # type: (str) -> bool """Check the *name* directive is already registered.""" - return name in directives._directives # type: ignore + return name in directives._directives def register_directive(name, directive): @@ -86,7 +86,7 @@ def register_directive(name, directive): def is_role_registered(name): # type: (str) -> bool """Check the *name* role is already registered.""" - return name in roles._roles # type: ignore + return name in roles._roles def register_role(name, role): @@ -102,7 +102,7 @@ def register_role(name, role): def unregister_role(name): # type: (str) -> None """Unregister a role from docutils.""" - roles._roles.pop(name, None) # type: ignore + roles._roles.pop(name, None) def is_node_registered(node): @@ -119,7 +119,7 @@ def register_node(node): inside ``docutils_namespace()`` to prevent side-effects. """ if not hasattr(nodes.GenericNodeVisitor, 'visit_' + node.__name__): - nodes._add_node_class_names([node.__name__]) # type: ignore + nodes._add_node_class_names([node.__name__]) additional_nodes.add(node) 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__ diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index dc8a7963a..7a9cf5a1b 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -377,7 +377,7 @@ class TextWriter(writers.Writer): settings_spec = ('No options here.', '', ()) settings_defaults = {} # type: Dict - output = None + output = None # type: str def __init__(self, builder): # type: (TextBuilder) -> None |