Support of the unified command line interface for all devices#289
Support of the unified command line interface for all devices#289syssi merged 18 commits intorytilahti:masterfrom
Conversation
miio/powerstrip.py
Outdated
| return self.send("set_power", ["on"]) | ||
|
|
||
| @command( | ||
| default_output = format_output("Powering off"), |
There was a problem hiding this comment.
unexpected spaces around keyword / parameter equals
miio/powerstrip.py
Outdated
| defaultdict(lambda: None, zip(properties, values))) | ||
|
|
||
| @command( | ||
| default_output = format_output("Powering on"), |
There was a problem hiding this comment.
unexpected spaces around keyword / parameter equals
miio/philips_bulb.py
Outdated
| @command( | ||
| click.argument("brightness", type=int), | ||
| click.argument("cct", type=int), | ||
| default_output=format_output("Setting brightness to {brightness} and color temperature to {cct}") |
There was a problem hiding this comment.
line too long (105 > 100 characters)
| return self.send("set_angle_enable", ["off"]) | ||
|
|
||
| @command( | ||
| click.argument("brightness", type=EnumType(LedBrightness, False)), |
| return self.send("set_speed_level", [level]) # 0...100 | ||
|
|
||
| @command( | ||
| click.argument("direction", type=EnumType(MoveDirection, False)), |
miio/ceil.py
Outdated
| @command( | ||
| click.argument("brightness", type=int), | ||
| click.argument("cct", type=int), | ||
| default_output=format_output("Setting brightness to {brightness} and color temperature to {cct}") |
There was a problem hiding this comment.
line too long (105 > 100 characters)
17ac625 to
f5547d7
Compare
miio/tests/test_vacuum.py
Outdated
| from miio import Vacuum, VacuumStatus | ||
| from .dummies import DummyDevice | ||
| import datetime | ||
| from miio import Vacuum, VacuumStatus, VacuumException |
There was a problem hiding this comment.
'miio.VacuumException' imported but unused
miio/tests/test_vacuum.py
Outdated
| from miio import Vacuum, VacuumStatus | ||
| from .dummies import DummyDevice | ||
| import datetime | ||
| from miio import Vacuum, VacuumStatus, VacuumException |
There was a problem hiding this comment.
'miio.VacuumException' imported but unused
miio/wifispeaker.py
Outdated
|
|
||
| import click | ||
|
|
||
| from .click_common import command, format_output, EnumType |
There was a problem hiding this comment.
'.click_common.EnumType' imported but unused
This reverts commit 91dc4d7.
fc92fde to
c7939cd
Compare
|
I would be happy to merge this soon. Rebasing the PR takes a lot of time. |
rytilahti
left a comment
There was a problem hiding this comment.
There is quite a bit to review, but I think we can simply merge this and do clean-ups later on. I just added a couple of comments for now.
| from miio.wifirepeater import WifiRepeater | ||
| from miio.wifispeaker import WifiSpeaker | ||
| from miio.yeelight import Yeelight | ||
|
|
There was a problem hiding this comment.
I made this newline because miio.discovery cannot be moved to line 10. The position of this import is important. The newline shall help here. ;-)
There was a problem hiding this comment.
Hmm, I'm not following? Why it cannot be moved/why it is important?
There was a problem hiding this comment.
If I move the discovery import to the top the tests are failing:
_______________________________________________________________________________________ ERROR collecting miio/tests/test_airconditioningcompanion.py _________________________________________________________________________________________
ImportError while importing test module '/home/sebastian/src/python-miio/miio/tests/test_airconditioningcompanion.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
miio/__init__.py:2: in <module>
from miio.discovery import Discovery
miio/discovery.py:10: in <module>
from . import (Device, Vacuum, ChuangmiPlug, PowerStrip, AirPurifier, Ceil,
E ImportError: cannot import name 'Device'
______________________________________________________________________________________________ ERROR collecting miio/tests/test_airhumidifier.py ______________________________________________________________________________________________
ImportError while importing test module '/home/sebastian/src/python-miio/miio/tests/test_airhumidifier.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
miio/__init__.py:2: in <module>
from miio.discovery import Discovery
miio/discovery.py:10: in <module>
from . import (Device, Vacuum, ChuangmiPlug, PowerStrip, AirPurifier, Ceil,
E ImportError: cannot import name 'Device'
There was a problem hiding this comment.
Ohh, I see. I just didn't understand why the new line was necessary (as it should be just about the order, right?), but this is fine for me.
|
|
||
| @command( | ||
| default_output=format_output("Powering the air condition on"), | ||
| ) |
There was a problem hiding this comment.
When it all fits into one line (and there are no arguments), I think it'd be nice to have it all on a single line.
There was a problem hiding this comment.
Are you sure? It feels hard to read because of the braces and the little spaces.
There was a problem hiding this comment.
Well, I think it would be nicer for grepping the code, but it's not so important and can be changed later if needed.
rytilahti
left a comment
There was a problem hiding this comment.
Looks good to me, I think we can merge and adjust as needed. What also needs to be added is an updated documentation for the new style cli before releasing a new version.
|
|
||
| @command( | ||
| default_output=format_output( | ||
| "", |
There was a problem hiding this comment.
Maybe it would make sense to use a keyword argument here, otherwise it remains unclear what does "" do.
No description provided.