Skip to content
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

Small changes - Accessory #117

Merged
merged 3 commits into from
May 8, 2018
Merged

Small changes - Accessory #117

merged 3 commits into from
May 8, 2018

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented May 7, 2018

Changes

  • Removed unused method accessory.create.
  • Removed iid_manager and setup_id parameter from accessory and bridge init calls.
  • Improved accessory.to_HAP()

In theory this is a breaking change. However it's not very likely many people have used those parameters to begin with since the defaults are quite fine. Therefor this shouldn't be an issue.

Some changes are extracted from #104. I didn't wanted to just propose a single new line ;)
In addition this will help keep the other PR clean.

@codecov-io
Copy link

codecov-io commented May 7, 2018

Codecov Report

Merging #117 into dev will increase coverage by 0.08%.
The diff coverage is 85.71%.

@@            Coverage Diff             @@
##              dev     #117      +/-   ##
==========================================
+ Coverage   50.86%   50.94%   +0.08%     
==========================================
  Files          14       14              
  Lines        1337     1329       -8     
  Branches      138      138              
==========================================
- Hits          680      677       -3     
+ Misses        646      641       -5     
  Partials       11       11
Impacted Files Coverage Δ
pyhap/accessory_driver.py 56.27% <100%> (ø) ⬆️
pyhap/accessory.py 51.94% <83.33%> (+0.53%) ⬆️

Copy link
Owner

@ikalchev ikalchev left a comment

Choose a reason for hiding this comment

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

All good except one comment. Are you sure the commented change adds value?

@@ -487,12 +479,7 @@ def to_HAP(self):

.. seealso:: Accessory.to_HAP
"""
hap_rep = [super().to_HAP()]
Copy link
Owner

Choose a reason for hiding this comment

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

Not sure if this is more readable or more efficient than the previous version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not 100% percent sure either. Just though about that line while I was working on the other PR and it looked pretty cool, especially since we already use list comprehensions in other places (mainly for the to_HAP methods actually).

At least it isn't worse than the before IMO, and it cuts five lines.

Copy link
Owner

Choose a reason for hiding this comment

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

It's not worse, performance-wise I think. Just readability, but it's good enough, Merging

@ikalchev ikalchev merged commit 3b5d26e into ikalchev:dev May 8, 2018
@cdce8p cdce8p deleted the small-changes branch May 8, 2018 20:54
ikalchev added a commit that referenced this pull request May 18, 2018
* Merge master back into dev (#111)

* Fix typo in log message (#112)

* Fix typo in SDS011

* Documentation improvements for version 2.0.0 (#114)

* Replace event_loop with loop (#107)

* Changelog update (#116)

* Added entry for event loop change

* Additional changes

* Small changes - Accessory (#117)

* Improved bridge.to_HAP

* Updated changelog

* Fix another typo in SDS011 which prevented pm10 from getting updates.

* Added getter_callback to Characteristic #78

* Fix typo bridge.to_HAP (#119)

* Adding Code Style Checker (#118)

* Add basis for style checker

* Fixed lint errors

* Updated changelog

* Improvements 7 - Config class (#120)

Added a State class which keeps Accessory runtime properties such as port, address, paired clients, etc. This state is stored and managed by the driver.

* Remove the pyhap.accessories package. (#115)

* Remove the pyhap.accessories package.

All accessories are temporarily moved to the root accessories folder.
These will be moved into separate repositories as appropriate.

pyhap.accessories is now an implicit namespace package. See
pyhap/accessories/README.md for how others can share their accessories
as HAP-python subpackages.

* Release v2.1.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants