summaryrefslogtreecommitdiff
path: root/sphinx/ext/intersphinx.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-12-16 00:32:10 +0900
committerGitHub <noreply@github.com>2018-12-16 00:32:10 +0900
commitc70e65fc6cd04d02df4f7911025f534dbd27cc20 (patch)
tree1e8614ac5516dace99ef1df4d203081662c7c2d6 /sphinx/ext/intersphinx.py
parentd6d4406ce987cc8823d1b3a33be3a418bcd2a59d (diff)
parent79eec90f36f5a74e24cfd6740126396fd6567e07 (diff)
downloadsphinx-git-c70e65fc6cd04d02df4f7911025f534dbd27cc20.tar.gz
Merge branch 'master' into 5770_doctest_refers_highlight_language
Diffstat (limited to 'sphinx/ext/intersphinx.py')
-rw-r--r--sphinx/ext/intersphinx.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py
index 2c7d7bf51..b40edabbf 100644
--- a/sphinx/ext/intersphinx.py
+++ b/sphinx/ext/intersphinx.py
@@ -24,8 +24,6 @@
:license: BSD, see LICENSE for details.
"""
-from __future__ import print_function
-
import functools
import posixpath
import sys
@@ -49,7 +47,6 @@ if False:
from sphinx.application import Sphinx # NOQA
from sphinx.config import Config # NOQA
from sphinx.environment import BuildEnvironment # NOQA
- from sphinx.util.typing import unicode # NOQA
Inventory = Dict[text_type, Dict[text_type, Tuple[text_type, text_type, text_type, text_type]]] # NOQA
@@ -70,7 +67,7 @@ class InventoryAdapter:
@property
def cache(self):
- # type: () -> Dict[unicode, Tuple[unicode, int, Inventory]]
+ # type: () -> Dict[str, Tuple[str, int, Inventory]]
return self.env.intersphinx_cache # type: ignore
@property
@@ -80,7 +77,7 @@ class InventoryAdapter:
@property
def named_inventory(self):
- # type: () -> Dict[unicode, Inventory]
+ # type: () -> Dict[str, Inventory]
return self.env.intersphinx_named_inventory # type: ignore
def clear(self):
@@ -90,7 +87,7 @@ class InventoryAdapter:
def _strip_basic_auth(url):
- # type: (unicode) -> unicode
+ # type: (str) -> str
"""Returns *url* with basic auth credentials removed. Also returns the
basic auth username and password if they're present in *url*.
@@ -112,7 +109,7 @@ def _strip_basic_auth(url):
def _read_from_url(url, config=None):
- # type: (unicode, Config) -> IO
+ # type: (str, Config) -> IO
"""Reads data from *url* with an HTTP *GET*.
This function supports fetching from resources which use basic HTTP auth as
@@ -138,7 +135,7 @@ def _read_from_url(url, config=None):
def _get_safe_url(url):
- # type: (unicode) -> unicode
+ # type: (str) -> str
"""Gets version of *url* with basic auth passwords obscured. This function
returns results suitable for printing and logging.
@@ -164,7 +161,7 @@ def _get_safe_url(url):
def fetch_inventory(app, uri, inv):
- # type: (Sphinx, unicode, Any) -> Any
+ # type: (Sphinx, str, Any) -> Any
"""Fetch, parse and return an intersphinx inventory file."""
# both *uri* (base URI of the links to generate) and *inv* (actual
# location of the inventory file) can be local or remote URIs
@@ -211,9 +208,9 @@ def load_mappings(app):
inventories = InventoryAdapter(app.builder.env)
update = False
for key, value in app.config.intersphinx_mapping.items():
- name = None # type: unicode
- uri = None # type: unicode
- inv = None # type: Union[unicode, Tuple[unicode, ...]]
+ name = None # type: str
+ uri = None # type: str
+ inv = None # type: Union[str, Tuple[str, ...]]
if isinstance(value, (list, tuple)):
# new format
@@ -291,7 +288,7 @@ def missing_reference(app, env, node, contnode):
"""Attempt to resolve a missing reference via intersphinx references."""
target = node['reftarget']
inventories = InventoryAdapter(env)
- objtypes = None # type: List[unicode]
+ objtypes = None # type: List[str]
if node['reftype'] == 'any':
# we search anything!
objtypes = ['%s:%s' % (domain.name, objtype)
@@ -365,7 +362,7 @@ def missing_reference(app, env, node, contnode):
def setup(app):
- # type: (Sphinx) -> Dict[unicode, Any]
+ # type: (Sphinx) -> Dict[str, Any]
app.add_config_value('intersphinx_mapping', {}, True)
app.add_config_value('intersphinx_cache_limit', 5, False)
app.add_config_value('intersphinx_timeout', None, False)
@@ -379,7 +376,7 @@ def setup(app):
def inspect_main(argv):
- # type: (List[unicode]) -> None
+ # type: (List[str]) -> None
"""Debug functionality to print out an inventory"""
if len(argv) < 1:
print("Print out an inventory file.\n"
@@ -396,7 +393,7 @@ def inspect_main(argv):
config = MockConfig()
def warn(self, msg):
- # type: (unicode) -> None
+ # type: (str) -> None
print(msg, file=sys.stderr)
try: