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

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((), Tag(tagClass=0, tagFormat=32, tagId=17))

Default TagSet object for SetOf objects

componentType = None

Default PyAsn1Item derivative object representing ASN.1 type allowed within SetOf type

subtypeSpec = ConstraintsIntersection()

Default ConstraintsIntersection object imposing constraints on SetOf objects

sizeSpec = ConstraintsIntersection()

Default ConstraintsIntersection object imposing size constraint on SetOf objects

getComponentByPosition(idx)

Return SetOf type component value by position.

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 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:boolTrue 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:boolTrue if other is a subtype of SetOf type, False otherwise.
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. []).

Parameters:
  • idx (int) – component index (zero-based)
  • value (object or PyAsn1Item derivative) – A Python or pyasn1 object to assign or noValue object to instantiate component type.
  • 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