-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Fix mypy issues in zha store #74032
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
Fix mypy issues in zha store #74032
Conversation
Hey there @dmulcahey, @Adminiuga, mind taking a look at this pull request as it has been labeled with an integration ( |
if device.last_seen is None: | ||
return old |
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.
Hi @Adminiuga / @dmulcahey
I am not sure of the logic here inside async_update_device
old
cannot ever be None
so I have removed the check for if old is not None
From what I could make out, the code in gateway would be happy to return None
.
core/homeassistant/components/zha/core/gateway.py
Lines 553 to 556 in aa314a0
async def async_update_device_storage(self, *_: Any) -> None: | |
"""Update the devices in the store.""" | |
for device in self.devices.values(): | |
self.zha_storage.async_update_device(device) |
But the internal code in async_create_or_update_device
definitely expects a value to be returned.
core/homeassistant/components/zha/core/store.py
Lines 64 to 68 in aa314a0
def async_create_or_update_device(self, device: ZHADevice) -> ZhaDeviceEntry: | |
"""Create or update a ZhaDeviceEntry.""" | |
if str(device.ieee) in self.devices: | |
return self.async_update_device(device) | |
return self.async_create_device(device) |
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.
Lgtm
8800a44
to
9602741
Compare
Needs #74079 to get the CI pass |
Proposed change
Fix mypy issues in zha store
Linked to #73603
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: