Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinHjelmare authored and lanrat committed Jun 14, 2023
1 parent fc875c5 commit 12b7913
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions homeassistant/components/keyboard_remote/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Receive signals from a keyboard and use it as a remote control."""
# pylint: disable=import-error
from __future__ import annotations

import asyncio
from contextlib import suppress
import logging
import os
from __future__ import annotations
from typing import Any

from asyncinotify import Inotify, Mask
from evdev import InputDevice, categorize, ecodes, list_devices
Expand Down Expand Up @@ -65,9 +67,9 @@

async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the keyboard_remote."""
config = config[DOMAIN]
domain_config: list[dict[str, Any]] = config[DOMAIN]

remote = KeyboardRemote(hass, config)
remote = KeyboardRemote(hass, domain_config)
remote.setup()

return True
Expand All @@ -76,7 +78,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
class KeyboardRemote:
"""Manage device connection/disconnection using inotify to asynchronously monitor."""

def __init__(self, hass: HomeAssistant, config) -> None:
def __init__(self, hass: HomeAssistant, config: list[dict[str, Any]]) -> None:
"""Create handlers and setup dictionaries to keep track of them."""
self.hass = hass
self.handlers_by_name = {}
Expand Down Expand Up @@ -231,15 +233,15 @@ def __init__(self, hass: HomeAssistant, dev_block: dict[str, Any]) -> None:

self.hass = hass

key_types = dev_block.get(TYPE)
key_types = dev_block[TYPE]

self.key_values = set()
for key_type in key_types:
self.key_values.add(KEY_VALUE[key_type])

self.emulate_key_hold = dev_block.get(EMULATE_KEY_HOLD)
self.emulate_key_hold_delay = dev_block.get(EMULATE_KEY_HOLD_DELAY)
self.emulate_key_hold_repeat = dev_block.get(EMULATE_KEY_HOLD_REPEAT)
self.emulate_key_hold = dev_block[EMULATE_KEY_HOLD]
self.emulate_key_hold_delay = dev_block[EMULATE_KEY_HOLD_DELAY]
self.emulate_key_hold_repeat = dev_block[EMULATE_KEY_HOLD_REPEAT]
self.monitor_task = None
self.dev = None

Expand Down

0 comments on commit 12b7913

Please sign in to comment.