-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Cleanup ENTITY_CATEGORIES_SCHEMA #66549
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( |
Hey there @emontnemery, mind taking a look at this pull request as it has been labeled with an integration ( |
Hey there @Julius2342, @farmio, @marvin-w, mind taking a look at this pull request as it has been labeled with an integration ( |
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
Not stale |
Rebased to resolve conflicts - still waiting on upstream release |
Upstream released, now waiting on dependency bump |
with pytest.raises(vol.Invalid): | ||
with pytest.raises( | ||
vol.Invalid, | ||
match=r"expected EntityCategory or one of 'config', 'diagnostic', 'system'", |
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.
Home Assistant would previously raise
value must be one of ['config', 'diagnostic', 'system']
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.
There is a match keyword ?! that's so much easier than what I normally do.
@balloob / @emontnemery / @farmio |
homeassistant/helpers/entity.py
Outdated
@@ -214,6 +204,9 @@ class EntityCategory(StrEnum): | |||
SYSTEM = "system" | |||
|
|||
|
|||
ENTITY_CATEGORIES_SCHEMA: Final = vol.All(vol.Lower, vol.Coerce(EntityCategory)) |
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.
Should this include str
ENTITY_CATEGORIES_SCHEMA: Final = vol.All(vol.Lower, vol.Coerce(EntityCategory)) | |
ENTITY_CATEGORIES_SCHEMA: Final = vol.All(str, vol.Lower, vol.Coerce(EntityCategory)) |
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.
And should we do vol.Lower
? It is technically an incorrect value.
Oh I guess if we require str
we're going to raise a bad error message that it's supposed to be a string.
ENTITY_CATEGORIES_SCHEMA: Final = vol.All(vol.Lower, vol.Coerce(EntityCategory)) | |
ENTITY_CATEGORIES_SCHEMA: Final = vol.Coerce(EntityCategory) |
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Proposed change
Cleanup ENTITY_CATEGORIES_SCHEMA
As a follow-up to #66108, and as an alternative to #66127
Requires
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: