Refactor integration platforms to import in the executor (#112168)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
J. Nick Koston 2024-03-04 19:21:18 -10:00 committed by GitHub
parent a9caa3e582
commit 8b017016b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 242 additions and 60 deletions

View file

@ -1122,6 +1122,10 @@ class Integration:
raise self._missing_platforms_cache[full_name]
return None
def get_platform_cached(self, platform_name: str) -> ModuleType | None:
"""Return a platform for an integration from cache."""
return self._cache.get(f"{self.domain}.{platform_name}") # type: ignore[return-value]
def get_platform(self, platform_name: str) -> ModuleType:
"""Return a platform for an integration."""
if platform := self._get_platform_cached_or_raise(