Merge branch '4.0.x' into 4.x

This commit is contained in:
Takeshi KOMIYA 2021-06-13 16:34:46 +09:00
commit 244dedb534
3 changed files with 13 additions and 10 deletions

View File

@ -44,8 +44,11 @@ extras_require = {
'lint': [ 'lint': [
'flake8>=3.5.0', 'flake8>=3.5.0',
'isort', 'isort',
'mypy>=0.800', 'mypy>=0.900',
'docutils-stubs', 'docutils-stubs',
"types-typed-ast",
"types-pkg_resources",
"types-requests",
], ],
'test': [ 'test': [
'pytest', 'pytest',

View File

@ -573,13 +573,13 @@ def setup(app: "Sphinx", status: IO, warning: IO) -> None:
for handler in logger.handlers[:]: for handler in logger.handlers[:]:
logger.removeHandler(handler) logger.removeHandler(handler)
info_handler = NewLineStreamHandler(SafeEncodingWriter(status)) # type: ignore info_handler = NewLineStreamHandler(SafeEncodingWriter(status))
info_handler.addFilter(InfoFilter()) info_handler.addFilter(InfoFilter())
info_handler.addFilter(InfoLogRecordTranslator(app)) info_handler.addFilter(InfoLogRecordTranslator(app))
info_handler.setLevel(VERBOSITY_MAP[app.verbosity]) info_handler.setLevel(VERBOSITY_MAP[app.verbosity])
info_handler.setFormatter(ColorizeFormatter()) info_handler.setFormatter(ColorizeFormatter())
warning_handler = WarningStreamHandler(SafeEncodingWriter(warning)) # type: ignore warning_handler = WarningStreamHandler(SafeEncodingWriter(warning))
warning_handler.addFilter(WarningSuppressor(app)) warning_handler.addFilter(WarningSuppressor(app))
warning_handler.addFilter(WarningLogRecordTranslator(app)) warning_handler.addFilter(WarningLogRecordTranslator(app))
warning_handler.addFilter(WarningIsErrorFilter(app)) warning_handler.addFilter(WarningIsErrorFilter(app))
@ -587,7 +587,7 @@ def setup(app: "Sphinx", status: IO, warning: IO) -> None:
warning_handler.setLevel(logging.WARNING) warning_handler.setLevel(logging.WARNING)
warning_handler.setFormatter(ColorizeFormatter()) warning_handler.setFormatter(ColorizeFormatter())
messagelog_handler = logging.StreamHandler(LastMessagesWriter(app, status)) # type: ignore messagelog_handler = logging.StreamHandler(LastMessagesWriter(app, status))
messagelog_handler.addFilter(InfoFilter()) messagelog_handler.addFilter(InfoFilter())
messagelog_handler.setLevel(VERBOSITY_MAP[app.verbosity]) messagelog_handler.setLevel(VERBOSITY_MAP[app.verbosity])
messagelog_handler.setFormatter(ColorizeFormatter()) messagelog_handler.setFormatter(ColorizeFormatter())

View File

@ -226,13 +226,13 @@ def _restify_py36(cls: Optional[Type]) -> str:
else: else:
reftext = ':class:`%s`' % qualname reftext = ':class:`%s`' % qualname
if cls.__args__ is None or len(cls.__args__) <= 2: # type: ignore # NOQA if cls.__args__ is None or len(cls.__args__) <= 2:
params = cls.__args__ # type: ignore params = cls.__args__
elif cls.__origin__ == Generator: # type: ignore elif cls.__origin__ == Generator:
params = cls.__args__ # type: ignore params = cls.__args__
else: # typing.Callable else: # typing.Callable
args = ', '.join(restify(arg) for arg in cls.__args__[:-1]) # type: ignore args = ', '.join(restify(arg) for arg in cls.__args__[:-1])
result = restify(cls.__args__[-1]) # type: ignore result = restify(cls.__args__[-1])
return reftext + '\\ [[%s], %s]' % (args, result) return reftext + '\\ [[%s], %s]' % (args, result)
if params: if params: