1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Added recursive detection of functools.partial. (#20284)

This commit is contained in:
Andrew Sayre
2019-01-21 00:27:32 -06:00
committed by Paulus Schoutsen
parent 9482a6303d
commit 5c208da82e
2 changed files with 10 additions and 4 deletions

View File

@@ -259,9 +259,10 @@ class HomeAssistant:
"""
task = None
# Check for partials to properly determine if coroutine function
check_target = target
if isinstance(target, functools.partial):
check_target = target.func
while isinstance(check_target, functools.partial):
check_target = check_target.func
if asyncio.iscoroutine(check_target):
task = self.loop.create_task(target) # type: ignore