Merge pull request #5406 from jdufresne/bytes-type

Correct some unicode/str types to bytes
This commit is contained in:
Takeshi KOMIYA 2018-09-10 20:45:34 +09:00 committed by GitHub
commit d9c308a299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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():