From d95725c7825ee302660a1c99dd946cfcd0c5c81b Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Wed, 2 Apr 2025 14:56:01 +0100 Subject: [PATCH] Fix import scoping and naming for PackageDefs --- chipflow_lib/pin_lock.py | 11 +++++++++-- chipflow_lib/platforms/utils.py | 9 +++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/chipflow_lib/pin_lock.py b/chipflow_lib/pin_lock.py index 97917c3a..268a50c7 100644 --- a/chipflow_lib/pin_lock.py +++ b/chipflow_lib/pin_lock.py @@ -7,8 +7,15 @@ from typing import Any, List, Dict, Tuple from chipflow_lib import _parse_config, _ensure_chipflow_root, ChipFlowError -from chipflow_lib.platforms import PACKAGE_DEFINITIONS, PIN_ANNOTATION_SCHEMA, top_interfaces -from chipflow_lib.platforms.utils import LockFile, Package, PortMap, Port +from chipflow_lib.platforms import ( + PACKAGE_DEFINITIONS, + PIN_ANNOTATION_SCHEMA, + top_interfaces, + LockFile, + Package, + PortMap, + Port +) from chipflow_lib.config_models import Config # logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) diff --git a/chipflow_lib/platforms/utils.py b/chipflow_lib/platforms/utils.py index b0b03804..b13f8fd8 100644 --- a/chipflow_lib/platforms/utils.py +++ b/chipflow_lib/platforms/utils.py @@ -19,7 +19,8 @@ __all__ = ['PIN_ANNOTATION_SCHEMA', 'PinSignature', 'OutputPinSignature', 'InputPinSignature', 'BidirPinSignature', - 'load_pinlock', "PACKAGE_DEFINITIONS", 'top_interfaces'] + 'load_pinlock', "PACKAGE_DEFINITIONS", 'top_interfaces', 'LockFile', + 'Package', 'PortMap', 'Port'] logger = logging.getLogger(__name__) @@ -257,7 +258,7 @@ class _BareDiePackageDef(_BasePackageDef): """ # Used by pydantic to differentate when deserialising - type: Literal["_QuadPackageDef"] = "_QuadPackageDef" + type: Literal["_BareDiePackageDef"] = "_BareDiePackageDef" width: int height: int @@ -289,7 +290,7 @@ class _QuadPackageDef(_BasePackageDef): """ # Used by pydantic to differentate when deserialising - type: Literal["_PGAPackageDef"] = "_PGAPackageDef" + type: Literal["_QuadPackageDef"] = "_QuadPackageDef" width:int height: int @@ -322,7 +323,7 @@ def sortpins(self, pins: Union[List[str], Set[str]]) -> List[str]: "cf20": _BareDiePackageDef(name="cf20", width=7, height=3) } -PackageDef = Union[_QuadPackageDef, _BasePackageDef] +PackageDef = Union[_QuadPackageDef, _BareDiePackageDef] class Port(pydantic.BaseModel):