summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-12-24 00:15:11 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-12-24 00:21:23 +0900
commit565152301fb2b771f52c40926c37ce6b1713d09a (patch)
tree68783c3db99d02847221286451a3306679cb6bdf
parent94acb1921c05dff9462fec50f3a80814dad659d3 (diff)
downloadsphinx-git-565152301fb2b771f52c40926c37ce6b1713d09a.tar.gz
Fix mypy violations (with mypy-0.930)
-rw-r--r--setup.py2
-rw-r--r--sphinx/environment/__init__.py2
-rw-r--r--sphinx/util/inspect.py12
-rw-r--r--sphinx/writers/manpage.py2
4 files changed, 9 insertions, 9 deletions
diff --git a/setup.py b/setup.py
index 8245aacef..44da14d09 100644
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@ extras_require = {
'lint': [
'flake8>=3.5.0',
'isort',
- 'mypy>=0.920',
+ 'mypy>=0.930',
'docutils-stubs',
"types-typed-ast",
"types-pkg_resources",
diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py
index 478db40e6..0b677cac4 100644
--- a/sphinx/environment/__init__.py
+++ b/sphinx/environment/__init__.py
@@ -621,7 +621,7 @@ class BuildEnvironment:
def check_consistency(self) -> None:
"""Do consistency checks."""
- included = set().union(*self.included.values()) # type: ignore
+ included = set().union(*self.included.values())
for docname in sorted(self.all_docs):
if docname not in self.files_to_rebuild:
if docname == self.config.root_doc:
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index 8a735b480..c67369e89 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -134,7 +134,7 @@ def unwrap_all(obj: Any, *, stop: Callable = None) -> Any:
elif ispartial(obj):
obj = obj.func
elif inspect.isroutine(obj) and hasattr(obj, '__wrapped__'):
- obj = obj.__wrapped__
+ obj = obj.__wrapped__ # type: ignore
elif isclassmethod(obj):
obj = obj.__func__
elif isstaticmethod(obj):
@@ -692,7 +692,7 @@ def signature(subject: Callable, bound_method: bool = False, follow_wrapped: boo
#
# For example, this helps a function having a default value `inspect._empty`.
# refs: https://github.com/sphinx-doc/sphinx/issues/7935
- return inspect.Signature(parameters, return_annotation=return_annotation, # type: ignore
+ return inspect.Signature(parameters, return_annotation=return_annotation,
__validate_parameters__=False)
@@ -820,14 +820,14 @@ def signature_from_ast(node: ast.FunctionDef, code: str = '') -> inspect.Signatu
positionals = len(args.args)
for _ in range(len(defaults), positionals):
- defaults.insert(0, Parameter.empty)
+ defaults.insert(0, Parameter.empty) # type: ignore
if hasattr(args, "posonlyargs"):
for i, arg in enumerate(args.posonlyargs): # type: ignore
if defaults[i] is Parameter.empty:
default = Parameter.empty
else:
- default = DefaultValue(ast_unparse(defaults[i], code))
+ default = DefaultValue(ast_unparse(defaults[i], code)) # type: ignore
annotation = ast_unparse(arg.annotation, code) or Parameter.empty
params.append(Parameter(arg.arg, Parameter.POSITIONAL_ONLY,
@@ -837,7 +837,7 @@ def signature_from_ast(node: ast.FunctionDef, code: str = '') -> inspect.Signatu
if defaults[i + posonlyargs] is Parameter.empty:
default = Parameter.empty
else:
- default = DefaultValue(ast_unparse(defaults[i + posonlyargs], code))
+ default = DefaultValue(ast_unparse(defaults[i + posonlyargs], code)) # type: ignore # NOQA
annotation = ast_unparse(arg.annotation, code) or Parameter.empty
params.append(Parameter(arg.arg, Parameter.POSITIONAL_OR_KEYWORD,
@@ -849,7 +849,7 @@ def signature_from_ast(node: ast.FunctionDef, code: str = '') -> inspect.Signatu
annotation=annotation))
for i, arg in enumerate(args.kwonlyargs):
- default = ast_unparse(args.kw_defaults[i], code) or Parameter.empty
+ default = ast_unparse(args.kw_defaults[i], code) or Parameter.empty # type: ignore
annotation = ast_unparse(arg.annotation, code) or Parameter.empty
params.append(Parameter(arg.arg, Parameter.KEYWORD_ONLY, default=default,
annotation=annotation))
diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py
index da5f4c241..bcf4e98b3 100644
--- a/sphinx/writers/manpage.py
+++ b/sphinx/writers/manpage.py
@@ -107,7 +107,7 @@ class ManualPageTranslator(SphinxTranslator, BaseTranslator):
# Overwrite admonition label translations with our own
for label, translation in admonitionlabels.items():
- self.language.labels[label] = self.deunicode(translation) # type: ignore
+ self.language.labels[label] = self.deunicode(translation)
# overwritten -- added quotes around all .TH arguments
def header(self) -> str: