fix: resolve pyright reportUnusedImport in manifest_extends

Import ManifestError at module level from manifest_util (no circular
dep) and remove the redundant local imports from function bodies that
were shadowing it. ManifestBottle retains its local import pattern to
avoid the circular manifest ↔ manifest_extends dependency.
This commit is contained in:
2026-06-20 02:24:49 +00:00
committed by didericis
parent 3375df3f52
commit 996a260a98
+4 -4
View File
@@ -4,6 +4,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from .manifest_util import ManifestError
if TYPE_CHECKING: if TYPE_CHECKING:
from .manifest import ManifestBottle from .manifest import ManifestBottle
from .manifest_egress import ManifestEgressConfig from .manifest_egress import ManifestEgressConfig
@@ -31,8 +33,6 @@ def resolve_bottles_partial(
collected in `broken` rather than raising, so unrelated bottles remain collected in `broken` rather than raising, so unrelated bottles remain
usable. Errors for parent bottles propagate to all children that extend usable. Errors for parent bottles propagate to all children that extend
them.""" them."""
from .manifest import ManifestError
cache: dict[str, ManifestBottle] = {} cache: dict[str, ManifestBottle] = {}
broken: dict[str, ManifestError] = {} broken: dict[str, ManifestError] = {}
for name in raws: for name in raws:
@@ -48,7 +48,7 @@ def _resolve_one_bottle(
repos_cache: dict[str, dict[str, object]], repos_cache: dict[str, dict[str, object]],
seen: tuple[str, ...], seen: tuple[str, ...],
) -> ManifestBottle: ) -> ManifestBottle:
from .manifest import ManifestBottle, ManifestError from .manifest import ManifestBottle
if name in cache: if name in cache:
return cache[name] return cache[name]
@@ -239,7 +239,7 @@ def _resolve_one_bottle_partial(
seen: tuple[str, ...], seen: tuple[str, ...],
) -> None: ) -> None:
"""Error-tolerant variant: on failure, adds to `broken` instead of raising.""" """Error-tolerant variant: on failure, adds to `broken` instead of raising."""
from .manifest import ManifestBottle, ManifestError from .manifest import ManifestBottle
if name in cache or name in broken: if name in cache or name in broken:
return return