diff options
Diffstat (limited to 'src/ee/digikey/normalize_facts.py')
-rw-r--r-- | src/ee/digikey/normalize_facts.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ee/digikey/normalize_facts.py b/src/ee/digikey/normalize_facts.py index 62aef0d..91e8c07 100644 --- a/src/ee/digikey/normalize_facts.py +++ b/src/ee/digikey/normalize_facts.py @@ -4,13 +4,13 @@ from typing import List, Tuple, Union, Mapping, Callable, Any from ee import EeVal, EeException from ee.part import PartDb, load_db, save_db -from ee.xml import bomFile, uris +from ee.xml import types, uris __all__ = ["normalize_facts"] # TODO: this should be moved to a generic normalizer -def handle_tolerance(tolerance: bomFile.Fact, capacitance: bomFile.Fact) -> List[bomFile.Fact]: +def handle_tolerance(tolerance: types.Fact, capacitance: types.Fact) -> List[types.Fact]: cap_value = float(EeVal.parse(capacitance.valueProp)) s = tolerance.valueProp @@ -62,7 +62,7 @@ def handle_tolerance(tolerance: bomFile.Fact, capacitance: bomFile.Fact) -> List if low_pct and low_pct == high_pct: facts.append(("tolerance-percent", "Tolerance (±%)", low_pct)) - return [bomFile.Fact(key=uris.make_fact_key(key), label=label, value=str(value)) for key, label, value in facts] + return [types.Fact(key=uris.make_fact_key(key), label=label, value=str(value)) for key, label, value in facts] def re_parser(pattern, kis: List[Tuple[str, int]]): @@ -119,12 +119,12 @@ def normalize_facts(in_dir: Path, out_dir: Path): in_db = load_db(in_dir) out_parts = PartDb() - for part in in_db.iterparts(): # type: bomFile.Part - fact_list: bomFile.FactList = part.factsProp + for part in in_db.iterparts(): # type: types.Part + fact_list: types.FactList = part.factsProp if fact_list is None: continue - in_facts: List[bomFile.Fact] = fact_list.factProp + in_facts: List[types.Fact] = fact_list.factProp out_facts = [] for f in in_facts: @@ -145,7 +145,7 @@ def normalize_facts(in_dir: Path, out_dir: Path): results = res else: results = [res] - facts = [bomFile.Fact(key=uris.make_fact_key(key), value=value) for key, value in results] + facts = [types.Fact(key=uris.make_fact_key(key), value=value) for key, value in results] out_facts.extend(facts) if len(out_facts) == 0: |