-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Improve AndroidTV typing #71036
Improve AndroidTV typing #71036
Conversation
Hey there @JeffLIrion, mind taking a look at this pull request as it has been labeled with an integration ( |
@@ -114,7 +129,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | |||
|
|||
state_det_rules = entry.options.get(CONF_STATE_DETECTION_RULES) | |||
aftv, error_message = await async_connect_androidtv( | |||
hass, entry.data, state_detection_rules=state_det_rules | |||
hass, dict(entry.data), state_detection_rules=state_det_rules |
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.
Why is the entry data copied?
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.
Just because the type MappingProxy
is incompatible with the input function parameter type (dict[str, Any]
).
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.
So maybe use Mapping[str, Any]
as the typing on async_connect_androidtv
for that parameter?
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.
But this method is also used by config_flow
to test the connection based on user_input
, and user_input
is dict[str, Any]
.
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.
Nevermind, type Mapping[str, Any]
is ok for both calls👍
d6fcf61
to
a3cf54d
Compare
a3cf54d
to
f2b3816
Compare
Any news on this PR? |
f2b3816
to
1d204c5
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.
Thanks, @ollo69 👍
Proposed change
Improve AndroidTV
__init__
andconfig_flow
typingType 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: