Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-07-06 06:27:36 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-07-06 06:42:26 +0300
commitbe673a714db80d3596f811ccf5421d5653cbe559 (patch)
tree9a57ed8a1249eaee555760d909533dba128e02d4 /sphinx/environment/collectors/indexentries.py
parentf076afd920b0b36d63608a63fae72f484d4bd65e (diff)
Migrate to py3 style type annotation: sphinx.environment.collectors.indexentries
Diffstat (limited to 'sphinx/environment/collectors/indexentries.py')
-rw-r--r--sphinx/environment/collectors/indexentries.py26
1 files changed, 11 insertions, 15 deletions
diff --git a/sphinx/environment/collectors/indexentries.py b/sphinx/environment/collectors/indexentries.py
index 2d8af7887..9c86779fc 100644
--- a/sphinx/environment/collectors/indexentries.py
+++ b/sphinx/environment/collectors/indexentries.py
@@ -8,34 +8,31 @@
:license: BSD, see LICENSE for details.
"""
+from typing import Any, Dict, Set
+
+from docutils import nodes
+
from sphinx import addnodes
+from sphinx.application import Sphinx
+from sphinx.environment import BuildEnvironment
from sphinx.environment.collectors import EnvironmentCollector
from sphinx.util import split_index_msg, logging
-if False:
- # For type annotation
- from typing import Dict, Set # NOQA
- from docutils import nodes # NOQA
- from sphinx.applicatin import Sphinx # NOQA
- from sphinx.environment import BuildEnvironment # NOQA
-
logger = logging.getLogger(__name__)
class IndexEntriesCollector(EnvironmentCollector):
name = 'indices'
- def clear_doc(self, app, env, docname):
- # type: (Sphinx, BuildEnvironment, str) -> None
+ def clear_doc(self, app: Sphinx, env: BuildEnvironment, docname: str) -> None:
env.indexentries.pop(docname, None)
- def merge_other(self, app, env, docnames, other):
- # type: (Sphinx, BuildEnvironment, Set[str], BuildEnvironment) -> None
+ def merge_other(self, app: Sphinx, env: BuildEnvironment,
+ docnames: Set[str], other: BuildEnvironment) -> None:
for docname in docnames:
env.indexentries[docname] = other.indexentries[docname]
- def process_doc(self, app, doctree):
- # type: (Sphinx, nodes.document) -> None
+ def process_doc(self, app: Sphinx, doctree: nodes.document) -> None:
docname = app.env.docname
entries = app.env.indexentries[docname] = []
for node in doctree.traverse(addnodes.index):
@@ -50,8 +47,7 @@ class IndexEntriesCollector(EnvironmentCollector):
entries.append(entry)
-def setup(app):
- # type: (Sphinx) -> Dict
+def setup(app: Sphinx) -> Dict[str, Any]:
app.add_env_collector(IndexEntriesCollector)
return {