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
c2f78b6870
commit
ea9177c803
@ -48,7 +48,7 @@ from sphinx.writers.html import HTMLWriter, HTMLTranslator, \
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Any, Iterable, Iterator, Tuple, Union # NOQA
|
||||
from typing import Any, Iterable, Iterator, Type, Tuple, Union # NOQA
|
||||
from sphinx.domains import Domain, Index # NOQA
|
||||
from sphinx.application import Sphinx # NOQA
|
||||
|
||||
@ -105,7 +105,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
css_files = [] # type: List[unicode]
|
||||
|
||||
imgpath = None # type: unicode
|
||||
domain_indices = [] # type: List[Tuple[unicode, Index, unicode, bool]]
|
||||
domain_indices = [] # type: List[Tuple[unicode, Type[Index], List[Tuple[unicode, List[List[Union[unicode, int]]]]], bool]] # NOQA
|
||||
|
||||
default_sidebars = ['localtoc.html', 'relations.html',
|
||||
'sourcelink.html', 'searchbox.html']
|
||||
@ -295,7 +295,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
domain = None # type: Domain
|
||||
domain = self.env.domains[domain_name]
|
||||
for indexcls in domain.indices:
|
||||
indexname = '%s-%s' % (domain.name, indexcls.name)
|
||||
indexname = '%s-%s' % (domain.name, indexcls.name) # type: unicode
|
||||
if isinstance(indices_config, list):
|
||||
if indexname not in indices_config:
|
||||
continue
|
||||
@ -326,10 +326,10 @@ class StandaloneHTMLBuilder(Builder):
|
||||
|
||||
self.relations = self.env.collect_relations()
|
||||
|
||||
rellinks = []
|
||||
rellinks = [] # type: List[Tuple[unicode, unicode, unicode, unicode]]
|
||||
if self.use_index:
|
||||
rellinks.append(('genindex', _('General Index'), 'I', _('index')))
|
||||
for indexname, indexcls, content, collapse in self.domain_indices: # type: ignore
|
||||
for indexname, indexcls, content, collapse in self.domain_indices:
|
||||
# if it has a short name
|
||||
if indexcls.shortname:
|
||||
rellinks.append((indexname, indexcls.localname,
|
||||
|
@ -72,7 +72,7 @@ class Toctree(EnvironmentManager):
|
||||
self.numbered_toctrees.add(docname)
|
||||
|
||||
for subfn, fnset in other.files_to_rebuild.items():
|
||||
self.files_to_rebuild.setdefault(subfn, set()).update(fnset & docnames)
|
||||
self.files_to_rebuild.setdefault(subfn, set()).update(fnset & set(docnames))
|
||||
|
||||
def process_doc(self, docname, doctree):
|
||||
# type: (unicode, nodes.Node) -> None
|
||||
|
@ -149,7 +149,7 @@ class FilenameUniqDict(dict):
|
||||
def merge_other(self, docnames, other):
|
||||
# type: (List[unicode], Dict[unicode, Tuple[Set[unicode], Any]]) -> None
|
||||
for filename, (docs, unique) in other.items():
|
||||
for doc in docs & docnames:
|
||||
for doc in docs & set(docnames):
|
||||
self.add_file(doc, filename)
|
||||
|
||||
def __getstate__(self):
|
||||
|
Loading…
Reference in New Issue
Block a user