Skip to content

Commit 9822545

Browse files
committed
[property] Add cardinality to init
1 parent 710ccbd commit 9822545

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

odml/property.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ class BaseProperty(base.BaseObject):
8282
:param oid: object id, UUID string as specified in RFC 4122. If no id is provided,
8383
an id will be generated and assigned. An id has to be unique
8484
within an odML Document.
85+
:param val_cardinality: Value cardinality defines how many values are allowed for this Property.
86+
By default unlimited values can be set.
87+
A required number of values can be set by assigning a tuple of the
88+
format "(min, max)".
8589
:param value: Legacy code to the 'values' attribute. If 'values' is provided,
8690
any data provided via 'value' will be ignored.
8791
"""
@@ -91,7 +95,7 @@ class BaseProperty(base.BaseObject):
9195
def __init__(self, name=None, values=None, parent=None, unit=None,
9296
uncertainty=None, reference=None, definition=None,
9397
dependency=None, dependency_value=None, dtype=None,
94-
value_origin=None, oid=None, value=None):
98+
value_origin=None, oid=None, val_cardinality=None, value=None):
9599

96100
try:
97101
if oid is not None:
@@ -129,6 +133,8 @@ def __init__(self, name=None, values=None, parent=None, unit=None,
129133

130134
self.parent = parent
131135

136+
self._val_cardinality = val_cardinality
137+
132138
for err in validation.Validation(self).errors:
133139
if err.is_error:
134140
msg = "\n\t- %s %s: %s" % (err.obj, err.rank, err.msg)

0 commit comments

Comments
 (0)