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

Method setComponentByPosition

pager_lib/pyasn1/type/univ.py:3088–3130  ·  view source on GitHub ↗

Assign |ASN.1| type component by position. Equivalent to Python sequence item assignment operation (e.g. `[]`). Parameters ---------- idx: :class:`int` Component index (zero-based). Must either refer to existing component or to N+1 component.

(self, idx, value=noValue,
                               verifyConstraints=True,
                               matchTags=True,
                               matchConstraints=True)

Source from the content-addressed store, hash-verified

3086 return self._componentValues[idx]
3087
3088 def setComponentByPosition(self, idx, value=noValue,
3089 verifyConstraints=True,
3090 matchTags=True,
3091 matchConstraints=True):
3092 """Assign |ASN.1| type component by position.
3093
3094 Equivalent to Python sequence item assignment operation (e.g. `[]`).
3095
3096 Parameters
3097 ----------
3098 idx: :class:`int`
3099 Component index (zero-based). Must either refer to existing
3100 component or to N+1 component. In the latter case a new component
3101 type gets instantiated (if *componentType* is set, or given ASN.1
3102 object is taken otherwise) and appended to the |ASN.1| sequence.
3103
3104 Keyword Args
3105 ------------
3106 value: :class:`object` or :py:class:`~pyasn1.type.base.PyAsn1Item` derivative
3107 A Python value to initialize |ASN.1| component with (if *componentType* is set)
3108 or ASN.1 value object to assign to |ASN.1| component. Once a new value is
3109 set to *idx* component, previous value is dropped.
3110 If `value` is not given, schema object will be set as a component.
3111
3112 verifyConstraints : :class:`bool`
3113 If :obj:`False`, skip constraints validation
3114
3115 matchTags: :class:`bool`
3116 If :obj:`False`, skip component tags matching
3117
3118 matchConstraints: :class:`bool`
3119 If :obj:`False`, skip component constraints matching
3120
3121 Returns
3122 -------
3123 self
3124 """
3125 oldIdx = self._currentIdx
3126 Set.setComponentByPosition(self, idx, value, verifyConstraints, matchTags, matchConstraints)
3127 self._currentIdx = idx
3128 if oldIdx is not None and oldIdx != idx:
3129 self._componentValues[oldIdx] = noValue
3130 return self
3131
3132 @property
3133 def effectiveTagSet(self):

Callers 7

valueDecoderMethod · 0.45
indefLenValueDecoderMethod · 0.45
_cloneComponentValuesMethod · 0.45
_cloneComponentValuesMethod · 0.45
setComponentByTypeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected