Correct some unicode/str types to bytes

More explicit and more forward compatible with Python 3.
This commit is contained in:
Jon Dufresne 2018-09-08 15:17:01 -07:00
parent ffaa528c98
commit 38709af87b
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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():