SunSpecOrangeButton / pyoblib

Orange Button Python Library
Apache License 2.0
14 stars 19 forks source link

data_model.OBInstance._is_valid_unit should be replaced by TaxonomyUnits.is_unit #99

Closed cwhanse closed 5 years ago

cwhanse commented 5 years ago

After #98 is merged, TaxonomyUnits.is_unit(unit_str) accepts unit_name, unit_id or id and returns Boolean. TaxonomyUnits.get_unit(unit_str) accepts unit_name, unit_id or id and returns unit instance.

OBInstance._is_valid_unit could use these two functions instead.

cwhanse commented 5 years ago

Closing, OBInstance._is_valid_unit is checking consistency between a concept and a unit, whereas TaxonomyUnits.is_unit is confirming presence in the taxonomy. _is_valid_unit uses .is_unit by means of TaxonomyUnits.get_unit