Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Clean up core #10305

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

Merged
merged 7 commits into from
Nov 3, 2017
Merged

Clean up core #10305

merged 7 commits into from
Nov 3, 2017

Conversation

balloob
Copy link
Member

@balloob balloob commented Nov 3, 2017

Description:

  • Remove is_state_attr from hass.states. This should never have been added. It's a helper method that has not much value in core. I've made sure that it is still available for templates.
  • Don't concatenate the list of event listeners when there is no MATCH_ALL listeners defined.
  • Remove unused wait variable from hass.bus.async_fire
  • Save 1 method invocation when rendering templates
  • Remove forward update to async_update for entitys. That can produce a deadlock

Breaking change:

  • hass.states.is_state_attr has been removed
  • Unused method parameter wait has been removed of hass.bus.async_fire

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

'post_pending_state',
STATE_ALARM_ARMED_NIGHT))
state = self.hass.states.get(entity_id)
assert state.attributes['post_pending_state'] == STATE_ALARM_ARMED_NIGHT

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (80 > 79 characters)

'post_pending_state',
STATE_ALARM_ARMED_NIGHT))
state = self.hass.states.get(entity_id)
assert state.attributes['post_pending_state'] == STATE_ALARM_ARMED_NIGHT

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (80 > 79 characters)

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One question.

"""Test if a state is a specific attribute."""
state_obj = self.hass.states.get(entity_id)
return state_obj is not None and \
state_obj.attributes.get(name, None) == value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why specify None as default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I copied it from core. Fixed.

@pvizeli pvizeli merged commit 4e8e04f into dev Nov 3, 2017
@pvizeli pvizeli deleted the clean-up-core branch November 3, 2017 13:19
@balloob balloob mentioned this pull request Nov 17, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Mar 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants