From e72391d995c8bee13521875b5012eaf1966718d6 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 16 Dec 2018 10:58:46 -0800 Subject: [PATCH] Define a common Inventory type for reuse across modules --- sphinx/ext/intersphinx.py | 4 +--- sphinx/util/inventory.py | 5 +---- sphinx/util/typing.py | 2 ++ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index b40edabbf..51ef42841 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -33,7 +33,6 @@ from urllib.parse import urlsplit, urlunsplit from docutils import nodes from docutils.utils import relative_path -from six import text_type import sphinx from sphinx.builders.html import INVENTORY_FILENAME @@ -47,8 +46,7 @@ if False: from sphinx.application import Sphinx # NOQA from sphinx.config import Config # NOQA from sphinx.environment import BuildEnvironment # NOQA - - Inventory = Dict[text_type, Dict[text_type, Tuple[text_type, text_type, text_type, text_type]]] # NOQA + from sphinx.util.typing import Inventory # NOQA logger = logging.getLogger(__name__) diff --git a/sphinx/util/inventory.py b/sphinx/util/inventory.py index 8727a6f42..31adc0ad5 100644 --- a/sphinx/util/inventory.py +++ b/sphinx/util/inventory.py @@ -12,8 +12,6 @@ import os import re import zlib -from six import text_type - from sphinx.util import logging if False: @@ -21,8 +19,7 @@ if False: from typing import Callable, Dict, IO, Iterator, Tuple # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA - - Inventory = Dict[text_type, Dict[text_type, Tuple[text_type, text_type, text_type, text_type]]] # NOQA + from sphinx.util.typing import Inventory # NOQA BUFSIZE = 16 * 1024 diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py index 12b7a2642..01625bbc7 100644 --- a/sphinx/util/typing.py +++ b/sphinx/util/typing.py @@ -28,3 +28,5 @@ RoleFunction = Callable[[text_type, text_type, text_type, int, Inliner, Dict, Li # title getter functions for enumerable nodes (see sphinx.domains.std) TitleGetter = Callable[[nodes.Node], text_type] + +Inventory = Dict[str, Dict[str, Tuple[str, str, str, str]]]