[core] Eliminate nuisance messages from build_codeowners (#7185)

This commit is contained in:
Clyde Stubbs 2024-08-05 12:04:06 +10:00 committed by GitHub
parent 61c6581123
commit 81ac9391d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,3 +1,4 @@
from contextlib import AbstractContextManager
from dataclasses import dataclass
import importlib
import importlib.abc
@ -7,7 +8,7 @@ import logging
from pathlib import Path
import sys
from types import ModuleType
from typing import Any, Callable, ContextManager, Optional
from typing import Any, Callable, Optional
from esphome.const import SOURCE_FILE_EXTENSIONS
from esphome.core import CORE
@ -22,7 +23,7 @@ class FileResource:
package: str
resource: str
def path(self) -> ContextManager[Path]:
def path(self) -> AbstractContextManager[Path]:
return importlib.resources.as_file(
importlib.resources.files(self.package) / self.resource
)
@ -176,7 +177,7 @@ def _lookup_module(domain):
module = importlib.import_module(f"esphome.components.{domain}")
except ImportError as e:
if "No module named" in str(e):
_LOGGER.error(
_LOGGER.info(
"Unable to import component %s: %s", domain, str(e), exc_info=False
)
else: