-
-
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
Return attribute dict directly without temporary variable v2 #41271
Return attribute dict directly without temporary variable v2 #41271
Conversation
@@ -253,17 +253,13 @@ def device_state_attributes(self): | |||
currservice_begin: is in the format '21:00'. | |||
currservice_end: is in the format '21:00'. | |||
""" | |||
attributes = {} | |||
if not self.e2_box.in_standby: |
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 know it's not for this PR, but the code would look more beautiful if we turn it around: if standby: return {}
, giving more line length for the actual code.
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.
That is a great idea, changed in ecbd821
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.
This ofc is not just in this case, but in many of these cases in this PR. Anyway, not really for this PR, feel free to merge without.
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.
Oh gotcha. Will open a separate PR to clean up these cases.
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.
🎉
Breaking change
Proposed change
Just some quick clean up to remove using unnecessary attribute dictionary and then immediately returning them.
Continuation of #41206
Type of change
Example entry for
configuration.yaml
: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: