-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
Remove redundant device update code #134100
base: dev
Are you sure you want to change the base?
Remove redundant device update code #134100
Conversation
for attr_name, setvalue in ( | ||
("connections", merge_connections), | ||
("identifiers", merge_identifiers), | ||
): | ||
old_value = getattr(old, attr_name) | ||
# If not undefined, check if `value` contains new items. | ||
if setvalue is not UNDEFINED and not setvalue.issubset(old_value): | ||
new_values[attr_name] = old_value | setvalue | ||
old_values[attr_name] = old_value | ||
|
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.
I can see some code paths (looking within this function), where the only place (e.g.) new_values['connections']
is assigned is within the block you are removing.
Please can you help explain why not setting 'connections' in those code paths is ok?
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.
Can you be more explicit, please? Which code paths exactly do you mean?
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.
If async_update_device()
is called with merge_connections
, merge_identifiers
, new_connections
, new_identifiers
all UNDEFINED
, then new_values["connections"]
and new_values["identifiers"]
won't be assigned to anything.
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.
Which is exactly how it was before. Nothing changes in that case.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Proposed change
Remove redundant device update code.
Those values are handled in the following lines. This is an old code, that no longer serves any function.
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: