diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-01-22 16:05:38 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-02-04 09:14:51 +0300 |
commit | dc2b153835af985c1bd940aa4116b78bf248b6e0 (patch) | |
tree | 29383d6007d2f13c517ae4646e639362017aa9d4 /sphinx/ext/extlinks.py | |
parent | 498fa379efe5b6b106c8d3eb56041164cdc8bab3 (diff) |
Update type annotations
Diffstat (limited to 'sphinx/ext/extlinks.py')
-rw-r--r-- | sphinx/ext/extlinks.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sphinx/ext/extlinks.py b/sphinx/ext/extlinks.py index 020e829a0..29bfe928f 100644 --- a/sphinx/ext/extlinks.py +++ b/sphinx/ext/extlinks.py @@ -30,9 +30,18 @@ from six import iteritems import sphinx from sphinx.util.nodes import split_explicit_title +if False: + # For type annotation + from typing import Any, Dict, List, Tuple # NOQA + from docutils.parsers.rst.states import Inliner # NOQA + from sphinx.application import Sphinx # NOQA + from sphinx.util.typing import RoleFunction # NOQA + def make_link_role(base_url, prefix): + # type: (unicode, unicode) -> RoleFunction def role(typ, rawtext, text, lineno, inliner, options={}, content=[]): + # type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA text = utils.unescape(text) has_explicit_title, title, part = split_explicit_title(text) try: @@ -54,11 +63,13 @@ def make_link_role(base_url, prefix): def setup_link_roles(app): + # type: (Sphinx) -> None for name, (base_url, prefix) in iteritems(app.config.extlinks): app.add_role(name, make_link_role(base_url, prefix)) def setup(app): + # type: (Sphinx) -> Dict[unicode, Any] app.add_config_value('extlinks', {}, 'env') app.connect('builder-inited', setup_link_roles) return {'version': sphinx.__display_version__, 'parallel_read_safe': True} |