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

Skip to content

Conversation

@cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Feb 23, 2018

For Accessory, Service and Characteristic
Added python venv suff to .gitignore.

* Accessory
* Service
* Characteristic
* Added python venv suff to gitignore
@codecov-io
Copy link

codecov-io commented Feb 23, 2018

Codecov Report

Merging #56 into master will decrease coverage by 0.2%.
The diff coverage is 23.07%.

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
- Coverage   43.06%   42.85%   -0.21%     
==========================================
  Files          12       12              
  Lines        1226     1239      +13     
  Branches      117      120       +3     
==========================================
+ Hits          528      531       +3     
- Misses        685      695      +10     
  Partials       13       13
Impacted Files Coverage Δ
pyhap/service.py 60.6% <12.5%> (-15.4%) ⬇️
pyhap/accessory.py 57.34% <33.33%> (-0.35%) ⬇️
pyhap/characteristic.py 80.89% <50%> (-0.72%) ⬇️

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.

Good to go, but there is one issue (others are nits)

def __repr__(self):
"""Return the representation of the accessory."""
services = [s.display_name for s in self.services]
return "<accessory display_name='{}' services={}>" \
Copy link
Owner

Choose a reason for hiding this comment

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

Consistency using ticks around properties. Also I would write a capital A (for Accessories)

def __repr__(self):
"""Return the representation of the characteristic."""
return "<characteristic display_name='{}' value={} properties={}>" \
.format(self.display_name, self.display_name, self.properties)
Copy link
Owner

Choose a reason for hiding this comment

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

The second item should be self.value. Again the ticks (I get that you want to handle spaces in the display name, but maybe they could also prop in the value or properties)

@cdce8p
Copy link
Contributor Author

cdce8p commented Feb 24, 2018

I figure since services is a list and properties a dict there is no need for ' '. For value it depends since those could be int and bool as well. Adding ' ' would lead to the assumption that all are string values.

What would you think about acc for accessory, char for characteristic and serv for service?

@ikalchev
Copy link
Owner

Okay, let's leave the ticks as it is. For the names - I would either keep them the same or use a capital. I think it is more intuitive to expect to see the class name of some sort in the repr.

@cdce8p
Copy link
Contributor Author

cdce8p commented Feb 24, 2018

Wouldn't matter to me. What do you like more?

@ikalchev
Copy link
Owner

Honestly, capitals (Accessory, etc.). But I don't mind the way they are now, so whatever.

@cdce8p
Copy link
Contributor Author

cdce8p commented Feb 24, 2018

I personally would use the representation for debugging, so it wouldn't matter either 😄

I changed self.display_state -> self.value.

@ikalchev ikalchev merged commit 71757b4 into ikalchev:master Feb 24, 2018
@cdce8p cdce8p deleted the representations branch February 24, 2018 16:20
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