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
- tagSet (
-
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
= TagSet((), Tag(tagClass=0, tagFormat=32, tagId=16))¶ Set (on class, not on instance) or return a
TagSet
object representing ASN.1 tag(s) associated with SequenceOf type.
-
componentType
= None¶ Default
PyAsn1Item
derivative object representing ASN.1 type allowed within SequenceOf type
-
subtypeSpec
= ConstraintsIntersection()¶ Set (on class, not on instance) or return a
ConstraintsIntersection
object imposing constraints on SequenceOf type initialization values.
-
sizeSpec
= ConstraintsIntersection()¶ Default
ConstraintsIntersection
object imposing size constraint on SequenceOf objects
-
effectiveTagSet
¶ For SequenceOf type is equivalent to tagSet
-
getComponentByPosition
(idx)¶ Return SequenceOf 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 SequenceOf sequence.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: bool
–True
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: bool
–True
if other is a subtype of SequenceOf type,False
otherwise.
-
isValue
¶ Indicate if SequenceOf 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 SequenceOf 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 SequenceOf 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 SequenceOf sequence. - value (
object
orPyAsn1Item
derivative) – A Python value to initialize SequenceOf component with (if componentType is set) or ASN.1 value object to assign to SequenceOf 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 (