Sequence type¶
-
class
pyasn1.type.univ.Sequence(componentType=None, tagSet=tagSet(), subtypeSpec=ConstraintsIntersection(), sizeSpec=ConstraintsIntersection())¶ Create Sequence type.
Sequence objects are mutable and duck-type Python
dictobjects.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 Sequence type models a collection of named ASN.1 components. Ordering of the components is preserved upon de/serialization.
-
clone(componentType=None, tagSet=tagSet(), subtypeSpec=ConstraintsIntersection())¶ Create a copy of a Sequence type or object.
Any parameters to the clone() method will replace corresponding properties of the Sequence 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 Sequence type/value
- tagSet (
-
subtype(componentType=None, implicitTag=Tag(), explicitTag=Tag(), subtypeSpec=ConstraintsIntersection())¶ Create a copy of a Sequence type or object.
Any parameters to the subtype() method will be added to the corresponding properties of the Sequence 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 Sequence type/value
- tagSet (
-
tagSet= TagSet((), Tag(tagClass=0, tagFormat=32, tagId=16))¶ Set (on class, not on instance) or return a
TagSetobject representing ASN.1 tag(s) associated with Sequence type.
-
subtypeSpec= ConstraintsIntersection()¶ Set (on class, not on instance) or return a
ConstraintsIntersectionobject imposing constraints on Sequence type initialization values.
-
sizeSpec= ConstraintsIntersection()¶ Default
ConstraintsIntersectionobject imposing constraints on Sequence objects
-
componentType= NamedTypes()¶ Default collection of ASN.1 types of component (e.g.
NamedType) object imposing size constraint on Sequence objects
-
effectiveTagSet¶ For Sequence type is equivalent to tagSet
-
getComponentByName(name)¶ Returns Sequence type component by name.
Equivalent to Python
dictsubscription operation (e.g. []).Parameters: name ( str) – Sequence type component nameReturns: PyAsn1Item– Instantiate Sequence component type or return existing component value
-
getComponentByPosition(idx)¶ Returns Sequence type component by index.
Equivalent to Python sequence subscription operation (e.g. []).
Parameters: idx ( int) – Component index (zero-based). Must either refer to an existing component or (if componentType is set) new ASN.1 type object gets instantiated.Returns: PyAsn1Item– a PyASN1 object
-
isSameTypeWith(other, matchTags=True, matchConstraints=True)¶ Examine Sequence 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–Trueif other is Sequence type,Falseotherwise.
-
isSuperTypeOf(other, matchTags=True, matchConstraints=True)¶ Examine Sequence 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–Trueif other is a subtype of Sequence type,Falseotherwise.
-
isValue¶ Indicate if Sequence 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 check, the OPTIONAL and DEFAULT fields are unconditionally considered as initialized.
Returns: bool–Trueif object represents ASN.1 value and type,Falseif 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.
-
setComponentByName(name, value=NoValue(), verifyConstraints=True, matchTags=True, matchConstraints=True)¶ Assign Sequence type component by name.
Equivalent to Python
dictitem assignment operation (e.g. []).Parameters: - name (
str) – Sequence type component name - value (
objectorPyAsn1Itemderivative) – A Python value to initialize Sequence component with (if componentType is set) or ASN.1 value object to assign to Sequence 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
- name (
-
setComponentByPosition(idx, value=NoValue(), verifyConstraints=True, matchTags=True, matchConstraints=True)¶ Assign Sequence type component by position.
Equivalent to Python sequence item assignment operation (e.g. []).
Parameters: - idx (
int) – Component index (zero-based). Must either refer to existing component (if componentType is set) or to N+1 component otherwise. In the latter case a new component of given ASN.1 type gets instantiated and appended to Sequence sequence. - value (
objectorPyAsn1Itemderivative) – A Python value to initialize Sequence component with (if componentType is set) or ASN.1 value object to assign to Sequence 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
- idx (
- componentType (