Skip to content

Commit

Permalink
Try to fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
h4de5 committed Jun 18, 2023
1 parent 248b19d commit deeecd2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
6 changes: 5 additions & 1 deletion custom_components/toshiba_ac/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ def __init__(self, toshiba_device: ToshibaAcDevice) -> None:
@property
def available(self) -> bool:
"""Return True if entity is available."""
return bool(self._device.ac_id and self._device.amqp_api.sas_token and self._device.http_api.access_token)
return bool(
self._device.ac_id
and self._device.amqp_api.sas_token
and self._device.http_api.access_token
)


class ToshibaAcStateEntity(ToshibaAcEntity):
Expand Down
4 changes: 3 additions & 1 deletion custom_components/toshiba_ac/entity_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class ToshibaAcEnumEntityDescriptionMixin(Generic[TEnum]):
ac_attr_name: str
ac_attr_setter: str

async def async_set_attr(self, device: ToshibaAcDevice, value: TEnum | None) -> None:
async def async_set_attr(
self, device: ToshibaAcDevice, value: TEnum | None
) -> None:
"""Set the provided option enum value."""
if not self.ac_attr_setter and not self.ac_attr_name:
return
Expand Down
8 changes: 6 additions & 2 deletions custom_components/toshiba_ac/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ class ToshibaAcSelectEntity(ToshibaAcStateEntity, SelectEntity):
entity_description: ToshibaAcSelectDescription
_attr_has_entity_name = True

def __init__(self, device: ToshibaAcDevice, entity_description: ToshibaAcSelectDescription):
def __init__(
self, device: ToshibaAcDevice, entity_description: ToshibaAcSelectDescription
):
"""Initialize the ToshibaAcSelectEntity."""
super().__init__(device)
self._attr_unique_id = f"{device.ac_unique_id}_{entity_description.key}"
Expand All @@ -177,7 +179,9 @@ def update_attrs(self):
"""Update the entity's attributes."""
features = self._device.supported.for_ac_mode(self._device.ac_mode)
self._attr_options = self.entity_description.get_option_names(features)
self._attr_current_option = self.entity_description.current_option_name(self._device)
self._attr_current_option = self.entity_description.current_option_name(
self._device
)

@property
def available(self) -> bool:
Expand Down
8 changes: 6 additions & 2 deletions custom_components/toshiba_ac/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ class ToshibaAcSwitchEntity(ToshibaAcStateEntity, SwitchEntity):
entity_description: ToshibaAcSwitchDescription
_attr_has_entity_name = True

def __init__(self, device: ToshibaAcDevice, entity_description: ToshibaAcSwitchDescription):
def __init__(
self, device: ToshibaAcDevice, entity_description: ToshibaAcSwitchDescription
):
"""Initialize the switch."""
super().__init__(device)

Expand All @@ -162,7 +164,9 @@ def available(self):
return (
super().available
and self._device.ac_status == ToshibaAcStatus.ON
and self.entity_description.is_supported(self._device.supported.for_ac_mode(self._device.ac_mode))
and self.entity_description.is_supported(
self._device.supported.for_ac_mode(self._device.ac_mode)
)
)

@property
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[tool.black]
line-length = 120
target-version = ["py39", "py310"]
exclude = 'generated'

Expand Down

0 comments on commit deeecd2

Please sign in to comment.