Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 5, 2024
1 parent 1407cfa commit a755f24
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions apps/controllerx/controllerx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://github.com/xaviml/controllerx
"""

from cx_core import (
Controller,
CoverController,
Expand Down
16 changes: 6 additions & 10 deletions apps/controllerx/cx_core/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async def init(self) -> None:
custom=self.args.get("action_delta"),
default=DEFAULT_ACTION_DELTA,
)
self.action_times = defaultdict(lambda: 0.0)
self.action_times = defaultdict(float)

# Previous state
self.previous_states = self.get_mapping_per_action(
Expand All @@ -168,7 +168,7 @@ async def init(self) -> None:
self.multiple_click_delay = self.args.get(
"multiple_click_delay", DEFAULT_MULTIPLE_CLICK_DELAY
)
self.multiple_click_action_times = defaultdict(lambda: 0.0)
self.multiple_click_action_times = defaultdict(float)
self.click_counter = Counter()
self.multiple_click_action_delay_tasks = defaultdict(lambda: None)

Expand Down Expand Up @@ -237,12 +237,10 @@ def get_default_actions_mapping(
return actions_mapping

@overload
def get_list(self, entities: List[T]) -> List[T]:
...
def get_list(self, entities: List[T]) -> List[T]: ...

@overload
def get_list(self, entities: T) -> List[T]:
...
def get_list(self, entities: T) -> List[T]: ...

def get_list(self, entities: Union[List[T], T]) -> List[T]:
if isinstance(entities, (list, tuple)):
Expand All @@ -256,8 +254,7 @@ def get_mapping_per_action(
*,
custom: Optional[Union[T, Dict[ActionEvent, T]]],
default: None,
) -> Dict[ActionEvent, Optional[T]]:
...
) -> Dict[ActionEvent, Optional[T]]: ...

@overload
def get_mapping_per_action(
Expand All @@ -266,8 +263,7 @@ def get_mapping_per_action(
*,
custom: Optional[Union[T, Dict[ActionEvent, T]]],
default: T,
) -> Dict[ActionEvent, T]:
...
) -> Dict[ActionEvent, T]: ...

def get_mapping_per_action(
self,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/cx_core/controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ async def test_handle_action(
fake_action_type: ActionType,
) -> None:
sut.action_delta = {action_called: action_delta}
sut.action_times = defaultdict(lambda: 0)
sut.action_times = defaultdict(int)

sut.actions_mapping = {action: [fake_action_type] for action in actions_input}
sut.previous_states = defaultdict(lambda: None)
Expand Down

0 comments on commit a755f24

Please sign in to comment.