Upgrade mypy to 0.710 (#24666)

* Upgrade mypy to 0.710

* Address mypy 0.710 errors
This commit is contained in:
Ville Skyttä 2019-06-22 10:19:36 +03:00 committed by GitHub
parent f189367c02
commit a6eef22fbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 14 deletions

View File

@ -547,7 +547,7 @@ class AuthStore:
def _set_defaults(self) -> None:
"""Set default values for auth store."""
self._users = OrderedDict() # type: Dict[str, models.User]
self._users = OrderedDict()
groups = OrderedDict() # type: Dict[str, models.Group]
admin_group = _system_admin_group()

View File

@ -257,7 +257,8 @@ class ConfigEntry:
self.title, self.domain)
return False
# Handler may be a partial
while isinstance(handler, functools.partial):
# type ignore: https://github.com/python/typeshed/pull/3077
while isinstance(handler, functools.partial): # type: ignore
handler = handler.func
if self.version == handler.VERSION:

View File

@ -270,8 +270,9 @@ class HomeAssistant:
# Check for partials to properly determine if coroutine function
check_target = target
while isinstance(check_target, functools.partial):
check_target = check_target.func
# type ignores: https://github.com/python/typeshed/pull/3077
while isinstance(check_target, functools.partial): # type: ignore
check_target = check_target.func # type: ignore
if asyncio.iscoroutine(check_target):
task = self.loop.create_task(target) # type: ignore
@ -946,8 +947,9 @@ class Service:
self.func = func
self.schema = schema
# Properly detect wrapped functions
while isinstance(func, functools.partial):
func = func.func
# type ignores: https://github.com/python/typeshed/pull/3077
while isinstance(func, functools.partial): # type: ignore
func = func.func # type: ignore
self.is_callback = is_callback(func)
self.is_coroutinefunction = asyncio.iscoroutinefunction(func)

View File

@ -57,7 +57,7 @@ def run(args: List) -> int:
print('Aborting script, could not install dependency', req)
return 1
return script.run(args[1:]) # type: ignore
return script.run(args[1:])
def extract_config_dir(args=None) -> str:

View File

@ -9,7 +9,7 @@ from asyncio.futures import Future
import asyncio
from asyncio import ensure_future
from typing import Any, Union, Coroutine, Callable, Generator, TypeVar, \
Awaitable
Awaitable, Optional
_LOGGER = logging.getLogger(__name__)
@ -92,11 +92,11 @@ def _chain_future(
raise TypeError('A future is required for destination argument')
# pylint: disable=protected-access
if isinstance(source, Future):
source_loop = source._loop # type: ignore
source_loop = source._loop # type: Optional[AbstractEventLoop]
else:
source_loop = None
if isinstance(destination, Future):
dest_loop = destination._loop # type: ignore
dest_loop = destination._loop # type: Optional[AbstractEventLoop]
else:
dest_loop = None

View File

@ -141,8 +141,9 @@ def catch_log_exception(
# Check for partials to properly determine if coroutine function
check_func = func
while isinstance(check_func, partial):
check_func = check_func.func
# type ignores: https://github.com/python/typeshed/pull/3077
while isinstance(check_func, partial): # type: ignore
check_func = check_func.func # type: ignore
wrapper_func = None
if asyncio.iscoroutinefunction(check_func):

View File

@ -7,7 +7,7 @@ coveralls==1.2.0
flake8-docstrings==1.3.0
flake8==3.7.7
mock-open==1.3.1
mypy==0.701
mypy==0.710
pydocstyle==3.0.0
pylint==2.3.1
pytest-aiohttp==0.3.0

View File

@ -8,7 +8,7 @@ coveralls==1.2.0
flake8-docstrings==1.3.0
flake8==3.7.7
mock-open==1.3.1
mypy==0.701
mypy==0.710
pydocstyle==3.0.0
pylint==2.3.1
pytest-aiohttp==0.3.0