Merge pull request #5452 from tk0miya/mypy-0.630

Fix mypy violations
This commit is contained in:
Takeshi KOMIYA 2018-09-18 12:45:57 +09:00 committed by GitHub
commit 914d93a9e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View File

@ -427,6 +427,6 @@ def inspect_main(argv):
if __name__ == '__main__':
import logging # type: ignore
logging.basicConfig()
logging.basicConfig() # type: ignore
inspect_main(argv=sys.argv[1:]) # type: ignore

View File

@ -32,7 +32,7 @@ class ModuleAnalyzer(object):
def for_string(cls, string, modname, srcname='<string>'):
# type: (unicode, unicode, unicode) -> ModuleAnalyzer
if isinstance(string, bytes):
return cls(BytesIO(string), modname, srcname)
return cls(BytesIO(string), modname, srcname) # type: ignore
return cls(StringIO(string), modname, srcname, decoded=True) # type: ignore
@classmethod

View File

@ -30,7 +30,7 @@ class path(text_type):
# type: (unicode, unicode, unicode) -> path
if isinstance(s, str):
s = s.decode(encoding, errors)
return text_type.__new__(cls, s)
return text_type.__new__(cls, s) # type: ignore
return text_type.__new__(cls, s) # type: ignore
@property

View File

@ -73,7 +73,7 @@ def get_image_size(filename):
def guess_mimetype_for_stream(stream, default=None):
# type: (IO, unicode) -> unicode
imgtype = imghdr.what(stream)
imgtype = imghdr.what(stream) # type: ignore
if imgtype:
return 'image/' + imgtype
else:
@ -141,4 +141,4 @@ def test_svg(h, f):
# install test_svg() to imghdr
# refs: https://docs.python.org/3.6/library/imghdr.html#imghdr.tests
imghdr.tests.append(test_svg)
imghdr.tests.append(test_svg) # type: ignore

View File

@ -235,7 +235,7 @@ def abspath(pathdir):
try:
pathdir = pathdir.decode(fs_encoding)
except UnicodeDecodeError:
raise UnicodeDecodeError('multibyte filename not supported on '
raise UnicodeDecodeError('multibyte filename not supported on ' # type: ignore
'this filesystem encoding '
'(%r)' % fs_encoding)
return pathdir

View File

@ -34,7 +34,7 @@ except ImportError:
from urllib3.exceptions import InsecureRequestWarning # type: ignore
except ImportError:
# for requests < 2.4.0
InsecureRequestWarning = None
InsecureRequestWarning = None # type: ignore
try:
from requests.packages.urllib3.exceptions import InsecurePlatformWarning
@ -44,7 +44,7 @@ except ImportError:
from urllib3.exceptions import InsecurePlatformWarning # type: ignore
except ImportError:
# for requests < 2.4.0
InsecurePlatformWarning = None
InsecurePlatformWarning = None # type: ignore
# try to load requests[security] (but only if SSL is available)
try: