MCPcopy Create free account
hub / github.com/FastLED/FastLED / _resolve_inheritance

Method _resolve_inheritance

ci/compiler/platformio_ini.py:1274–1306  ·  view source on GitHub ↗

Resolve inheritance for an environment section.

(
        self,
        env_section: EnvironmentSection,
        all_environments: dict[str, EnvironmentSection],
        global_env: Optional[GlobalEnvSection],
    )

Source from the content-addressed store, hash-verified

1272 )
1273
1274 def _resolve_inheritance(
1275 self,
1276 env_section: EnvironmentSection,
1277 all_environments: dict[str, EnvironmentSection],
1278 global_env: Optional[GlobalEnvSection],
1279 ) -> EnvironmentSection:
1280 """
1281 Resolve inheritance for an environment section.
1282 """
1283 if not env_section.extends:
1284 # Apply global environment settings if no inheritance
1285 return self._apply_global_env(env_section, global_env)
1286
1287 # Parse extends value (remove "env:" prefix if present)
1288 base_env_name = env_section.extends
1289 if base_env_name.startswith("env:"):
1290 base_env_name = base_env_name[4:]
1291
1292 # Get the base environment
1293 if base_env_name not in all_environments:
1294 logger.warning(
1295 f"Environment '{env_section.name}' extends non-existent environment '{base_env_name}'"
1296 )
1297 return self._apply_global_env(env_section, global_env)
1298
1299 # Recursively resolve base environment inheritance
1300 base_env = self._resolve_inheritance(
1301 all_environments[base_env_name], all_environments, global_env
1302 )
1303
1304 # Merge base and child environments
1305 merged = _merge_env_sections(base_env, env_section)
1306 return merged
1307
1308 def _apply_global_env(
1309 self, env_section: EnvironmentSection, global_env: Optional[GlobalEnvSection]

Callers 1

_parse_configMethod · 0.95

Calls 3

_apply_global_envMethod · 0.95
_merge_env_sectionsFunction · 0.85
warningMethod · 0.80

Tested by

no test coverage detected