Merge remote-tracking branch 'upstream/stable' into appropriate-footnote-warning_2

This commit is contained in:
cocoatomo
2017-10-07 15:38:40 +09:00
6 changed files with 9 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ Features added
--------------
* #4107: Make searchtools.js compatible with pre-Sphinx1.5 templates
* #4112: Don't override the smart_quotes setting if it was already set
Bugs fixed
----------

View File

@@ -368,7 +368,7 @@ def format_annotation(annotation):
Displaying complex types from ``typing`` relies on its private API.
"""
if typing and isinstance(annotation, typing.TypeVar): # type: ignore
if typing and isinstance(annotation, typing.TypeVar):
return annotation.__name__
if annotation == Ellipsis:
return '...'

View File

@@ -534,7 +534,7 @@ def valid_dir(d):
if not path.isdir(dir):
return False
if set(['Makefile', 'make.bat']) & set(os.listdir(dir)):
if set(['Makefile', 'make.bat']) & set(os.listdir(dir)): # type: ignore
return False
if d['sep']:
@@ -550,7 +550,7 @@ def valid_dir(d):
d['dot'] + 'templates',
d['master'] + d['suffix'],
]
if set(reserved_names) & set(os.listdir(dir)):
if set(reserved_names) & set(os.listdir(dir)): # type: ignore
return False
return True

View File

@@ -136,13 +136,13 @@ class NewLineStreamHandlerPY2(logging.StreamHandler):
# type: (logging.LogRecord) -> None
try:
self.acquire()
stream = self.stream # type: ignore
stream = self.stream
if getattr(record, 'nonl', False):
# remove return code forcely when nonl=True
self.stream = StringIO()
super(NewLineStreamHandlerPY2, self).emit(record)
stream.write(self.stream.getvalue()[:-1])
stream.flush()
stream.write(self.stream.getvalue()[:-1]) # type: ignore
stream.flush() # type: ignore
else:
super(NewLineStreamHandlerPY2, self).emit(record)
finally:

View File

@@ -96,7 +96,7 @@ _pat_cache = {} # type: Dict[unicode, Pattern]
def patmatch(name, pat):
# type: (unicode, unicode) -> re.Match
# type: (unicode, unicode) -> Match[unicode]
"""Return if name matches pat. Adapted from fnmatch module."""
if pat not in _pat_cache:
_pat_cache[pat] = re.compile(_translate_pattern(pat))

View File

@@ -36,7 +36,7 @@ if PY3:
from io import TextIOWrapper
else:
def TextIOWrapper(stream, encoding):
# type: (file, str) -> unicode
# type: (file, str) -> Any
return codecs.lookup(encoding or 'ascii')[2](stream)