Skip to content

Commit

Permalink
try to fix the indent, return the full list instead of a single entry…
Browse files Browse the repository at this point in the history
… when return_list=True
  • Loading branch information
rytilahti committed Oct 17, 2018
1 parent 9efc445 commit 6b792bc
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions miio/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,30 +192,31 @@ def last_clean_details(self) -> CleaningDetails:

@command(
click.argument("id_", type=int, metavar="ID"),
click.argument("return_list", type=bool, default=True)
click.argument("return_list", type=bool, default=False)
)
def clean_details(self, id_: int, return_list=True) -> Union[
List[CleaningDetails],
Optional[CleaningDetails]]:
List[CleaningDetails],
Optional[CleaningDetails]]:
"""Return details about specific cleaning."""
details = self.send("get_clean_record", [id_])

if not details:
_LOGGER.warning("No cleaning record found for id %s" % id_)
return None

if len(details) > 1:
_LOGGER.warning("Got multiple clean details, returning the first")

res = CleaningDetails(details.pop())
if return_list:
_LOGGER.warning("This method will be returning the details "
"without wrapping them into a list in the "
"near future. The current behavior can be "
"kept by passing return_list=True and this "
"warning will be removed when the default gets "
"changed.")
return [res]
return [CleaningDetails(entry) for entry in details]

if len(details) > 1:
_LOGGER.warning("Got multiple clean details, returning the first")

res = CleaningDetails(details.pop())
return res

@command()
Expand Down

0 comments on commit 6b792bc

Please sign in to comment.