aboutsummaryrefslogtreecommitdiff
path: root/src/ee/kicad
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/kicad')
-rw-r--r--src/ee/kicad/make_bom.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/ee/kicad/make_bom.py b/src/ee/kicad/make_bom.py
index 00e9ae3..7dd5532 100644
--- a/src/ee/kicad/make_bom.py
+++ b/src/ee/kicad/make_bom.py
@@ -9,7 +9,7 @@ from ee.kicad.model import Component
from ee.kicad.read_schematic import read_schematics
from ee.kicad.to_bom import to_bom, to_bom_xml
from ee.part import PartDb, save_db
-from ee.xml import bomFile, uris
+from ee.xml import types, uris
__all__ = [
"StrategyCallable",
@@ -21,23 +21,23 @@ __all__ = [
"make_bom",
]
-StrategyCallable = Callable[[Component, bomFile.Part], Optional[bomFile.Part]]
+StrategyCallable = Callable[[Component, types.Part], Optional[types.Part]]
-def apply_strategies(c: Component, part: bomFile.Part, strategies: List[StrategyCallable]):
+def apply_strategies(c: Component, part: types.Part, strategies: List[StrategyCallable]):
for strategy in strategies:
part = strategy(c, part)
if part is None:
return
- if not isinstance(part, bomFile.Part):
- raise EeException("Values returned from strategy must be a bomFile.Part, got {}".format(type(part)))
+ if not isinstance(part, types.Part):
+ raise EeException("Values returned from strategy must be a types.Part, got {}".format(type(part)))
return part
-def part_type_strategy(component: Component, part: bomFile.Part) -> bomFile.Part:
+def part_type_strategy(component: Component, part: types.Part) -> types.Part:
fp = component.footprint
if fp is None:
return part
@@ -58,23 +58,23 @@ def part_type_strategy(component: Component, part: bomFile.Part) -> bomFile.Part
return part
-def mpn_strategy(component: Component, part: bomFile.Part) -> bomFile.Part:
+def mpn_strategy(component: Component, part: types.Part) -> types.Part:
mpn = component.get_field("mpn")
if mpn is not None:
- pn = bomFile.PartNumber(value=mpn.value)
+ pn = types.PartNumber(value=mpn.value)
part.part_numbersProp.add_part_number(pn)
return part
def dpn_strategy_factory(dpn_mappings: Mapping[str, str]) -> StrategyCallable:
- def dpn_strategy(component: Component, part: bomFile.Part) -> bomFile.Part:
+ def dpn_strategy(component: Component, part: types.Part) -> types.Part:
for field_name, distributor in dpn_mappings:
s = component.get_field(field_name)
if s is None:
continue
- pn = bomFile.PartNumber(value=s.value, distributor=distributor)
+ pn = types.PartNumber(value=s.value, distributor=distributor)
part.part_numbersProp.add_part_number(pn)
return part
@@ -91,10 +91,10 @@ class MakeBomStrategy():
dpn_strategy_factory(self.dpn_mappings),
]
- def process_part(self, component: Component, part: bomFile.Part):
+ def process_part(self, component: Component, part: types.Part):
return self.default_process_part(component, part)
- def default_process_part(self, component: Component, part: bomFile.Part):
+ def default_process_part(self, component: Component, part: types.Part):
return apply_strategies(component, part, self.default_strategies)
@@ -111,9 +111,9 @@ def work(sch, out: Path, strategy: MakeBomStrategy, new_mode, pretty):
parts = PartDb()
components = to_bom(sch)
for c in components:
- part = bomFile.Part(id=c.ref)
+ part = types.Part(id=c.ref)
part.schema_reference = c.ref
- part.part_numbersProp = bomFile.PartNumberList()
+ part.part_numbersProp = types.PartNumberList()
part = strategy.process_part(c, part)