-
-
Notifications
You must be signed in to change notification settings - Fork 35k
Drop hass argument from verify_domain_control #147946
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
base: dev
Are you sure you want to change the base?
Conversation
2a1c639
to
01a7754
Compare
52ce757
to
b01cc38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR deprecates the hass
argument for verify_domain_control
, introduces a new deprecated_hass_binding
decorator to warn when hass
is passed, updates service helper code to use the new signature, and adds tests for the new decorator and deprecation warning.
- Replace
bind_hass
onverify_domain_control
with@deprecated_hass_binding(breaks_in_ha_version="2026.2")
. - Update all component/service callsites to drop the explicit
hass
argument when decorating withverify_domain_control
. - Add
deprecated_hass_binding
implementation and tests intests/helpers/test_service.py
andtests/helpers/test_deprecation.py
.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/helpers/test_service.py | Parametrized existing tests to assert deprecation warning appears only when hass is used. |
tests/helpers/test_deprecation.py | Added test_deprecated_hass_binding to verify the new decorator strips hass and logs. |
homeassistant/helpers/service.py | Swapped @bind_hass for @deprecated_hass_binding and removed hass param from signature. |
homeassistant/helpers/deprecation.py | Introduced deprecated_hass_binding decorator. |
homeassistant/components/*/… | Updated all verify_domain_control(hass, DOMAIN) usages to verify_domain_control(DOMAIN) . |
Comments suppressed due to low confidence (1)
homeassistant/helpers/deprecation.py:141
- The function definition uses invalid bracketed syntax (
[**_P, _T]
) which is a syntax error in Python. You should use standard parentheses for the signature (e.g.,def deprecated_hass_binding(*, breaks_in_ha_version: str | None = None) -> Callable[..., ...]:
) and declare type variables in annotations rather than in the def header.
def deprecated_hass_binding[**_P, _T](
d7fc282
to
4c3d1c3
Compare
Breaking change
For developpers only: passing
hass
argument toverify_domain_control
is deprecated. Please remove the argument.Proposed change
Spotted whilst reviewing #146050, this is an alternative to #146057
There should be no need to pass
hass
toverify_domain_control
, as that is now part of theServiceCall
object.Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: