MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / SequenceOfAndSetOfBase

Class SequenceOfAndSetOfBase

pager_lib/pyasn1/type/univ.py:1635–2091  ·  view source on GitHub ↗

Create |ASN.1| schema or value object. |ASN.1| class is based on :class:`~pyasn1.type.base.ConstructedAsn1Type`, its objects are mutable and duck-type Python :class:`list` objects. Keyword Args ------------ componentType : :py:class:`~pyasn1.type.base.PyAsn1Item` derivative

Source from the content-addressed store, hash-verified

1633# "Structured" ASN.1 types
1634
1635class SequenceOfAndSetOfBase(base.ConstructedAsn1Type):
1636 """Create |ASN.1| schema or value object.
1637
1638 |ASN.1| class is based on :class:`~pyasn1.type.base.ConstructedAsn1Type`,
1639 its objects are mutable and duck-type Python :class:`list` objects.
1640
1641 Keyword Args
1642 ------------
1643 componentType : :py:class:`~pyasn1.type.base.PyAsn1Item` derivative
1644 A pyasn1 object representing ASN.1 type allowed within |ASN.1| type
1645
1646 tagSet: :py:class:`~pyasn1.type.tag.TagSet`
1647 Object representing non-default ASN.1 tag(s)
1648
1649 subtypeSpec: :py:class:`~pyasn1.type.constraint.ConstraintsIntersection`
1650 Object representing non-default ASN.1 subtype constraint(s). Constraints
1651 verification for |ASN.1| type can only occur on explicit
1652 `.isInconsistent` call.
1653
1654 Examples
1655 --------
1656
1657 .. code-block:: python
1658
1659 class LotteryDraw(SequenceOf): # SetOf is similar
1660 '''
1661 ASN.1 specification:
1662
1663 LotteryDraw ::= SEQUENCE OF INTEGER
1664 '''
1665 componentType = Integer()
1666
1667 lotteryDraw = LotteryDraw()
1668 lotteryDraw.extend([123, 456, 789])
1669 """
1670 def __init__(self, *args, **kwargs):
1671 # support positional params for backward compatibility
1672 if args:
1673 for key, value in zip(('componentType', 'tagSet',
1674 'subtypeSpec'), args):
1675 if key in kwargs:
1676 raise error.PyAsn1Error('Conflicting positional and keyword params!')
1677 kwargs['componentType'] = value
1678
1679 self._componentValues = noValue
1680
1681 base.ConstructedAsn1Type.__init__(self, **kwargs)
1682
1683 # Python list protocol
1684
1685 def __getitem__(self, idx):
1686 try:
1687 return self.getComponentByPosition(idx)
1688
1689 except error.PyAsn1Error as exc:
1690 raise IndexError(exc)
1691
1692 def __setitem__(self, idx, value):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected