mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Update type annotations
This commit is contained in:
parent
e4a0f99dda
commit
d5288567fd
@ -30,6 +30,7 @@ import subprocess
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Any # NOQA
|
||||
from sphinx.application import Sphinx # NOQA
|
||||
|
||||
# Use plistlib.dump in 3.4 and above
|
||||
@ -271,7 +272,7 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.setup_extension('sphinx.builders.html')
|
||||
app.add_builder(AppleHelpBuilder)
|
||||
|
||||
|
@ -165,7 +165,7 @@ class ChangesBuilder(Builder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_builder(ChangesBuilder)
|
||||
|
||||
return {
|
||||
|
@ -132,7 +132,7 @@ class DevhelpBuilder(StandaloneHTMLBuilder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.setup_extension('sphinx.builders.html')
|
||||
app.add_builder(DevhelpBuilder)
|
||||
|
||||
|
@ -838,7 +838,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.setup_extension('sphinx.builders.html')
|
||||
app.add_builder(EpubBuilder)
|
||||
|
||||
|
@ -277,7 +277,7 @@ class MessageCatalogBuilder(I18nBuilder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_builder(MessageCatalogBuilder)
|
||||
|
||||
app.add_config_value('gettext_compact', True, 'gettext')
|
||||
|
@ -1275,7 +1275,7 @@ def validate_config_values(app):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
# builders
|
||||
app.add_builder(StandaloneHTMLBuilder)
|
||||
app.add_builder(DirectoryHTMLBuilder)
|
||||
|
@ -286,7 +286,7 @@ def validate_config_values(app):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_builder(LaTeXBuilder)
|
||||
app.connect('builder-inited', validate_config_values)
|
||||
|
||||
|
@ -310,7 +310,7 @@ class CheckExternalLinksBuilder(Builder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_builder(CheckExternalLinksBuilder)
|
||||
|
||||
app.add_config_value('linkcheck_ignore', [], None)
|
||||
|
@ -103,7 +103,7 @@ class ManualPageBuilder(Builder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_builder(ManualPageBuilder)
|
||||
|
||||
app.add_config_value('man_pages',
|
||||
|
@ -318,7 +318,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.setup_extension('sphinx.builders.html')
|
||||
app.add_builder(QtHelpBuilder)
|
||||
|
||||
|
@ -242,7 +242,7 @@ class TexinfoBuilder(Builder):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_builder(TexinfoBuilder)
|
||||
|
||||
app.add_config_value('texinfo_documents',
|
||||
|
@ -242,7 +242,7 @@ class DefaultDomain(Directive):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
directives.register_directive('default-role', DefaultRole)
|
||||
directives.register_directive('default-domain', DefaultDomain)
|
||||
directives.register_directive('describe', ObjectDescription)
|
||||
|
@ -389,7 +389,7 @@ class LiteralInclude(Directive):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
directives.register_directive('highlight', Highlight)
|
||||
directives.register_directive('highlightlang', Highlight) # old
|
||||
directives.register_directive('code-block', CodeBlock)
|
||||
|
@ -427,7 +427,7 @@ class Include(BaseInclude):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
directives.register_directive('toctree', TocTree)
|
||||
directives.register_directive('sectionauthor', Author)
|
||||
directives.register_directive('moduleauthor', Author)
|
||||
|
@ -325,7 +325,7 @@ class CDomain(Domain):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_domain(CDomain)
|
||||
|
||||
return {
|
||||
|
@ -4987,7 +4987,7 @@ class CPPDomain(Domain):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_domain(CPPDomain)
|
||||
app.add_config_value("cpp_index_common_prefix", [], 'env')
|
||||
app.add_config_value("cpp_id_attributes", [], 'env')
|
||||
|
@ -20,7 +20,7 @@ from sphinx.util.docfields import Field, GroupedField, TypedField
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Iterator, Tuple # NOQA
|
||||
from typing import Any, Iterator, Tuple # NOQA
|
||||
from docutils import nodes # NOQA
|
||||
from sphinx.application import Sphinx # NOQA
|
||||
from sphinx.builders import Builder # NOQA
|
||||
@ -255,7 +255,7 @@ class JavaScriptDomain(Domain):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_domain(JavaScriptDomain)
|
||||
|
||||
return {
|
||||
|
@ -841,7 +841,7 @@ class PythonDomain(Domain):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_domain(PythonDomain)
|
||||
|
||||
return {
|
||||
|
@ -22,7 +22,7 @@ from sphinx.util.nodes import make_refnode
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Iterator, Tuple # NOQA
|
||||
from typing import Any, Iterator, Tuple # NOQA
|
||||
from docutils import nodes # NOQA
|
||||
from sphinx.application import Sphinx # NOQA
|
||||
from sphinx.builders import Builder # NOQA
|
||||
@ -177,7 +177,7 @@ class ReSTDomain(Domain):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_domain(ReSTDomain)
|
||||
|
||||
return {
|
||||
|
@ -909,7 +909,7 @@ class StandardDomain(Domain):
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> None
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_domain(StandardDomain)
|
||||
|
||||
return {
|
||||
|
@ -166,7 +166,7 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
|
||||
template = template_env.get_template('autosummary/base.rst')
|
||||
|
||||
def get_members(obj, typ, include_public=[], imported=False):
|
||||
# type: (Any, unicode, List[unicode]) -> Tuple[List[unicode], List[unicode]]
|
||||
# type: (Any, unicode, List[unicode], bool) -> Tuple[List[unicode], List[unicode]]
|
||||
items = [] # type: List[unicode]
|
||||
for name in dir(obj):
|
||||
try:
|
||||
|
@ -47,7 +47,6 @@ def make_admonition(node_class, name, arguments, options, content, lineno,
|
||||
|
||||
class _DeprecationWrapper(object):
|
||||
def __init__(self, mod, deprecated):
|
||||
# type: (Any, Dict) -> None
|
||||
self._mod = mod
|
||||
self._deprecated = deprecated
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user