mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
Upgrade mypy to 0.710 (#24666)
* Upgrade mypy to 0.710 * Address mypy 0.710 errors
This commit is contained in:
parent
f189367c02
commit
a6eef22fbc
@ -547,7 +547,7 @@ class AuthStore:
|
|||||||
|
|
||||||
def _set_defaults(self) -> None:
|
def _set_defaults(self) -> None:
|
||||||
"""Set default values for auth store."""
|
"""Set default values for auth store."""
|
||||||
self._users = OrderedDict() # type: Dict[str, models.User]
|
self._users = OrderedDict()
|
||||||
|
|
||||||
groups = OrderedDict() # type: Dict[str, models.Group]
|
groups = OrderedDict() # type: Dict[str, models.Group]
|
||||||
admin_group = _system_admin_group()
|
admin_group = _system_admin_group()
|
||||||
|
@ -257,7 +257,8 @@ class ConfigEntry:
|
|||||||
self.title, self.domain)
|
self.title, self.domain)
|
||||||
return False
|
return False
|
||||||
# Handler may be a partial
|
# 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
|
handler = handler.func
|
||||||
|
|
||||||
if self.version == handler.VERSION:
|
if self.version == handler.VERSION:
|
||||||
|
@ -270,8 +270,9 @@ class HomeAssistant:
|
|||||||
|
|
||||||
# Check for partials to properly determine if coroutine function
|
# Check for partials to properly determine if coroutine function
|
||||||
check_target = target
|
check_target = target
|
||||||
while isinstance(check_target, functools.partial):
|
# type ignores: https://github.com/python/typeshed/pull/3077
|
||||||
check_target = check_target.func
|
while isinstance(check_target, functools.partial): # type: ignore
|
||||||
|
check_target = check_target.func # type: ignore
|
||||||
|
|
||||||
if asyncio.iscoroutine(check_target):
|
if asyncio.iscoroutine(check_target):
|
||||||
task = self.loop.create_task(target) # type: ignore
|
task = self.loop.create_task(target) # type: ignore
|
||||||
@ -946,8 +947,9 @@ class Service:
|
|||||||
self.func = func
|
self.func = func
|
||||||
self.schema = schema
|
self.schema = schema
|
||||||
# Properly detect wrapped functions
|
# Properly detect wrapped functions
|
||||||
while isinstance(func, functools.partial):
|
# type ignores: https://github.com/python/typeshed/pull/3077
|
||||||
func = func.func
|
while isinstance(func, functools.partial): # type: ignore
|
||||||
|
func = func.func # type: ignore
|
||||||
self.is_callback = is_callback(func)
|
self.is_callback = is_callback(func)
|
||||||
self.is_coroutinefunction = asyncio.iscoroutinefunction(func)
|
self.is_coroutinefunction = asyncio.iscoroutinefunction(func)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ def run(args: List) -> int:
|
|||||||
print('Aborting script, could not install dependency', req)
|
print('Aborting script, could not install dependency', req)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
return script.run(args[1:]) # type: ignore
|
return script.run(args[1:])
|
||||||
|
|
||||||
|
|
||||||
def extract_config_dir(args=None) -> str:
|
def extract_config_dir(args=None) -> str:
|
||||||
|
@ -9,7 +9,7 @@ from asyncio.futures import Future
|
|||||||
import asyncio
|
import asyncio
|
||||||
from asyncio import ensure_future
|
from asyncio import ensure_future
|
||||||
from typing import Any, Union, Coroutine, Callable, Generator, TypeVar, \
|
from typing import Any, Union, Coroutine, Callable, Generator, TypeVar, \
|
||||||
Awaitable
|
Awaitable, Optional
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -92,11 +92,11 @@ def _chain_future(
|
|||||||
raise TypeError('A future is required for destination argument')
|
raise TypeError('A future is required for destination argument')
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
if isinstance(source, Future):
|
if isinstance(source, Future):
|
||||||
source_loop = source._loop # type: ignore
|
source_loop = source._loop # type: Optional[AbstractEventLoop]
|
||||||
else:
|
else:
|
||||||
source_loop = None
|
source_loop = None
|
||||||
if isinstance(destination, Future):
|
if isinstance(destination, Future):
|
||||||
dest_loop = destination._loop # type: ignore
|
dest_loop = destination._loop # type: Optional[AbstractEventLoop]
|
||||||
else:
|
else:
|
||||||
dest_loop = None
|
dest_loop = None
|
||||||
|
|
||||||
|
@ -141,8 +141,9 @@ def catch_log_exception(
|
|||||||
|
|
||||||
# Check for partials to properly determine if coroutine function
|
# Check for partials to properly determine if coroutine function
|
||||||
check_func = func
|
check_func = func
|
||||||
while isinstance(check_func, partial):
|
# type ignores: https://github.com/python/typeshed/pull/3077
|
||||||
check_func = check_func.func
|
while isinstance(check_func, partial): # type: ignore
|
||||||
|
check_func = check_func.func # type: ignore
|
||||||
|
|
||||||
wrapper_func = None
|
wrapper_func = None
|
||||||
if asyncio.iscoroutinefunction(check_func):
|
if asyncio.iscoroutinefunction(check_func):
|
||||||
|
@ -7,7 +7,7 @@ coveralls==1.2.0
|
|||||||
flake8-docstrings==1.3.0
|
flake8-docstrings==1.3.0
|
||||||
flake8==3.7.7
|
flake8==3.7.7
|
||||||
mock-open==1.3.1
|
mock-open==1.3.1
|
||||||
mypy==0.701
|
mypy==0.710
|
||||||
pydocstyle==3.0.0
|
pydocstyle==3.0.0
|
||||||
pylint==2.3.1
|
pylint==2.3.1
|
||||||
pytest-aiohttp==0.3.0
|
pytest-aiohttp==0.3.0
|
||||||
|
@ -8,7 +8,7 @@ coveralls==1.2.0
|
|||||||
flake8-docstrings==1.3.0
|
flake8-docstrings==1.3.0
|
||||||
flake8==3.7.7
|
flake8==3.7.7
|
||||||
mock-open==1.3.1
|
mock-open==1.3.1
|
||||||
mypy==0.701
|
mypy==0.710
|
||||||
pydocstyle==3.0.0
|
pydocstyle==3.0.0
|
||||||
pylint==2.3.1
|
pylint==2.3.1
|
||||||
pytest-aiohttp==0.3.0
|
pytest-aiohttp==0.3.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user