Skip to content

Commit 3b4c707

Browse files
committed
rollback to correct UnitDefintion
1 parent 7331b55 commit 3b4c707

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

pyenzyme/sbml/validation.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from loguru import logger
2+
from mdmodels.units.unit_definition import UnitDefinition
23

34
import pyenzyme.tools as tools
45
from pyenzyme.versions.v2 import (
@@ -7,7 +8,6 @@
78
MeasurementData,
89
Parameter,
910
ReactionElement,
10-
UnitDefinitionAnnot,
1111
)
1212

1313

@@ -118,6 +118,7 @@ def _check_units_exist(doc: EnzymeMLDocument) -> bool:
118118
mandatory_unit_objects = [
119119
*tools.extract(obj=doc, target=MeasurementData),
120120
]
121+
print(f"Found {len(mandatory_unit_objects)} mandatory unit objects.")
121122

122123
optional_unit_objects = [
123124
*tools.extract(obj=doc, target=Parameter),
@@ -126,16 +127,16 @@ def _check_units_exist(doc: EnzymeMLDocument) -> bool:
126127
result = []
127128

128129
for unit_obj in mandatory_unit_objects:
129-
units = tools.extract(obj=unit_obj, target=UnitDefinitionAnnot)
130+
units = tools.extract(obj=unit_obj, target=UnitDefinition)
130131

131132
if len(units) == 0:
132133
logger.error(
133-
f"Object of type '{type(unit_obj).__name__}' with id '{unit_obj.id}' does not have a unit defined."
134+
f"Object of type '{type(unit_obj).__name__}' with id '{unit_obj.species_id}' does not have a unit defined."
134135
)
135136
result.append(False)
136137

137138
for unit_obj in optional_unit_objects:
138-
units = tools.extract(obj=unit_obj, target=UnitDefinitionAnnot)
139+
units = tools.extract(obj=unit_obj, target=UnitDefinition)
139140

140141
if len(units) == 0:
141142
logger.warning(

0 commit comments

Comments
 (0)