diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-12-29 17:56:30 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-12-30 11:22:56 +0300 |
commit | ab184ac20d82d0546c21f33d2fdfbfb324078d56 (patch) | |
tree | 225b6c5f9904d8699332add3cb0939fb8be68ef2 /sphinx/registry.py | |
parent | 7a4bbf372a470700a1dfd96dd57054bb96b92fd3 (diff) |
mypy: Enable disallow_incomplete_defs flag for type checking
Diffstat (limited to 'sphinx/registry.py')
-rw-r--r-- | sphinx/registry.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sphinx/registry.py b/sphinx/registry.py index ffeaa555c..d7bffa2ce 100644 --- a/sphinx/registry.py +++ b/sphinx/registry.py @@ -184,7 +184,7 @@ class SphinxComponentRegistry: def add_directive_to_domain(self, domain: str, name: str, obj: Any, has_content: bool = None, argument_spec: Any = None, - override: bool = False, **option_spec) -> None: + override: bool = False, **option_spec: Any) -> None: logger.debug('[app] adding directive to domain: %r', (domain, name, obj, has_content, argument_spec, option_spec)) if domain not in self.domains: @@ -273,7 +273,7 @@ class SphinxComponentRegistry: else: self.source_suffix[suffix] = filetype - def add_source_parser(self, *args, **kwargs) -> None: + def add_source_parser(self, *args: Any, **kwargs: Any) -> None: logger.debug('[app] adding search source_parser: %r', args) if len(args) == 1: # new sytle arguments: (source_parser) @@ -352,7 +352,8 @@ class SphinxComponentRegistry: raise ExtensionError(__('Translator for %r already exists') % name) self.translators[name] = translator - def add_translation_handlers(self, node: "Type[Element]", **kwargs) -> None: + def add_translation_handlers(self, node: "Type[Element]", + **kwargs: Tuple[Callable, Callable]) -> None: logger.debug('[app] adding translation_handlers: %r, %r', node, kwargs) for builder_name, handlers in kwargs.items(): translation_handlers = self.translation_handlers.setdefault(builder_name, {}) @@ -361,13 +362,13 @@ class SphinxComponentRegistry: translation_handlers[node.__name__] = (visit, depart) except ValueError: raise ExtensionError(__('kwargs for add_node() must be a (visit, depart) ' - 'function tuple: %r=%r') % builder_name, handlers) + 'function tuple: %r=%r') % (builder_name, handlers)) def get_translator_class(self, builder: Builder) -> "Type[nodes.NodeVisitor]": return self.translators.get(builder.name, builder.default_translator_class) - def create_translator(self, builder: Builder, *args) -> nodes.NodeVisitor: + def create_translator(self, builder: Builder, *args: Any) -> nodes.NodeVisitor: translator_class = self.get_translator_class(builder) assert translator_class, "translator not found for %s" % builder.name translator = translator_class(*args) |