mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix mypy violations
This commit is contained in:
parent
a073e17537
commit
5d1b8ff55f
@ -122,7 +122,7 @@ class Sphinx(object):
|
||||
self.enumerable_nodes = {} # type: Dict[nodes.Node, Tuple[unicode, Callable]] # NOQA
|
||||
self.html_themes = {} # type: Dict[unicode, unicode]
|
||||
|
||||
self.srcdir = srcdir
|
||||
self.srcdir = srcdir # type: unicode
|
||||
self.confdir = confdir
|
||||
self.outdir = outdir
|
||||
self.doctreedir = doctreedir
|
||||
|
@ -594,9 +594,9 @@ class StandaloneHTMLBuilder(Builder):
|
||||
doctree.settings = self.docsettings
|
||||
|
||||
self.secnumbers = self.env.toc_secnumbers.get(docname, {})
|
||||
self.fignumbers = self.env.toc_fignumbers.get(docname, {})
|
||||
self.fignumbers = self.env.toc_fignumbers.get(docname, {}) # type: Dict[unicode, Dict[unicode, Tuple[int, ...]]] # NOQA
|
||||
self.imgpath = relative_uri(self.get_target_uri(docname), '_images')
|
||||
self.dlpath = relative_uri(self.get_target_uri(docname), '_downloads')
|
||||
self.dlpath = relative_uri(self.get_target_uri(docname), '_downloads') # type: unicode
|
||||
self.current_docname = docname
|
||||
self.docwriter.write(doctree, destination)
|
||||
self.docwriter.assemble_parts()
|
||||
|
@ -169,8 +169,8 @@ class BuildEnvironment(object):
|
||||
# type: (Sphinx) -> None
|
||||
self.app = app
|
||||
self.doctreedir = app.doctreedir
|
||||
self.srcdir = app.srcdir
|
||||
self.config = app.config
|
||||
self.srcdir = app.srcdir # type: unicode
|
||||
self.config = app.config # type: Config
|
||||
|
||||
# the method of doctree versioning; see set_versioning_method
|
||||
self.versioning_condition = None # type: Union[bool, Callable]
|
||||
@ -187,7 +187,7 @@ class BuildEnvironment(object):
|
||||
self._warnfunc = None # type: Callable
|
||||
|
||||
# this is to invalidate old pickles
|
||||
self.version = ENV_VERSION
|
||||
self.version = ENV_VERSION # type: int
|
||||
|
||||
# All "docnames" here are /-separated and relative and exclude
|
||||
# the source suffix.
|
||||
@ -252,8 +252,8 @@ class BuildEnvironment(object):
|
||||
# lineno, module, descname, content)
|
||||
|
||||
# these map absolute path -> (docnames, unique filename)
|
||||
self.images = FilenameUniqDict()
|
||||
self.dlfiles = FilenameUniqDict()
|
||||
self.images = FilenameUniqDict() # type: FilenameUniqDict
|
||||
self.dlfiles = FilenameUniqDict() # type: FilenameUniqDict
|
||||
|
||||
# the original URI for images
|
||||
self.original_image_uri = {} # type: Dict[unicode, unicode]
|
||||
|
@ -41,6 +41,7 @@ if TYPE_CHECKING:
|
||||
from docutils import nodes # NOQA
|
||||
from docutils.utils import Reporter # NOQA
|
||||
from sphinx.application import Sphinx # NOQA
|
||||
from sphinx.environment import BuildEnvironment # NOQA
|
||||
from sphinx.ext.autodoc.directive import DocumenterBridge # NOQA
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -281,7 +282,7 @@ class Documenter(object):
|
||||
def __init__(self, directive, name, indent=u''):
|
||||
# type: (DocumenterBridge, unicode, unicode) -> None
|
||||
self.directive = directive
|
||||
self.env = directive.env
|
||||
self.env = directive.env # type: BuildEnvironment
|
||||
self.options = directive.genopt
|
||||
self.name = name
|
||||
self.indent = indent
|
||||
@ -745,7 +746,7 @@ class Documenter(object):
|
||||
# where the attribute documentation would actually be found in.
|
||||
# This is used for situations where you have a module that collects the
|
||||
# functions and classes of internal submodules.
|
||||
self.real_modname = real_modname or self.get_real_modname()
|
||||
self.real_modname = real_modname or self.get_real_modname() # type: str
|
||||
|
||||
# try to also get a source code analyzer for attribute docs
|
||||
try:
|
||||
|
@ -289,7 +289,7 @@ def read_doc(app, env, filename):
|
||||
source_class=SphinxDummySourceClass,
|
||||
destination=NullOutput())
|
||||
pub.set_components(None, 'restructuredtext', None)
|
||||
pub.process_programmatic_settings(None, env.settings, None)
|
||||
pub.process_programmatic_settings(None, env.settings, None) # type: ignore
|
||||
pub.set_source(source, filename)
|
||||
pub.publish()
|
||||
return pub.document
|
||||
|
@ -374,7 +374,7 @@ class SphinxSmartQuotes(SmartQuotes, SphinxTransform):
|
||||
return False
|
||||
|
||||
# confirm selected language supports smart_quotes or not
|
||||
language = self.env.settings['language_code']
|
||||
language = self.env.settings['language_code'] # type: ignore
|
||||
for tag in normalize_language_tag(language):
|
||||
if tag in smartchars.quotes:
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user