1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 08:12:22 +01:00

remove unreachable code

This commit is contained in:
J. Nick Koston
2025-06-22 21:55:23 +02:00
parent ba87a0b63c
commit a5ea0cd41f

View File

@@ -121,10 +121,7 @@ def validate_ids_and_references(config: ConfigType) -> ConfigType:
hash_dict: dict[int, str], hash_dict: dict[int, str],
item_type: str, item_type: str,
path: list[str | int], path: list[str | int],
) -> bool: ) -> None:
if not id_obj.id:
return False
hash_val: int = fnv1a_32bit_hash(id_obj.id) hash_val: int = fnv1a_32bit_hash(id_obj.id)
if hash_val in hash_dict and hash_dict[hash_val] != id_obj.id: if hash_val in hash_dict and hash_dict[hash_val] != id_obj.id:
raise cv.Invalid( raise cv.Invalid(
@@ -133,7 +130,6 @@ def validate_ids_and_references(config: ConfigType) -> ConfigType:
path=path, path=path,
) )
hash_dict[hash_val] = id_obj.id hash_dict[hash_val] = id_obj.id
return True
# Collect all areas # Collect all areas
all_areas: list[dict[str, str | core.ID]] = [] all_areas: list[dict[str, str | core.ID]] = []
@@ -146,8 +142,8 @@ def validate_ids_and_references(config: ConfigType) -> ConfigType:
area_ids: set[str] = set() area_ids: set[str] = set()
for area in all_areas: for area in all_areas:
area_id: core.ID = area[CONF_ID] area_id: core.ID = area[CONF_ID]
if check_hash_collision(area_id, area_hashes, "Area", [CONF_AREAS, area_id.id]): check_hash_collision(area_id, area_hashes, "Area", [CONF_AREAS, area_id.id])
area_ids.add(area_id.id) area_ids.add(area_id.id)
# Validate device hash collisions and area references # Validate device hash collisions and area references
device_hashes: dict[int, str] = {} device_hashes: dict[int, str] = {}