Skip to content

Commit 0d69b54

Browse files
committed
[property] Add set cardinality convenience method
1 parent 61f7142 commit 0d69b54

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

odml/property.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,17 @@ def val_cardinality(self, new_value):
576576
msg = "Can only assign single int or int-tuples of the format '(min, max)'"
577577
raise ValueError(msg)
578578

579+
def values_set_cardinality(self, min_val=None, max_val=None):
580+
"""
581+
Sets the values cardinality of a Property.
582+
583+
:param min_val: Required minimal number of values elements. None denotes
584+
no restrictions on values elements minimum. Default is None.
585+
:param max_val: Allowed maximal number of values elements. None denotes
586+
no restrictions on values elements maximum. Default is None.
587+
"""
588+
self.val_cardinality = (min_val, max_val)
589+
579590
def remove(self, value):
580591
"""
581592
Remove a value from this property. Only the first encountered

0 commit comments

Comments
 (0)