mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
commit
914d93a9e1
@ -427,6 +427,6 @@ def inspect_main(argv):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import logging # type: ignore
|
import logging # type: ignore
|
||||||
logging.basicConfig()
|
logging.basicConfig() # type: ignore
|
||||||
|
|
||||||
inspect_main(argv=sys.argv[1:]) # type: ignore
|
inspect_main(argv=sys.argv[1:]) # type: ignore
|
||||||
|
@ -32,7 +32,7 @@ class ModuleAnalyzer(object):
|
|||||||
def for_string(cls, string, modname, srcname='<string>'):
|
def for_string(cls, string, modname, srcname='<string>'):
|
||||||
# type: (unicode, unicode, unicode) -> ModuleAnalyzer
|
# type: (unicode, unicode, unicode) -> ModuleAnalyzer
|
||||||
if isinstance(string, bytes):
|
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
|
return cls(StringIO(string), modname, srcname, decoded=True) # type: ignore
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -30,7 +30,7 @@ class path(text_type):
|
|||||||
# type: (unicode, unicode, unicode) -> path
|
# type: (unicode, unicode, unicode) -> path
|
||||||
if isinstance(s, str):
|
if isinstance(s, str):
|
||||||
s = s.decode(encoding, errors)
|
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
|
return text_type.__new__(cls, s) # type: ignore
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -73,7 +73,7 @@ def get_image_size(filename):
|
|||||||
|
|
||||||
def guess_mimetype_for_stream(stream, default=None):
|
def guess_mimetype_for_stream(stream, default=None):
|
||||||
# type: (IO, unicode) -> unicode
|
# type: (IO, unicode) -> unicode
|
||||||
imgtype = imghdr.what(stream)
|
imgtype = imghdr.what(stream) # type: ignore
|
||||||
if imgtype:
|
if imgtype:
|
||||||
return 'image/' + imgtype
|
return 'image/' + imgtype
|
||||||
else:
|
else:
|
||||||
@ -141,4 +141,4 @@ def test_svg(h, f):
|
|||||||
|
|
||||||
# install test_svg() to imghdr
|
# install test_svg() to imghdr
|
||||||
# refs: https://docs.python.org/3.6/library/imghdr.html#imghdr.tests
|
# refs: https://docs.python.org/3.6/library/imghdr.html#imghdr.tests
|
||||||
imghdr.tests.append(test_svg)
|
imghdr.tests.append(test_svg) # type: ignore
|
||||||
|
@ -235,7 +235,7 @@ def abspath(pathdir):
|
|||||||
try:
|
try:
|
||||||
pathdir = pathdir.decode(fs_encoding)
|
pathdir = pathdir.decode(fs_encoding)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
raise UnicodeDecodeError('multibyte filename not supported on '
|
raise UnicodeDecodeError('multibyte filename not supported on ' # type: ignore
|
||||||
'this filesystem encoding '
|
'this filesystem encoding '
|
||||||
'(%r)' % fs_encoding)
|
'(%r)' % fs_encoding)
|
||||||
return pathdir
|
return pathdir
|
||||||
|
@ -34,7 +34,7 @@ except ImportError:
|
|||||||
from urllib3.exceptions import InsecureRequestWarning # type: ignore
|
from urllib3.exceptions import InsecureRequestWarning # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# for requests < 2.4.0
|
# for requests < 2.4.0
|
||||||
InsecureRequestWarning = None
|
InsecureRequestWarning = None # type: ignore
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from requests.packages.urllib3.exceptions import InsecurePlatformWarning
|
from requests.packages.urllib3.exceptions import InsecurePlatformWarning
|
||||||
@ -44,7 +44,7 @@ except ImportError:
|
|||||||
from urllib3.exceptions import InsecurePlatformWarning # type: ignore
|
from urllib3.exceptions import InsecurePlatformWarning # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# for requests < 2.4.0
|
# for requests < 2.4.0
|
||||||
InsecurePlatformWarning = None
|
InsecurePlatformWarning = None # type: ignore
|
||||||
|
|
||||||
# try to load requests[security] (but only if SSL is available)
|
# try to load requests[security] (but only if SSL is available)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user