Skip to content

Commit

Permalink
Make flake8 ignore settings less lax (#544)
Browse files Browse the repository at this point in the history
We can quite easiliy remove these ignores so I propose we do that.
  • Loading branch information
ggravlingen authored Aug 28, 2022
1 parent 55187e3 commit cc5e01b
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 27 deletions.
1 change: 0 additions & 1 deletion pytradfri/api/libcoap_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def _base_command(self, method: str) -> list[str]:

def _execute(self, api_command: Command[T], *, timeout: int | None = None) -> T:
"""Execute the command."""

if api_command.observe:
self._observe(api_command)
return api_command.result
Expand Down
2 changes: 0 additions & 2 deletions pytradfri/device/air_purifier_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ def set_fan_speed(self, mode: int, *, index: int = 0) -> Command[None]:

def set_controls_locked(self, locked: bool, *, index: int = 0) -> Command[None]:
"""Set physical controls locked of the air purifier."""

return self.set_value(
{ATTR_AIR_PURIFIER_CONTROLS_LOCKED: 1 if locked else 0}, index=index
)

def set_leds_off(self, leds_off: bool, *, index: int = 0) -> Command[None]:
"""Set led's off/on of the air purifier."""

return self.set_value(
{ATTR_AIR_PURIFIER_LEDS_OFF: 1 if leds_off else 0}, index=index
)
Expand Down
5 changes: 0 additions & 5 deletions pytradfri/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,11 @@ def process_result(result: TypeRaw) -> Group:
@classmethod
def add_group_member(cls, values: dict[str, Any]) -> Command[None]:
"""Add a device to a group."""

return Command("put", [ROOT_GROUPS, "add"], values)

@classmethod
def remove_group_member(cls, values: dict[str, Any]) -> Command[None]:
"""Remove a device from a group."""

return Command("put", [ROOT_GROUPS, "remove"], values)

@classmethod
Expand Down Expand Up @@ -260,7 +258,6 @@ def reboot(cls) -> Command[None]:
Returns a Command.
"""

return Command("post", [ROOT_GATEWAY, ATTR_GATEWAY_REBOOT])

@classmethod
Expand All @@ -271,7 +268,6 @@ def set_commissioning_timeout(cls, timeout: int) -> Command[None]:
switches, dimmers and motion sensors for up to timeout seconds.
Returns a Command.
"""

return Command(
"put", [ROOT_GATEWAY, ATTR_GATEWAY_INFO], {ATTR_COMMISSIONING_MODE: timeout}
)
Expand All @@ -283,7 +279,6 @@ def factory_reset(cls) -> Command[None]:
WARNING: All data in Gateway is lost (pairing, groups, etc)
Returns a Command.
"""

return Command("post", [ROOT_GATEWAY, ATTR_GATEWAY_FACTORY_DEFAULTS])


Expand Down
5 changes: 4 additions & 1 deletion pytradfri/smart_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ def raw(self) -> StartActionResponse:

def __repr__(self) -> str:
"""Return a readable name for this class."""
return f"<StartActionItem (Device: {self.id} - Dimmer: {self.dimmer} - Time: {self.transition_time})>"
return (
f"<StartActionItem (Device: {self.id} - Dimmer: {self.dimmer} - "
f"Time: {self.transition_time})>"
)


class StartActionItemController:
Expand Down
6 changes: 0 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build,setup.py
doctests = True
# To work with Black
max-line-length = 88
# E501: line too long
# W503: Line break occurred before a binary operator
# E203: Whitespace before ':'
# D202 No blank lines allowed after function docstring
# W504 line break after binary operator
# E402 import at top (for examples)
ignore =
E501,
W503,
E203,
D202,
W504,
E402,
# Ignore to secure identical run tox/pre-commit and behaviour like before installing plugins
Expand Down
11 changes: 0 additions & 11 deletions tests/test_air_purifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,76 +24,65 @@ def test_device_info_properties(device: Device) -> None:

def test_state(device: Device) -> None:
"""Test air purifier mode."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.state is True


def test_is_auto_mode(device: Device) -> None:
"""Test air purifier mode."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.is_auto_mode is True


def test_air_quality(device: Device) -> None:
"""Test air quality measured by the air purifier."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.air_quality == 5


def test_fan_speed(device: Device) -> None:
"""Test air purifier fan speed."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.fan_speed == 10


def test_controls_locked(device: Device) -> None:
"""Test air purifier controls locked."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert not air_purifier.controls_locked


def test_leds_off(device: Device) -> None:
"""Test air purifier led's off."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert not air_purifier.leds_off


def test_motor_runtime_total(device: Device) -> None:
"""Test motor's total runtime."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.motor_runtime_total == 2


def test_filter_lifetime_total(device: Device) -> None:
"""Test filter's total life time."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.filter_lifetime_total == 259200


def test_filter_status(device: Device) -> None:
"""Test filter status."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.filter_status is False


def test_filter_lifetime_remaining(device: Device) -> None:
"""Test remaining life of filter."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.filter_lifetime_remaining == 259198


def test_filter_runtime(device: Device) -> None:
"""Test filter's run time."""

air_purifier = device.air_purifier_control.air_purifiers[0]
assert air_purifier.filter_runtime == 2
1 change: 0 additions & 1 deletion tests/test_blinds.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ def test_device_info_properties(device: Device) -> None:

def test_current_position(device: Device) -> None:
"""Test blind position."""

blind = device.blind_control.blinds[0]
assert blind.current_cover_position == 50

0 comments on commit cc5e01b

Please sign in to comment.