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:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-12-30 11:33:52 +0300
committerGitHub <noreply@github.com>2019-12-30 11:33:52 +0300
commit0355d57fc1159312a131b2e44acb4a0240b2de4e (patch)
tree225b6c5f9904d8699332add3cb0939fb8be68ef2 /sphinx/ext
parent7a4bbf372a470700a1dfd96dd57054bb96b92fd3 (diff)
parentab184ac20d82d0546c21f33d2fdfbfb324078d56 (diff)
Merge pull request #6972 from tk0miya/refactor_type_annotation2
mypy: Enable disallow_incomplete_defs flag for type checking
Diffstat (limited to 'sphinx/ext')
-rw-r--r--sphinx/ext/autodoc/__init__.py26
-rw-r--r--sphinx/ext/autodoc/mock.py6
-rw-r--r--sphinx/ext/autosummary/generate.py2
-rw-r--r--sphinx/ext/coverage.py2
-rw-r--r--sphinx/ext/duration.py4
-rw-r--r--sphinx/ext/napoleon/__init__.py2
-rw-r--r--sphinx/ext/napoleon/iterators.py4
7 files changed, 23 insertions, 23 deletions
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
index c053b5b75..03bbb5f1d 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -221,7 +221,7 @@ class Documenter:
option_spec = {'noindex': bool_option} # type: Dict[str, Callable]
- def get_attr(self, obj: Any, name: str, *defargs) -> Any:
+ def get_attr(self, obj: Any, name: str, *defargs: Any) -> Any:
"""getattr() override for types such as Zope interfaces."""
return autodoc_attrgetter(self.env.app, obj, name, *defargs)
@@ -351,7 +351,7 @@ class Documenter:
return False
return True
- def format_args(self, **kwargs) -> str:
+ def format_args(self, **kwargs: Any) -> str:
"""Format the argument signature of *self.object*.
Should return None if the object does not have a signature.
@@ -369,7 +369,7 @@ class Documenter:
# directives of course)
return '.'.join(self.objpath) or self.modname
- def format_signature(self, **kwargs) -> str:
+ def format_signature(self, **kwargs: Any) -> str:
"""Format the signature (arguments and return annotation) of the object.
Let the user process it via the ``autodoc-process-signature`` event.
@@ -750,7 +750,7 @@ class ModuleDocumenter(Documenter):
'imported-members': bool_option, 'ignore-module-all': bool_option
} # type: Dict[str, Callable]
- def __init__(self, *args) -> None:
+ def __init__(self, *args: Any) -> None:
super().__init__(*args)
merge_special_members_option(self.options)
@@ -928,7 +928,7 @@ class DocstringSignatureMixin:
return lines
return super().get_doc(None, ignore) # type: ignore
- def format_signature(self, **kwargs) -> str:
+ def format_signature(self, **kwargs: Any) -> str:
if self.args is None and self.env.config.autodoc_docstring_signature: # type: ignore
# only act if a signature is not explicitly given already, and if
# the feature is enabled
@@ -943,7 +943,7 @@ class DocstringStripSignatureMixin(DocstringSignatureMixin):
Mixin for AttributeDocumenter to provide the
feature of stripping any function signature from the docstring.
"""
- def format_signature(self, **kwargs) -> str:
+ def format_signature(self, **kwargs: Any) -> str:
if self.args is None and self.env.config.autodoc_docstring_signature: # type: ignore
# only act if a signature is not explicitly given already, and if
# the feature is enabled
@@ -970,7 +970,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
return (inspect.isfunction(member) or inspect.isbuiltin(member) or
(inspect.isroutine(member) and isinstance(parent, ModuleDocumenter)))
- def format_args(self, **kwargs) -> str:
+ def format_args(self, **kwargs: Any) -> str:
if self.env.config.autodoc_typehints == 'none':
kwargs.setdefault('show_annotation', False)
@@ -1047,7 +1047,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
'private-members': bool_option, 'special-members': members_option,
} # type: Dict[str, Callable]
- def __init__(self, *args) -> None:
+ def __init__(self, *args: Any) -> None:
super().__init__(*args)
merge_special_members_option(self.options)
@@ -1067,7 +1067,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
self.doc_as_attr = True
return ret
- def format_args(self, **kwargs) -> str:
+ def format_args(self, **kwargs: Any) -> str:
if self.env.config.autodoc_typehints == 'none':
kwargs.setdefault('show_annotation', False)
@@ -1087,7 +1087,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
# with __init__ in C
return None
- def format_signature(self, **kwargs) -> str:
+ def format_signature(self, **kwargs: Any) -> str:
if self.doc_as_attr:
return ''
@@ -1275,7 +1275,7 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type:
return ret
- def format_args(self, **kwargs) -> str:
+ def format_args(self, **kwargs: Any) -> str:
if self.env.config.autodoc_typehints == 'none':
kwargs.setdefault('show_annotation', False)
@@ -1290,7 +1290,7 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type:
args = args.replace('\\', '\\\\')
return args
- def add_directive_header(self, sig) -> None:
+ def add_directive_header(self, sig: str) -> None:
super().add_directive_header(sig)
sourcename = self.get_sourcename()
@@ -1492,7 +1492,7 @@ def get_documenters(app: Sphinx) -> Dict[str, "Type[Documenter]"]:
return app.registry.documenters
-def autodoc_attrgetter(app: Sphinx, obj: Any, name: str, *defargs) -> Any:
+def autodoc_attrgetter(app: Sphinx, obj: Any, name: str, *defargs: Any) -> Any:
"""Alternative getattr() for types"""
for typ, func in app.registry.autodoc_attrgettrs.items():
if isinstance(obj, typ):
diff --git a/sphinx/ext/autodoc/mock.py b/sphinx/ext/autodoc/mock.py
index 7fa4627a6..055b706b1 100644
--- a/sphinx/ext/autodoc/mock.py
+++ b/sphinx/ext/autodoc/mock.py
@@ -28,7 +28,7 @@ class _MockObject:
__display_name__ = '_MockObject'
- def __new__(cls, *args, **kwargs) -> Any:
+ def __new__(cls, *args: Any, **kwargs: Any) -> Any:
if len(args) == 3 and isinstance(args[1], tuple):
superclass = args[1][-1].__class__
if superclass is cls:
@@ -38,7 +38,7 @@ class _MockObject:
return super().__new__(cls)
- def __init__(self, *args, **kwargs) -> None:
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.__qualname__ = ''
def __len__(self) -> int:
@@ -59,7 +59,7 @@ class _MockObject:
def __getattr__(self, key: str) -> "_MockObject":
return _make_subclass(key, self.__display_name__, self.__class__)()
- def __call__(self, *args, **kw) -> Any:
+ def __call__(self, *args: Any, **kw: Any) -> Any:
if args and type(args[0]) in [type, FunctionType, MethodType]:
# Appears to be a decorator, pass through unchanged
return args[0]
diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py
index 85cf841ed..1db927f9a 100644
--- a/sphinx/ext/autosummary/generate.py
+++ b/sphinx/ext/autosummary/generate.py
@@ -62,7 +62,7 @@ class DummyApplication:
self._warncount = 0
self.warningiserror = False
- def emit_firstresult(self, *args) -> None:
+ def emit_firstresult(self, *args: Any) -> None:
pass
diff --git a/sphinx/ext/coverage.py b/sphinx/ext/coverage.py
index 7d53e7bb9..1bb914810 100644
--- a/sphinx/ext/coverage.py
+++ b/sphinx/ext/coverage.py
@@ -80,7 +80,7 @@ class CoverageBuilder(Builder):
def get_outdated_docs(self) -> str:
return 'coverage overview'
- def write(self, *ignored) -> None:
+ def write(self, *ignored: Any) -> None:
self.py_undoc = {} # type: Dict[str, Dict[str, Any]]
self.build_py_coverage()
self.write_py_coverage()
diff --git a/sphinx/ext/duration.py b/sphinx/ext/duration.py
index 1286e49ec..6308d569b 100644
--- a/sphinx/ext/duration.py
+++ b/sphinx/ext/duration.py
@@ -32,7 +32,7 @@ class DurationDomain(Domain):
def reading_durations(self) -> Dict[str, timedelta]:
return self.data.setdefault('reading_durations', {})
- def note_reading_duration(self, duration: timedelta):
+ def note_reading_duration(self, duration: timedelta) -> None:
self.reading_durations[self.env.docname] = duration
def clear(self) -> None:
@@ -69,7 +69,7 @@ def on_doctree_read(app: Sphinx, doctree: nodes.document) -> None:
domain.note_reading_duration(duration)
-def on_build_finished(app: Sphinx, error):
+def on_build_finished(app: Sphinx, error: Exception) -> None:
"""Display duration ranking on current build."""
domain = cast(DurationDomain, app.env.get_domain('duration'))
durations = sorted(domain.reading_durations.items(), key=itemgetter(1), reverse=True)
diff --git a/sphinx/ext/napoleon/__init__.py b/sphinx/ext/napoleon/__init__.py
index d211a050e..25b8640d7 100644
--- a/sphinx/ext/napoleon/__init__.py
+++ b/sphinx/ext/napoleon/__init__.py
@@ -265,7 +265,7 @@ class Config:
'napoleon_custom_sections': (None, 'env')
}
- def __init__(self, **settings) -> None:
+ def __init__(self, **settings: Any) -> None:
for name, (default, rebuild) in self._config_values.items():
setattr(self, name, default)
for name, value in settings.items():
diff --git a/sphinx/ext/napoleon/iterators.py b/sphinx/ext/napoleon/iterators.py
index 3aa728e44..2adbd431f 100644
--- a/sphinx/ext/napoleon/iterators.py
+++ b/sphinx/ext/napoleon/iterators.py
@@ -47,7 +47,7 @@ class peek_iter:
be set to a new object instance: ``object()``.
"""
- def __init__(self, *args) -> None:
+ def __init__(self, *args: Any) -> None:
"""__init__(o, sentinel=None)"""
self._iterable = iter(*args) # type: Iterable
self._cache = collections.deque() # type: collections.deque
@@ -208,7 +208,7 @@ class modify_iter(peek_iter):
"whitespace."
"""
- def __init__(self, *args, **kwargs) -> None:
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
"""__init__(o, sentinel=None, modifier=lambda x: x)"""
if 'modifier' in kwargs:
self.modifier = kwargs['modifier']