Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-11-13 23:36:24 +0300
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-11-13 23:36:24 +0300
commitcd3f2e435000835dd98a11497440bc16a79ec31c (patch)
tree6c89dfa43e74f4c47a3255f38ab013cc3cf997a1
parenta6032e852a650c070aed66f0790e612905159f15 (diff)
Update typing ignores for mypy 0.990master
-rw-r--r--pyproject.toml2
-rw-r--r--sphinx/application.py4
-rw-r--r--sphinx/builders/gettext.py2
-rw-r--r--sphinx/cmd/quickstart.py2
-rw-r--r--sphinx/directives/__init__.py2
-rw-r--r--sphinx/environment/adapters/toctree.py2
-rw-r--r--sphinx/ext/graphviz.py2
-rw-r--r--sphinx/ext/imgmath.py2
-rw-r--r--sphinx/ext/intersphinx.py2
-rw-r--r--sphinx/ext/viewcode.py8
-rw-r--r--sphinx/pycode/parser.py4
-rw-r--r--sphinx/util/inspect.py8
-rw-r--r--sphinx/util/requests.py2
-rw-r--r--sphinx/util/rst.py2
-rw-r--r--sphinx/writers/html.py4
-rw-r--r--sphinx/writers/html5.py4
16 files changed, 26 insertions, 26 deletions
diff --git a/pyproject.toml b/pyproject.toml
index b25e4a8f5..6ca9ddc81 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -85,7 +85,7 @@ lint = [
"flake8-bugbear",
"flake8-simplify",
"isort",
- "mypy>=0.981",
+ "mypy>=0.990",
"sphinx-lint",
"docutils-stubs",
"types-requests",
diff --git a/sphinx/application.py b/sphinx/application.py
index 028a41e30..05a05931c 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -1014,7 +1014,7 @@ class Sphinx:
self.registry.add_js_file(filename, priority=priority, **kwargs)
if hasattr(self, 'builder') and hasattr(self.builder, 'add_js_file'):
- self.builder.add_js_file(filename, # type: ignore[attr-defined]
+ self.builder.add_js_file(filename,
priority=priority, **kwargs)
def add_css_file(self, filename: str, priority: int = 500, **kwargs: Any) -> None:
@@ -1077,7 +1077,7 @@ class Sphinx:
logger.debug('[app] adding stylesheet: %r', filename)
self.registry.add_css_files(filename, priority=priority, **kwargs)
if hasattr(self, 'builder') and hasattr(self.builder, 'add_css_file'):
- self.builder.add_css_file(filename, # type: ignore[attr-defined]
+ self.builder.add_css_file(filename,
priority=priority, **kwargs)
def add_latex_package(self, packagename: str, options: Optional[str] = None,
diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py
index e0706ff96..b7f2c4e7f 100644
--- a/sphinx/builders/gettext.py
+++ b/sphinx/builders/gettext.py
@@ -57,7 +57,7 @@ class Catalog:
line = origin.line
if line is None:
line = -1
- self.metadata[msg].append((origin.source, line, origin.uid)) # type: ignore
+ self.metadata[msg].append((origin.source, line, origin.uid))
def __iter__(self) -> Generator[Message, None, None]:
for message in self.messages:
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py
index 183b6e15e..670a8ee02 100644
--- a/sphinx/cmd/quickstart.py
+++ b/sphinx/cmd/quickstart.py
@@ -551,7 +551,7 @@ def main(argv: List[str] = sys.argv[1:]) -> int:
try:
args = parser.parse_args(argv)
except SystemExit as err:
- return err.code
+ return err.code # type: ignore[return-value]
d = vars(args)
# delete None or False value
diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py
index 8fcbd1fff..bafa59624 100644
--- a/sphinx/directives/__init__.py
+++ b/sphinx/directives/__init__.py
@@ -285,7 +285,7 @@ class DefaultRole(SphinxDirective):
role_name = self.arguments[0]
role, messages = roles.role(role_name, self.state_machine.language,
self.lineno, self.state.reporter)
- if role:
+ if role: # type: ignore[truthy-function]
docutils.register_role('', role)
self.env.temp_data['default_role'] = role_name
else:
diff --git a/sphinx/environment/adapters/toctree.py b/sphinx/environment/adapters/toctree.py
index c8090d84b..0d3315f72 100644
--- a/sphinx/environment/adapters/toctree.py
+++ b/sphinx/environment/adapters/toctree.py
@@ -249,7 +249,7 @@ class TocTree:
if hasattr(toctree, 'uid'):
# move uid to caption_node to translate it
caption_node.uid = toctree.uid # type: ignore
- del toctree.uid # type: ignore
+ del toctree.uid
newnode += caption_node
newnode.extend(tocentries)
newnode['toctree'] = True
diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py
index df06069c1..74291163f 100644
--- a/sphinx/ext/graphviz.py
+++ b/sphinx/ext/graphviz.py
@@ -225,7 +225,7 @@ def render_dot(self: SphinxTranslator, code: str, options: Dict, format: str,
return relfn, outfn
if (hasattr(self.builder, '_graphviz_warned_dot') and
- self.builder._graphviz_warned_dot.get(graphviz_dot)): # type: ignore[attr-defined]
+ self.builder._graphviz_warned_dot.get(graphviz_dot)):
return None, None
ensuredir(path.dirname(outfn))
diff --git a/sphinx/ext/imgmath.py b/sphinx/ext/imgmath.py
index 7657ae3aa..0c034a599 100644
--- a/sphinx/ext/imgmath.py
+++ b/sphinx/ext/imgmath.py
@@ -278,7 +278,7 @@ def clean_up_files(app: Sphinx, exc: Exception) -> None:
if hasattr(app.builder, '_imgmath_tempdir'):
try:
- shutil.rmtree(app.builder._imgmath_tempdir) # type: ignore
+ shutil.rmtree(app.builder._imgmath_tempdir)
except Exception:
pass
diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py
index 1997045e9..877f9428c 100644
--- a/sphinx/ext/intersphinx.py
+++ b/sphinx/ext/intersphinx.py
@@ -167,7 +167,7 @@ def fetch_inventory(app: Sphinx, uri: str, inv: Any) -> Any:
raise
try:
if hasattr(f, 'url'):
- newinv = f.url # type: ignore
+ newinv = f.url
if inv != newinv:
logger.info(__('intersphinx inventory has moved: %s -> %s'), inv, newinv)
diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py
index a890ea5cd..e4461f813 100644
--- a/sphinx/ext/viewcode.py
+++ b/sphinx/ext/viewcode.py
@@ -136,7 +136,7 @@ def env_merge_info(app: Sphinx, env: BuildEnvironment, docnames: Iterable[str],
if not hasattr(env, '_viewcode_modules'):
env._viewcode_modules = {} # type: ignore
# now merge in the information from the subprocess
- for modname, entry in other._viewcode_modules.items(): # type: ignore
+ for modname, entry in other._viewcode_modules.items():
if modname not in env._viewcode_modules: # type: ignore
env._viewcode_modules[modname] = entry # type: ignore
else:
@@ -228,12 +228,12 @@ def collect_pages(app: Sphinx) -> Generator[Tuple[str, Dict[str, Any], str], Non
highlighter = app.builder.highlighter # type: ignore
urito = app.builder.get_relative_uri
- modnames = set(env._viewcode_modules) # type: ignore
+ modnames = set(env._viewcode_modules)
for modname, entry in status_iterator(
- sorted(env._viewcode_modules.items()), # type: ignore
+ sorted(env._viewcode_modules.items()),
__('highlighting module code... '), "blue",
- len(env._viewcode_modules), # type: ignore
+ len(env._viewcode_modules),
app.verbosity, lambda x: x[0]):
if not entry:
continue
diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py
index a51892e5e..7861e6b0f 100644
--- a/sphinx/pycode/parser.py
+++ b/sphinx/pycode/parser.py
@@ -350,9 +350,9 @@ class VariableCommentPicker(ast.NodeVisitor):
return # this assignment is not new definition!
# record annotation
- if hasattr(node, 'annotation') and node.annotation: # type: ignore
+ if hasattr(node, 'annotation') and node.annotation:
for varname in varnames:
- self.add_variable_annotation(varname, node.annotation) # type: ignore
+ self.add_variable_annotation(varname, node.annotation)
elif hasattr(node, 'type_comment') and node.type_comment:
for varname in varnames:
self.add_variable_annotation(varname, node.type_comment) # type: ignore
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index aba7c6615..58ec9fae2 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -52,7 +52,7 @@ def unwrap_all(obj: Any, *, stop: Optional[Callable] = None) -> Any:
elif ispartial(obj):
obj = obj.func
elif inspect.isroutine(obj) and hasattr(obj, '__wrapped__'):
- obj = obj.__wrapped__ # type: ignore
+ obj = obj.__wrapped__
elif isclassmethod(obj):
obj = obj.__func__
elif isstaticmethod(obj):
@@ -278,7 +278,7 @@ def is_singledispatch_function(obj: Any) -> bool:
if (inspect.isfunction(obj) and
hasattr(obj, 'dispatch') and
hasattr(obj, 'register') and
- obj.dispatch.__module__ == 'functools'): # type: ignore
+ obj.dispatch.__module__ == 'functools'):
return True
else:
return False
@@ -336,10 +336,10 @@ def isgenericalias(obj: Any) -> bool:
if isinstance(obj, typing._GenericAlias): # type: ignore
return True
elif (hasattr(types, 'GenericAlias') and # only for py39+
- isinstance(obj, types.GenericAlias)): # type: ignore
+ isinstance(obj, types.GenericAlias)):
return True
elif (hasattr(typing, '_SpecialGenericAlias') and # for py39+
- isinstance(obj, typing._SpecialGenericAlias)): # type: ignore
+ isinstance(obj, typing._SpecialGenericAlias)):
return True
else:
return False
diff --git a/sphinx/util/requests.py b/sphinx/util/requests.py
index b25304d37..0f52d61ef 100644
--- a/sphinx/util/requests.py
+++ b/sphinx/util/requests.py
@@ -19,7 +19,7 @@ useragent_header = [('User-Agent',
@contextmanager
def ignore_insecure_warning(**kwargs: Any) -> Generator[None, None, None]:
with warnings.catch_warnings():
- if not kwargs.get('verify') and InsecureRequestWarning:
+ if not kwargs.get('verify'):
# ignore InsecureRequestWarning if verify=False
warnings.filterwarnings("ignore", category=InsecureRequestWarning)
yield
diff --git a/sphinx/util/rst.py b/sphinx/util/rst.py
index b44cf9848..87252fa39 100644
--- a/sphinx/util/rst.py
+++ b/sphinx/util/rst.py
@@ -63,7 +63,7 @@ def default_role(docname: str, name: str) -> Generator[None, None, None]:
if name:
dummy_reporter = Reporter('', 4, 4)
role_fn, _ = roles.role(name, english, 0, dummy_reporter)
- if role_fn:
+ if role_fn: # type: ignore[truthy-function]
docutils.register_role('', role_fn)
else:
logger.warning(__('default role %s not found'), name, location=docname)
diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
index 680a47ac8..36b066158 100644
--- a/sphinx/writers/html.py
+++ b/sphinx/writers/html.py
@@ -867,7 +867,7 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
def depart_math(self, node: Element, math_env: str = '') -> None:
name = self.builder.math_renderer_name
_, depart = self.builder.app.registry.html_inline_math_renderers[name]
- if depart:
+ if depart: # type: ignore[truthy-function]
depart(self, node)
def visit_math_block(self, node: Element, math_env: str = '') -> None:
@@ -878,5 +878,5 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
def depart_math_block(self, node: Element, math_env: str = '') -> None:
name = self.builder.math_renderer_name
_, depart = self.builder.app.registry.html_block_math_renderers[name]
- if depart:
+ if depart: # type: ignore[truthy-function]
depart(self, node)
diff --git a/sphinx/writers/html5.py b/sphinx/writers/html5.py
index a68951a7f..f8b22de27 100644
--- a/sphinx/writers/html5.py
+++ b/sphinx/writers/html5.py
@@ -805,7 +805,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
def depart_math(self, node: Element, math_env: str = '') -> None:
name = self.builder.math_renderer_name
_, depart = self.builder.app.registry.html_inline_math_renderers[name]
- if depart:
+ if depart: # type: ignore[truthy-function]
depart(self, node)
def visit_math_block(self, node: Element, math_env: str = '') -> None:
@@ -816,5 +816,5 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
def depart_math_block(self, node: Element, math_env: str = '') -> None:
name = self.builder.math_renderer_name
_, depart = self.builder.app.registry.html_block_math_renderers[name]
- if depart:
+ if depart: # type: ignore[truthy-function]
depart(self, node)