Skip to content

Commit

Permalink
Upgrade mypy to 0.711, drop no longer needed workarounds (#24998)
Browse files Browse the repository at this point in the history
  • Loading branch information
scop authored and MartinHjelmare committed Jul 7, 2019
1 parent b274b10 commit e8a5306
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
3 changes: 1 addition & 2 deletions homeassistant/config_entries.py
Expand Up @@ -257,8 +257,7 @@ async def async_migrate(self, hass: HomeAssistant) -> bool:
self.title, self.domain)
return False
# Handler may be a partial
# type ignore: https://github.com/python/typeshed/pull/3077
while isinstance(handler, functools.partial): # type: ignore
while isinstance(handler, functools.partial):
handler = handler.func

if self.version == handler.VERSION:
Expand Down
10 changes: 4 additions & 6 deletions homeassistant/core.py
Expand Up @@ -270,9 +270,8 @@ def async_add_job(

# Check for partials to properly determine if coroutine function
check_target = target
# type ignores: https://github.com/python/typeshed/pull/3077
while isinstance(check_target, functools.partial): # type: ignore
check_target = check_target.func # type: ignore
while isinstance(check_target, functools.partial):
check_target = check_target.func

if asyncio.iscoroutine(check_target):
task = self.loop.create_task(target) # type: ignore
Expand Down Expand Up @@ -947,9 +946,8 @@ def __init__(self, func: Callable, schema: Optional[vol.Schema],
self.func = func
self.schema = schema
# Properly detect wrapped functions
# type ignores: https://github.com/python/typeshed/pull/3077
while isinstance(func, functools.partial): # type: ignore
func = func.func # type: ignore
while isinstance(func, functools.partial):
func = func.func
self.is_callback = is_callback(func)
self.is_coroutinefunction = asyncio.iscoroutinefunction(func)

Expand Down
5 changes: 2 additions & 3 deletions homeassistant/util/logging.py
Expand Up @@ -141,9 +141,8 @@ def log_exception(*args: Any) -> None:

# Check for partials to properly determine if coroutine function
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
while isinstance(check_func, partial):
check_func = check_func.func

wrapper_func = None
if asyncio.iscoroutinefunction(check_func):
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Expand Up @@ -7,7 +7,7 @@ coveralls==1.2.0
flake8-docstrings==1.3.0
flake8==3.7.7
mock-open==1.3.1
mypy==0.710
mypy==0.711
pydocstyle==3.0.0
pylint==2.3.1
pytest-aiohttp==0.3.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Expand Up @@ -8,7 +8,7 @@ coveralls==1.2.0
flake8-docstrings==1.3.0
flake8==3.7.7
mock-open==1.3.1
mypy==0.710
mypy==0.711
pydocstyle==3.0.0
pylint==2.3.1
pytest-aiohttp==0.3.0
Expand Down

0 comments on commit e8a5306

Please sign in to comment.