Skip to content

Commit b248516

Browse files
committed
[property] Move cardinality val to own func
1 parent 7a5fd79 commit b248516

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

odml/property.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,7 @@ def values(self, new_value):
414414
self._values = [dtypes.get(v, self.dtype) for v in new_value]
415415

416416
# Validate and inform user if the current values cardinality is violated
417-
valid = validation.Validation(self)
418-
for err in valid.errors:
419-
print("%s: %s" % (err.rank.capitalize(), err.msg))
417+
self._values_cardinality_validation()
420418

421419
@property
422420
def value_origin(self):
@@ -553,6 +551,13 @@ def val_cardinality(self, new_value):
553551
self._val_cardinality = format_cardinality(new_value)
554552

555553
# Validate and inform user if the current values cardinality is violated
554+
self._values_cardinality_validation()
555+
556+
def _values_cardinality_validation(self):
557+
"""
558+
Runs a validation to check whether the values cardinality
559+
is respected and prints a warning message otherwise.
560+
"""
556561
valid = validation.Validation(self)
557562
for err in valid.errors:
558563
print("%s: %s" % (err.rank.capitalize(), err.msg))

0 commit comments

Comments
 (0)