SetOf type¶
-
class
pyasn1.type.univ.
SetOf
(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection(), sizeSpec=ConstraintsIntersection())¶ Create SetOf type.
SetOf objects are mutable and duck-type Python
list
objects.Parameters: - componentType (
PyAsn1Item
derivative) – A pyasn1 object representing ASN.1 type allowed within SetOf type - tagSet (
TagSet
) – Object representing non-default ASN.1 tag(s) - subtypeSpec (
ConstraintsIntersection
) – Object representing non-default ASN.1 subtype constraint(s) - sizeSpec (
ConstraintsIntersection
) – Object representing collection size constraint
Note
The SetOf type models a collection of elements of a single ASN.1 type. Ordering of the components is not preserved upon de/serialization.
-
clone
(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection())¶ Create a copy of a SetOf type or object.
Any parameters to the clone() method will replace corresponding properties of the SetOf object.
Parameters: - tagSet (
TagSet
) – Object representing non-default ASN.1 tag(s) - subtypeSpec (
ConstraintsIntersection
) – Object representing non-default ASN.1 subtype constraint(s) - sizeSpec (
ConstraintsIntersection
) – Object representing non-default ASN.1 size constraint(s)
Returns: new instance of SetOf type/value
- tagSet (
-
subtype
(componentType=None, implicitTag=Tag(), explicitTag=Tag(), subtypeSpec=ConstraintsIntersection())¶ Create a copy of a SetOf type or object.
Any parameters to the subtype() method will be added to the corresponding properties of the SetOf object.
Parameters: - tagSet (
TagSet
) – Object representing non-default ASN.1 tag(s) - subtypeSpec (
ConstraintsIntersection
) – Object representing non-default ASN.1 subtype constraint(s) - sizeSpec (
ConstraintsIntersection
) – Object representing non-default ASN.1 size constraint(s)
Returns: new instance of SetOf type/value
- tagSet (
-
tagSet
= TagSet((), Tag(tagClass=0, tagFormat=32, tagId=17))¶ Set (on class, not on instance) or return a
TagSet
object representing ASN.1 tag(s) associated with SetOf type.
-
componentType
= None¶ Default
PyAsn1Item
derivative object representing ASN.1 type allowed within SetOf type
-
subtypeSpec
= ConstraintsIntersection()¶ Set (on class, not on instance) or return a
ConstraintsIntersection
object imposing constraints on SetOf type initialization values.
-
sizeSpec
= ConstraintsIntersection()¶ Default
ConstraintsIntersection
object imposing size constraint on SetOf objects
-
effectiveTagSet
¶ For SetOf type is equivalent to tagSet
-
getComponentByPosition
(idx)¶ Return SetOf type component value by position.
Equivalent to Python sequence subscription operation (e.g. []).
Parameters: idx ( int
) – Component index (zero-based). Must either refer to an existing component or to N+1 component (if componentType is set). In the latter case a new component type gets instantiated and appended to the SetOf sequence.Returns: PyAsn1Item
– a pyasn1 object
-
isSameTypeWith
(other, matchTags=True, matchConstraints=True)¶ Examine SetOf type for equality with other ASN.1 type.
ASN.1 tags (
tag
) and constraints (constraint
) are examined when carrying out ASN.1 types comparison.No Python inheritance relationship between PyASN1 objects is considered.
Parameters: other (a pyasn1 type object) – Class instance representing ASN.1 type. Returns: bool
–True
if other is SetOf type,False
otherwise.
-
isSuperTypeOf
(other, matchTags=True, matchConstraints=True)¶ Examine SetOf type for subtype relationship with other ASN.1 type.
ASN.1 tags (
tag
) and constraints (constraint
) are examined when carrying out ASN.1 types comparison.No Python inheritance relationship between PyASN1 objects is considered.
Parameters: other (a pyasn1 type object) – Class instance representing ASN.1 type. Returns: bool
–True
if other is a subtype of SetOf type,False
otherwise.
-
isValue
¶ Indicate if SetOf object represents ASN.1 type or ASN.1 value.
In other words, if isValue is True, then the ASN.1 object is initialized.
For the purpose of this check, empty SetOf object is considered as initialized.
Returns: bool
–True
if object represents ASN.1 value and type,False
if object represents just ASN.1 type.Note
There is an important distinction between PyASN1 type and value objects. The PyASN1 type objects can only participate in ASN.1 type operations (subtyping, comparison etc) and serve as a blueprint for serialization codecs to resolve ambiguous types.
The PyASN1 value objects can additionally participate in most of built-in Python operations.
-
setComponentByPosition
(idx, value=NoValue(), verifyConstraints=True, matchTags=True, matchConstraints=True)¶ Assign SetOf type component by position.
Equivalent to Python sequence item assignment operation (e.g. []) or list.append() (when idx == len(self)).
Parameters: - idx (
int
) – Component index (zero-based). Must either refer to existing component or to N+1 component. In the latter case a new component type gets instantiated (if componentType is set, or given ASN.1 object is taken otherwise) and appended to the SetOf sequence. - value (
object
orPyAsn1Item
derivative) – A Python value to initialize SetOf component with (if componentType is set) or ASN.1 value object to assign to SetOf component. - verifyConstraints (
bool
) – If False, skip constraints validation - matchTags (
bool
) – If False, skip component tags matching - matchConstraints (
bool
) – If False, skip component constraints matching
Returns: self
Raises: IndexError: – When idx > len(self)
- idx (
- componentType (