Set type¶
-
class
pyasn1.type.univ.
Set
(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection(), sizeSpec=ConstraintsIntersection())¶ Create Set type.
Set objects are mutable and duck-type Python
dict
objects.Parameters: - componentType (
NamedType
) – Object holding named ASN.1 types allowed within this collection - 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 Set type models a collection of named ASN.1 components. Ordering of the components is not preserved upon de/serialization.
-
clone
(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection())¶ Create a copy of a Set type or object.
Any parameters to the clone() method will replace corresponding properties of the Set 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 Set type/value
- tagSet (
-
subtype
(componentType=None, implicitTag=Tag(), explicitTag=Tag(), subtypeSpec=ConstraintsIntersection())¶ Create a copy of a Set type or object.
Any parameters to the subtype() method will be added to the corresponding properties of the Set 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 Set type/value
- tagSet (
-
tagSet
= TagSet((), Tag(tagClass=0, tagFormat=32, tagId=17))¶ Default
TagSet
object for ASN.1 Set objects
-
componentType
= NamedTypes()¶ Default collection of ASN.1 types of component (e.g.
NamedType
) object representing ASN.1 type allowed within Set type
-
subtypeSpec
= ConstraintsIntersection()¶ Default
ConstraintsIntersection
object imposing constraints on Set objects
-
sizeSpec
= ConstraintsIntersection()¶ Default
ConstraintsIntersection
object imposing constraints on Set objects
-
getComponentByType
(tagSet, innerFlag=False)¶ Returns Set type component by ASN.1 tag.
Parameters: tagSet ( TagSet
) – Object representing ASN.1 tagsReturns: PyAsn1Item
– a pyasn1 object
-
setComponentByType
(tagSet, value=NoValue(), verifyConstraints=True, matchTags=True, matchConstraints=True, innerFlag=False)¶ Assign Set type component by ASN.1 tag.
Parameters: - tagSet (
TagSet
) – Object representing ASN.1 tags - value (
object
orPyAsn1Item
derivative) – A Python or pyasn1 object to assign - verifyConstraints (
bool
) – If False, skip constraints validation - matchTags (
bool
) – If False, skip component tags matching - matchConstraints (
bool
) – If False, skip component constraints matching - innerFlag (
bool
) – If True, search for matching tagSet recursively.
Returns: self
- tagSet (
-
getComponentByName
(name)¶ Returns Set type component by name.
Equivalent to Python
dict
subscription operation (e.g. []).Parameters: name ( str
) – Set type component nameReturns: PyAsn1Item
– a pyasn1 object
-
getComponentByPosition
(idx)¶ Returns Set type component by index.
Equivalent to Python sequence subscription operation (e.g. []).
Parameters: idx ( int
) – component index (zero-based)Returns: PyAsn1Item
– a PyASN1 object
-
isSameTypeWith
(other, matchTags=True, matchConstraints=True)¶ Examine Set 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 Set type,False
otherwise.
-
isSuperTypeOf
(other, matchTags=True, matchConstraints=True)¶ Examine Set 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 Set type,False
otherwise.
-
setComponentByName
(name, value=NoValue(), verifyConstraints=True, matchTags=True, matchConstraints=True)¶ Assign Set type component by name.
Equivalent to Python
dict
item assignment operation (e.g. []).Parameters: - name (
str
) – Set type component name - value (
object
orPyAsn1Item
derivative) – A Python or pyasn1 object to assign - 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
- name (
-
setComponentByPosition
(idx, value=NoValue(), verifyConstraints=True, matchTags=True, matchConstraints=True)¶ Assign Set type component by position.
Equivalent to Python sequence item assignment operation (e.g. []).
Parameters: - idx (
int
) – Set type component index (zero-based) - value (
object
orPyAsn1Item
derivative) – A Python or pyasn1 object to assign - 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
- idx (
-
setDefaultComponents
()¶ Assign default values to all defaulted Set type components.
Returns: self
- componentType (