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

Method valueDecoder

pager_lib/pyasn1/codec/ber/decoder.py:136–154  ·  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

134 protoComponent = univ.Integer(0)
135
136 def valueDecoder(self, substrate, asn1Spec,
137 tagSet=None, length=None, state=None,
138 decodeFun=None, substrateFun=None,
139 **options):
140
141 if tagSet[0].tagFormat != tag.tagFormatSimple:
142 raise error.PyAsn1Error('Simple tag format expected')
143
144 for chunk in readFromStream(substrate, length, options):
145 if isinstance(chunk, SubstrateUnderrunError):
146 yield chunk
147
148 if chunk:
149 value = int.from_bytes(bytes(chunk), 'big', signed=True)
150
151 else:
152 value = 0
153
154 yield self._createComponent(asn1Spec, tagSet, value, **options)
155
156
157class BooleanPayloadDecoder(IntegerPayloadDecoder):

Callers

nothing calls this directly

Calls 3

readFromStreamFunction · 0.90
from_bytesMethod · 0.45
_createComponentMethod · 0.45

Tested by

no test coverage detected