diff --git a/esphome/components/socket/__init__.py b/esphome/components/socket/__init__.py index dcbab9d240..e085a09eac 100644 --- a/esphome/components/socket/__init__.py +++ b/esphome/components/socket/__init__.py @@ -45,9 +45,6 @@ async def to_code(config): def FILTER_SOURCE_FILES() -> list[str]: """Return list of socket implementation files that aren't selected by the user.""" - if not hasattr(CORE, "config") or "socket" not in CORE.config: - return [] - impl = CORE.config["socket"][CONF_IMPLEMENTATION] # Build list of files to exclude based on selected implementation diff --git a/esphome/helpers.py b/esphome/helpers.py index 153dcf6a6a..a99a317239 100644 --- a/esphome/helpers.py +++ b/esphome/helpers.py @@ -553,11 +553,10 @@ def filter_source_files_from_platform( return [] # Return files that should be excluded for current platform - excluded = [] - for filename, platforms in files_map.items(): - if current_platform_framework not in platforms: - excluded.append(filename) - - return excluded + return [ + filename + for filename, platforms in files_map.items() + if current_platform_framework not in platforms + ] return filter_source_files