Skip to content

Commit

Permalink
Strict typing of signal repeater (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggravlingen authored Feb 26, 2022
1 parent 672a1f0 commit 8507581
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
22 changes: 22 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,25 @@ disallow_untyped_defs = true
no_implicit_optional = true
warn_return_any = true
warn_unreachable = true

[mypy-pytradfri.device.signal_repeater]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_return_any = true
warn_unreachable = true

[mypy-pytradfri.device.signal_repeater_control]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_return_any = true
warn_unreachable = true
7 changes: 5 additions & 2 deletions pytradfri/device/signal_repeater.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
"""Represent a signal repeater."""
from __future__ import annotations

from typing import Any
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from . import Device


class SignalRepeater:
"""Represent a signal repeater."""

def __init__(self, device, index):
def __init__(self, device: Device, index: int) -> None:
"""Create object of class."""
self.device = device
self.index = index
Expand Down
2 changes: 1 addition & 1 deletion pytradfri/device/signal_repeater_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def raw(self) -> list[dict[str, Any]]:
return signal_repeater_control_response

@property
def signal_repeaters(self):
def signal_repeaters(self) -> list[SignalRepeater]:
"""Return signal repeater objects of the signal repeater control."""
return [SignalRepeater(self._device, i) for i in range(len(self.raw))]

0 comments on commit 8507581

Please sign in to comment.