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

Method getPositionNearType

pager_lib/pyasn1/type/namedtype.py:397–428  ·  view source on GitHub ↗

Return the closest field position where given ASN.1 type is allowed. Some ASN.1 serialisation allow for skipping optional and defaulted fields. Some constructed ASN.1 types allow reordering of the fields. When recovering such objects it may be important to know at which fiel

(self, tagSet, idx)

Source from the content-addressed store, hash-verified

395 raise error.PyAsn1Error('Type position out of range')
396
397 def getPositionNearType(self, tagSet, idx):
398 """Return the closest field position where given ASN.1 type is allowed.
399
400 Some ASN.1 serialisation allow for skipping optional and defaulted fields.
401 Some constructed ASN.1 types allow reordering of the fields. When recovering
402 such objects it may be important to know at which field position, in field set,
403 given *tagSet* is allowed at or past *idx* position.
404
405 Parameters
406 ----------
407 tagSet: :class:`~pyasn1.type.tag.TagSet`
408 ASN.1 type which field position to look up
409
410 idx: :py:class:`int`
411 Field position at or past which to perform ASN.1 type look up
412
413 Returns
414 -------
415 : :py:class:`int`
416 Field position in fields set
417
418 Raises
419 ------
420 ~pyasn1.error.PyAsn1Error
421 If *tagSet* is not present or not unique within callee *NamedTypes*
422 or *idx* is out of fields range
423 """
424 try:
425 return idx + self.__ambiguousTypes[idx].getPositionByType(tagSet)
426
427 except KeyError:
428 raise error.PyAsn1Error('Type position out of range')
429
430 def __computeMinTagSet(self):
431 minTagSet = None

Callers 3

valueDecoderMethod · 0.80
indefLenValueDecoderMethod · 0.80

Calls 1

getPositionByTypeMethod · 0.80

Tested by

no test coverage detected