SequenceOf type

class pyasn1.type.univ.SequenceOf(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection(), sizeSpec=ConstraintsIntersection())

Create SequenceOf type.

SequenceOf objects are mutable and duck-type Python list objects.

Parameters:
  • componentType (PyAsn1Item derivative) – A pyasn1 object representing ASN.1 type allowed within SequenceOf 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 SequenceOf type models a collection of elements of a single ASN.1 type. Ordering of the components is preserved upon de/serialization.

clone(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection())

Create a copy of a SequenceOf type or object.

Any parameters to the clone() method will replace corresponding properties of the SequenceOf 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 SequenceOf type/value

subtype(componentType=None, implicitTag=Tag(), explicitTag=Tag(), subtypeSpec=ConstraintsIntersection())

Create a copy of a SequenceOf type or object.

Any parameters to the subtype() method will be added to the corresponding properties of the SequenceOf 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 SequenceOf type/value

tagSet = TagSet((), Tag(tagClass=0, tagFormat=32, tagId=16))

Default TagSet object for SequenceOf objects

componentType = None

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

subtypeSpec = ConstraintsIntersection()

Default ConstraintsIntersection object imposing constraints on SequenceOf objects

sizeSpec = ConstraintsIntersection()

Default ConstraintsIntersection object imposing size constraint on SequenceOf objects

getComponentByPosition(idx)

Return SequenceOf 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 SequenceOf 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 SequenceOf type, False otherwise.
isSuperTypeOf(other, matchTags=True, matchConstraints=True)

Examine SequenceOf 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 SequenceOf type, False otherwise.
setComponentByPosition(idx, value=NoValue(), verifyConstraints=True, matchTags=True, matchConstraints=True)

Assign SequenceOf 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