diff --git a/sphinx/application.py b/sphinx/application.py index d6b781f59..168e48983 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -564,7 +564,7 @@ class Sphinx(object): def emit(self, event, *args): # type: (unicode, Any) -> List try: - logger.debug2('[app] emitting event: %r%s', event, repr(args)[:100]) + logger.debug('[app] emitting event: %r%s', event, repr(args)[:100]) except Exception: # not every object likes to be repr()'d (think # random stuff coming via autodoc) diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 35bf52ad6..191646a94 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -391,7 +391,7 @@ class Builder(object): self.write_doc(docname, doctree) def _write_parallel(self, docnames, nproc): - # type: (Iterable[unicode], int) -> None + # type: (Sequence[unicode], int) -> None def write_process(docs): # type: (List[Tuple[unicode, nodes.Node]]) -> None for docname, doctree in docs: diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 2fd7a72a8..d9512b5df 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -732,7 +732,7 @@ class StandaloneHTMLBuilder(Builder): reference.append(node) def load_indexer(self, docnames): - # type: (Set[unicode]) -> None + # type: (Iterable[unicode]) -> None keep = set(self.env.all_docs) - set(docnames) try: searchindexfn = path.join(self.outdir, self.searchindex_filename) diff --git a/sphinx/domains/__init__.py b/sphinx/domains/__init__.py index a90ee84aa..2389e342c 100644 --- a/sphinx/domains/__init__.py +++ b/sphinx/domains/__init__.py @@ -79,7 +79,7 @@ class Index(object): self.domain = domain def generate(self, docnames=None): - # type: (List[unicode]) -> Tuple[List[Tuple[unicode, List[List[Union[unicode, int]]]]], bool] # NOQA + # type: (Iterable[unicode]) -> Tuple[List[Tuple[unicode, List[List[Union[unicode, int]]]]], bool] # NOQA """Return entries for the index given by *name*. If *docnames* is given, restrict to entries referring to these docnames. @@ -107,7 +107,7 @@ class Index(object): Qualifier and description are not rendered e.g. in LaTeX output. """ - return [] + return tuple() class Domain(object): diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 886b1f863..2efc6db0b 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -27,7 +27,7 @@ from sphinx.util.docfields import Field, GroupedField, TypedField if False: # For type annotation - from typing import Any, Iterator, Tuple, Union # NOQA + from typing import Any, Iterable, Iterator, Tuple, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA @@ -582,7 +582,7 @@ class PythonModuleIndex(Index): shortname = l_('modules') def generate(self, docnames=None): - # type: (List[unicode]) -> Tuple[List[Tuple[unicode, List[List[Union[unicode, int]]]]], bool] # NOQA + # type: (Iterable[unicode]) -> Tuple[List[Tuple[unicode, List[List[Union[unicode, int]]]]], bool] # NOQA content = {} # type: Dict[unicode, List] # list of prefixes to ignore ignores = None # type: List[unicode] diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index cc321e386..af39722ce 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -272,7 +272,7 @@ def load_mappings(app): if isinstance(value, (list, tuple)): # new format - name, (uri, inv) = key, value + name, (uri, inv) = key, value # type: ignore if not isinstance(name, string_types): logger.warning('intersphinx identifier %r is not string. Ignored', name) continue diff --git a/sphinx/util/parallel.py b/sphinx/util/parallel.py index 9246841e5..1d97a511c 100644 --- a/sphinx/util/parallel.py +++ b/sphinx/util/parallel.py @@ -88,7 +88,7 @@ class ParallelTasks(object): failed = False except BaseException as err: failed = True - errmsg = traceback.format_exception_only(err.__class__, err)[0].strip() + errmsg = traceback.format_exception_only(err.__class__, err)[0].strip() # type: ignore # NOQA ret = (errmsg, traceback.format_exc()) logging.convert_serializable(collector.logs) pipe.send((failed, collector.logs, ret)) diff --git a/sphinx/util/requests.py b/sphinx/util/requests.py index 3f6ff3879..03e815c2c 100644 --- a/sphinx/util/requests.py +++ b/sphinx/util/requests.py @@ -22,7 +22,7 @@ try: except ImportError: # python-requests package in Debian jessie does not provide ``requests.packages.urllib3``. # So try to import the exceptions from urllib3 package. - from urllib3.exceptions import SSLError, InsecureRequestWarning + from urllib3.exceptions import SSLError, InsecureRequestWarning # type: ignore # try to load requests[security] try: