Rephrase comment

This commit is contained in:
epenet
2024-05-27 09:01:51 +00:00
parent 95186d1bb6
commit 425b1627df

View File

@@ -394,8 +394,7 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = {
], ],
} }
# Should be gradually synchronised with pyproject.toml # Black list of imports that should be using the namespace
# [tool.ruff.lint.flake8-import-conventions.extend-aliases]
_FORCE_NAMESPACE_IMPORT: dict[tuple[str, str], str] = { _FORCE_NAMESPACE_IMPORT: dict[tuple[str, str], str] = {
("homeassistant.helpers.area_registry", "async_get"): "ar.async_get", ("homeassistant.helpers.area_registry", "async_get"): "ar.async_get",
("homeassistant.helpers.device_registry", "async_get"): "dr.async_get", ("homeassistant.helpers.device_registry", "async_get"): "dr.async_get",
@@ -457,7 +456,7 @@ class HassImportsFormatChecker(BaseChecker):
if self.current_package is None: if self.current_package is None:
return return
for module, _alias in node.names: for module, _alias in node.names:
if module.startswith("{self.current_package}."): if module.startswith(f"{self.current_package}."):
self.add_message("hass-relative-import", node=node) self.add_message("hass-relative-import", node=node)
continue continue
if module.startswith("homeassistant.components.") and module.endswith( if module.startswith("homeassistant.components.") and module.endswith(