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

Class IntegerPayloadDecoder

pager_lib/pyasn1/codec/ber/decoder.py:133–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131
132
133class IntegerPayloadDecoder(AbstractSimplePayloadDecoder):
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 1

decoder.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected