Fix mypy violations (with mypy-0.920)

This commit is contained in:
Takeshi KOMIYA 2021-12-17 02:01:33 +09:00
parent 3ae124f8ac
commit 95d6478747
5 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ extras_require = {
'lint': [ 'lint': [
'flake8>=3.5.0', 'flake8>=3.5.0',
'isort', 'isort',
'mypy>=0.900', 'mypy>=0.920',
'docutils-stubs', 'docutils-stubs',
"types-typed-ast", "types-typed-ast",
"types-pkg_resources", "types-pkg_resources",

View File

@ -180,7 +180,7 @@ if source_date_epoch is not None:
class LocalTimeZone(tzinfo): class LocalTimeZone(tzinfo):
def __init__(self, *args: Any, **kwargs: Any) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs) # type: ignore super().__init__(*args, **kwargs)
self.tzdelta = tzdelta self.tzdelta = tzdelta
def utcoffset(self, dt: datetime) -> timedelta: def utcoffset(self, dt: datetime) -> timedelta:

View File

@ -153,7 +153,7 @@ def md5(data=b'', **kwargs):
""" """
try: try:
return hashlib.md5(data, **kwargs) # type: ignore return hashlib.md5(data, **kwargs)
except ValueError: except ValueError:
return hashlib.md5(data, **kwargs, usedforsecurity=False) # type: ignore return hashlib.md5(data, **kwargs, usedforsecurity=False) # type: ignore
@ -167,7 +167,7 @@ def sha1(data=b'', **kwargs):
""" """
try: try:
return hashlib.sha1(data, **kwargs) # type: ignore return hashlib.sha1(data, **kwargs)
except ValueError: except ValueError:
return hashlib.sha1(data, **kwargs, usedforsecurity=False) # type: ignore return hashlib.sha1(data, **kwargs, usedforsecurity=False) # type: ignore

View File

@ -355,7 +355,7 @@ def is_singledispatch_function(obj: Any) -> bool:
if (inspect.isfunction(obj) and if (inspect.isfunction(obj) and
hasattr(obj, 'dispatch') and hasattr(obj, 'dispatch') and
hasattr(obj, 'register') and hasattr(obj, 'register') and
obj.dispatch.__module__ == 'functools'): obj.dispatch.__module__ == 'functools'): # type: ignore
return True return True
else: else:
return False return False

View File

@ -118,7 +118,7 @@ class SphinxLoggerAdapter(logging.LoggerAdapter):
"""LoggerAdapter allowing ``type`` and ``subtype`` keywords.""" """LoggerAdapter allowing ``type`` and ``subtype`` keywords."""
KEYWORDS = ['type', 'subtype', 'location', 'nonl', 'color', 'once'] KEYWORDS = ['type', 'subtype', 'location', 'nonl', 'color', 'once']
def log(self, level: Union[int, str], msg: str, *args: Any, **kwargs: Any) -> None: def log(self, level: Union[int, str], msg: str, *args: Any, **kwargs: Any) -> None: # type: ignore # NOQA
if isinstance(level, int): if isinstance(level, int):
super().log(level, msg, *args, **kwargs) super().log(level, msg, *args, **kwargs)
else: else: