Additional strict typing for recorder (#68860)

This commit is contained in:
J. Nick Koston 2022-03-30 06:20:44 -10:00 committed by GitHub
parent fa33ac73f3
commit d75f577b88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 39 deletions

View file

@ -10,7 +10,9 @@ import weakref
from homeassistant.util.executor import InterruptibleThreadPoolExecutor
def _worker_with_shutdown_hook(shutdown_hook, *args, **kwargs):
def _worker_with_shutdown_hook(
shutdown_hook: Callable[[], None], *args: Any, **kwargs: Any
) -> None:
"""Create a worker that calls a function after its finished."""
_worker(*args, **kwargs)
shutdown_hook()
@ -37,7 +39,7 @@ class DBInterruptibleThreadPoolExecutor(InterruptibleThreadPoolExecutor):
# When the executor gets lost, the weakref callback will wake up
# the worker threads.
def weakref_cb(_, q=self._work_queue): # pylint: disable=invalid-name
def weakref_cb(_: Any, q=self._work_queue) -> None: # type: ignore[no-untyped-def] # pylint: disable=invalid-name
q.put(None)
num_threads = len(self._threads)