-
Notifications
You must be signed in to change notification settings - Fork 123
Added object representations #56
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
Conversation
* Accessory * Service * Characteristic * Added python venv suff to gitignore
Codecov Report
@@ 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
|
ikalchev
left a comment
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.
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={}>" \ |
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.
Consistency using ticks around properties. Also I would write a capital A (for Accessories)
pyhap/characteristic.py
Outdated
| def __repr__(self): | ||
| """Return the representation of the characteristic.""" | ||
| return "<characteristic display_name='{}' value={} properties={}>" \ | ||
| .format(self.display_name, self.display_name, self.properties) |
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.
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)
|
I figure since services is a list and properties a dict there is no need for What would you think about |
|
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. |
|
Wouldn't matter to me. What do you like more? |
|
Honestly, capitals ( |
|
I personally would use the representation for debugging, so it wouldn't matter either 😄 I changed |
For
Accessory,ServiceandCharacteristicAdded python venv suff to
.gitignore.