summaryrefslogtreecommitdiff
path: root/sphinx/util/inventory.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/inventory.py')
-rw-r--r--sphinx/util/inventory.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/sphinx/util/inventory.py b/sphinx/util/inventory.py
index cd0555d9d..31daa3f37 100644
--- a/sphinx/util/inventory.py
+++ b/sphinx/util/inventory.py
@@ -21,7 +21,6 @@ if False:
from typing import Callable, Dict, IO, Iterator, Tuple # NOQA
from sphinx.builders import Builder # 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
@@ -50,7 +49,7 @@ class InventoryFileReader:
self.buffer += chunk
def readline(self):
- # type: () -> unicode
+ # type: () -> str
pos = self.buffer.find(b'\n')
if pos != -1:
line = self.buffer[:pos].decode('utf-8')
@@ -65,7 +64,7 @@ class InventoryFileReader:
return line
def readlines(self):
- # type: () -> Iterator[unicode]
+ # type: () -> Iterator[str]
while not self.eof:
line = self.readline()
if line:
@@ -81,7 +80,7 @@ class InventoryFileReader:
yield decompressor.flush()
def read_compressed_lines(self):
- # type: () -> Iterator[unicode]
+ # type: () -> Iterator[str]
buf = b''
for chunk in self.read_compressed_chunks():
buf += chunk
@@ -95,7 +94,7 @@ class InventoryFileReader:
class InventoryFile:
@classmethod
def load(cls, stream, uri, joinfunc):
- # type: (IO, unicode, Callable) -> Inventory
+ # type: (IO, str, Callable) -> Inventory
reader = InventoryFileReader(stream)
line = reader.readline().rstrip()
if line == '# Sphinx inventory version 1':
@@ -107,7 +106,7 @@ class InventoryFile:
@classmethod
def load_v1(cls, stream, uri, join):
- # type: (InventoryFileReader, unicode, Callable) -> Inventory
+ # type: (InventoryFileReader, str, Callable) -> Inventory
invdata = {} # type: Inventory
projname = stream.readline().rstrip()[11:]
version = stream.readline().rstrip()[11:]
@@ -126,7 +125,7 @@ class InventoryFile:
@classmethod
def load_v2(cls, stream, uri, join):
- # type: (InventoryFileReader, unicode, Callable) -> Inventory
+ # type: (InventoryFileReader, str, Callable) -> Inventory
invdata = {} # type: Inventory
projname = stream.readline().rstrip()[11:]
version = stream.readline().rstrip()[11:]
@@ -156,9 +155,9 @@ class InventoryFile:
@classmethod
def dump(cls, filename, env, builder):
- # type: (unicode, BuildEnvironment, Builder) -> None
+ # type: (str, BuildEnvironment, Builder) -> None
def escape(string):
- # type: (unicode) -> unicode
+ # type: (str) -> str
return re.sub("\\s+", " ", string)
with open(os.path.join(filename), 'wb') as f: