Skip to content

Commit

Permalink
Merge pull request #10010 from tk0miya/mypy-0.930
Browse files Browse the repository at this point in the history
Fix mypy violations (with mypy-0.930)
  • Loading branch information
tk0miya committed Dec 23, 2021
2 parents 94acb19 + 5651523 commit 6ad6594
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -44,7 +44,7 @@
'lint': [
'flake8>=3.5.0',
'isort',
'mypy>=0.920',
'mypy>=0.930',
'docutils-stubs',
"types-typed-ast",
"types-pkg_resources",
Expand Down
2 changes: 1 addition & 1 deletion sphinx/environment/__init__.py
Expand Up @@ -621,7 +621,7 @@ def traverse_toctree(parent: str, docname: str) -> Iterator[Tuple[str, str]]:

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:
Expand Down
12 changes: 6 additions & 6 deletions sphinx/util/inspect.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion sphinx/writers/manpage.py
Expand Up @@ -107,7 +107,7 @@ def __init__(self, document: nodes.document, builder: Builder) -> None:

# 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:
Expand Down

0 comments on commit 6ad6594

Please sign in to comment.