-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define sync hass.create_task function #50788
Conversation
This is refactored quite a bit in #50784 Would you please remove the zeroconf changes. I'll make the switch in 50784 |
Sure, it was just a nice little demo 🙂 |
We should probably have coverage for the new function |
Assuming the CI is happy, I'll rebase #50784 and adjust it after this merges |
@raman325 Example: https://github.com/home-assistant/core/runs/2594855564 |
Please open an issue to track this. |
Done :) |
Proposed change
For
async_add_job
which expectsCallable
there's a sync counterpart:add_job
. But there's no sync counterpart forasync_create_task
which expectsCoroutine
, although it's needed sometimes.Right now
add_job
is used for that but this bypasses type safety. Here is how it's being used:Define
create_task
function which streamlines this and enables type safety.Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: