Skip to content

Commit

Permalink
Update mypy to a custom version (#111258)
Browse files Browse the repository at this point in the history
* Update mypy to a custom version

* Fix call_soon_threadsafe typing

Result from a recent typeshed change -> better asyncio callback typing with Ts
  • Loading branch information
cdce8p committed Mar 1, 2024
1 parent 841d4e3 commit f0be33f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions homeassistant/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ def add_job(
"""
if target is None:
raise ValueError("Don't call add_job with None")
if asyncio.iscoroutine(target):
self.loop.call_soon_threadsafe(self.async_add_job, target)
return
if TYPE_CHECKING:
target = cast(Callable[..., Any], target)
self.loop.call_soon_threadsafe(self.async_add_job, target, *args)

@overload
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ astroid==3.1.0
coverage==7.4.3
freezegun==1.4.0
mock-open==1.4.0
mypy==1.8.0
mypy-dev==1.9.0b1
pre-commit==3.6.2
pydantic==1.10.12
pylint==3.1.0
Expand Down

0 comments on commit f0be33f

Please sign in to comment.