summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-09-08 15:17:01 -0700
committerJon Dufresne <jon.dufresne@gmail.com>2018-09-09 15:08:44 -0700
commit38709af87bbcd2cb62eab9e552be64552e570326 (patch)
tree0994fdc82aa4b4b4671a4d92c03049946efb3a67
parentffaa528c9880ca824dc67b27a800d2cd7df1221c (diff)
downloadsphinx-git-38709af87bbcd2cb62eab9e552be64552e570326.tar.gz
Correct some unicode/str types to bytes
More explicit and more forward compatible with Python 3.
-rw-r--r--sphinx/locale/__init__.py2
-rw-r--r--sphinx/util/images.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py
index d5ca91488..5c2caea9b 100644
--- a/sphinx/locale/__init__.py
+++ b/sphinx/locale/__init__.py
@@ -65,7 +65,7 @@ class _TranslationProxy(UserString, object):
# for the encoding result
def encode(self, encoding=None, errors=None): # type: ignore
- # type: (unicode, unicode) -> str
+ # type: (unicode, unicode) -> bytes
if encoding:
if errors:
return self.data.encode(encoding, errors)
diff --git a/sphinx/util/images.py b/sphinx/util/images.py
index 9abe748e4..321768670 100644
--- a/sphinx/util/images.py
+++ b/sphinx/util/images.py
@@ -78,7 +78,7 @@ def guess_mimetype_for_stream(stream, default=None):
def guess_mimetype(filename='', content=None, default=None):
- # type: (unicode, unicode, unicode) -> unicode
+ # type: (unicode, bytes, unicode) -> unicode
_, ext = path.splitext(filename.lower())
if ext in mime_suffixes:
return mime_suffixes[ext]
@@ -123,7 +123,7 @@ def parse_data_uri(uri):
def test_svg(h, f):
- # type: (unicode, IO) -> unicode
+ # type: (bytes, IO) -> unicode
"""An additional imghdr library helper; test the header is SVG's or not."""
try:
if '<svg' in h.decode('utf-8').lower():