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

Method valueDecoder

pager_lib/pyasn1/codec/ber/decoder.py:1306–1345  ·  view source on GitHub ↗
(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options)

Source from the content-addressed store, hash-verified

1304 protoComponent = univ.Any()
1305
1306 def valueDecoder(self, substrate, asn1Spec,
1307 tagSet=None, length=None, state=None,
1308 decodeFun=None, substrateFun=None,
1309 **options):
1310 if asn1Spec is None:
1311 isUntagged = True
1312
1313 elif asn1Spec.__class__ is tagmap.TagMap:
1314 isUntagged = tagSet not in asn1Spec.tagMap
1315
1316 else:
1317 isUntagged = tagSet != asn1Spec.tagSet
1318
1319 if isUntagged:
1320 fullPosition = substrate.markedPosition
1321 currentPosition = substrate.tell()
1322
1323 substrate.seek(fullPosition, os.SEEK_SET)
1324 length += currentPosition - fullPosition
1325
1326 if LOG:
1327 for chunk in peekIntoStream(substrate, length):
1328 if isinstance(chunk, SubstrateUnderrunError):
1329 yield chunk
1330 LOG('decoding as untagged ANY, substrate '
1331 '%s' % debug.hexdump(chunk))
1332
1333 if substrateFun:
1334 for chunk in substrateFun(
1335 self._createComponent(asn1Spec, tagSet, noValue, **options),
1336 substrate, length, options):
1337 yield chunk
1338
1339 return
1340
1341 for chunk in readFromStream(substrate, length, options):
1342 if isinstance(chunk, SubstrateUnderrunError):
1343 yield chunk
1344
1345 yield self._createComponent(asn1Spec, tagSet, chunk, **options)
1346
1347 def indefLenValueDecoder(self, substrate, asn1Spec,
1348 tagSet=None, length=None, state=None,

Callers

nothing calls this directly

Calls 5

peekIntoStreamFunction · 0.90
readFromStreamFunction · 0.90
tellMethod · 0.80
seekMethod · 0.80
_createComponentMethod · 0.45

Tested by

no test coverage detected