Remove old type casting in esphome (#75475)

This commit is contained in:
Marc Mueller 2022-07-20 02:50:37 +02:00 committed by GitHub
parent c29bd48373
commit 672883e19d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -562,13 +562,11 @@ async def platform_async_setup_entry(
"""Update entities of this platform when entities are listed."""
old_infos = entry_data.info[component_key]
new_infos: dict[int, EntityInfo] = {}
add_entities = []
add_entities: list[_EntityT] = []
for info in infos:
if not isinstance(info, info_type):
# Filter out infos that don't belong to this platform.
continue
# cast back to upper type, otherwise mypy gets confused
info = cast(EntityInfo, info)
if info.key in old_infos:
# Update existing entity