-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored main branch #3
Conversation
fefb839
to
2be0efb
Compare
attributes = { | ||
return { |
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.
Function HomeLINKProperty.extra_state_attributes
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
self._parent_key in coordinator.data[COORD_PROPERTIES] | ||
and self._key | ||
in coordinator.data[COORD_PROPERTIES][self._parent_key][COORD_DEVICES] | ||
self._parent_key not in coordinator.data[COORD_PROPERTIES] | ||
or self._key | ||
not in coordinator.data[COORD_PROPERTIES][self._parent_key][ | ||
COORD_DEVICES | ||
] | ||
): | ||
for reading in coordinator.data[COORD_PROPERTIES][self._parent_key][ | ||
COORD_READINGS | ||
]: | ||
if reading.type != self._readingtype: | ||
return | ||
for reading in coordinator.data[COORD_PROPERTIES][self._parent_key][ | ||
COORD_READINGS | ||
]: | ||
if reading.type != self._readingtype: | ||
continue | ||
for device in reading.devices: | ||
if device.serialnumber != self._key: | ||
continue | ||
for device in reading.devices: | ||
if device.serialnumber != self._key: | ||
continue | ||
self._state = device.values[len(device.values) - 1].value | ||
self._readingdate = device.values[ | ||
len(device.values) - 1 | ||
].readingdate | ||
break | ||
self._state = device.values[len(device.values) - 1].value | ||
self._readingdate = device.values[ | ||
len(device.values) - 1 | ||
].readingdate | ||
break |
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.
Function HomeLINKReadingSensor._initial_attributes
refactored with the following changes:
- Add guard clause (
last-if-guard
)
attributes = read_state(self.hass, self.device_class, self._key) | ||
if attributes: | ||
if attributes := read_state(self.hass, self.device_class, self._key): |
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.
Function HomeLINKReadingSensor.async_added_to_hass
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
if not device_id: | ||
pass |
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.
Function build_device_identifiers
refactored with the following changes:
- Remove redundant conditional (
remove-redundant-if
)
Branch
main
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
main
branch, then run:Help us improve this pull request!