mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 16:37:52 +01:00
Fix type annotation on extract_registry_entry_config
(#3623)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
a8ff0a8913
commit
19900b004b
@ -13,7 +13,7 @@ from esphome.const import (
|
|||||||
|
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
from esphome.core import coroutine, ID, CORE
|
from esphome.core import coroutine, ID, CORE
|
||||||
from esphome.types import ConfigType
|
from esphome.types import ConfigType, ConfigFragmentType
|
||||||
from esphome.cpp_generator import add, get_variable
|
from esphome.cpp_generator import add, get_variable
|
||||||
from esphome.cpp_types import App
|
from esphome.cpp_types import App
|
||||||
from esphome.util import Registry, RegistryEntry
|
from esphome.util import Registry, RegistryEntry
|
||||||
@ -108,8 +108,9 @@ async def setup_entity(var, config):
|
|||||||
|
|
||||||
|
|
||||||
def extract_registry_entry_config(
|
def extract_registry_entry_config(
|
||||||
registry: Registry, full_config: ConfigType
|
registry: Registry,
|
||||||
) -> RegistryEntry:
|
full_config: ConfigType,
|
||||||
|
) -> tuple[RegistryEntry, ConfigFragmentType]:
|
||||||
key, config = next((k, v) for k, v in full_config.items() if k in registry)
|
key, config = next((k, v) for k, v in full_config.items() if k in registry)
|
||||||
return registry[key], config
|
return registry[key], config
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class RegistryEntry:
|
|||||||
return Schema(self.raw_schema)
|
return Schema(self.raw_schema)
|
||||||
|
|
||||||
|
|
||||||
class Registry(dict):
|
class Registry(dict[str, RegistryEntry]):
|
||||||
def __init__(self, base_schema=None, type_id_key=None):
|
def __init__(self, base_schema=None, type_id_key=None):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.base_schema = base_schema or {}
|
self.base_schema = base_schema or {}
|
||||||
|
Loading…
Reference in New Issue
Block a user