mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-29 22:24:26 +00:00 
			
		
		
		
	[core] Add some types to loader.py (#10967)
				
					
				
			Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
		| @@ -192,7 +192,7 @@ def install_custom_components_meta_finder(): | ||||
|     install_meta_finder(custom_components_dir) | ||||
|  | ||||
|  | ||||
| def _lookup_module(domain, exception): | ||||
| def _lookup_module(domain: str, exception: bool) -> ComponentManifest | None: | ||||
|     if domain in _COMPONENT_CACHE: | ||||
|         return _COMPONENT_CACHE[domain] | ||||
|  | ||||
| @@ -219,16 +219,16 @@ def _lookup_module(domain, exception): | ||||
|     return manif | ||||
|  | ||||
|  | ||||
| def get_component(domain, exception=False): | ||||
| def get_component(domain: str, exception: bool = False) -> ComponentManifest | None: | ||||
|     assert "." not in domain | ||||
|     return _lookup_module(domain, exception) | ||||
|  | ||||
|  | ||||
| def get_platform(domain, platform): | ||||
| def get_platform(domain: str, platform: str) -> ComponentManifest | None: | ||||
|     full = f"{platform}.{domain}" | ||||
|     return _lookup_module(full, False) | ||||
|  | ||||
|  | ||||
| _COMPONENT_CACHE = {} | ||||
| _COMPONENT_CACHE: dict[str, ComponentManifest] = {} | ||||
| CORE_COMPONENTS_PATH = (Path(__file__).parent / "components").resolve() | ||||
| _COMPONENT_CACHE["esphome"] = ComponentManifest(esphome.core.config) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user