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

Method valueDecoder

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

1184 protoComponent = univ.Choice()
1185
1186 def valueDecoder(self, substrate, asn1Spec,
1187 tagSet=None, length=None, state=None,
1188 decodeFun=None, substrateFun=None,
1189 **options):
1190 if asn1Spec is None:
1191 asn1Object = self.protoComponent.clone(tagSet=tagSet)
1192
1193 else:
1194 asn1Object = asn1Spec.clone()
1195
1196 if substrateFun:
1197 for chunk in substrateFun(asn1Object, substrate, length, options):
1198 yield chunk
1199
1200 return
1201
1202 options = self._passAsn1Object(asn1Object, options)
1203
1204 if asn1Object.tagSet == tagSet:
1205 if LOG:
1206 LOG('decoding %s as explicitly tagged CHOICE' % (tagSet,))
1207
1208 for component in decodeFun(
1209 substrate, asn1Object.componentTagMap, **options):
1210 if isinstance(component, SubstrateUnderrunError):
1211 yield component
1212
1213 else:
1214 if LOG:
1215 LOG('decoding %s as untagged CHOICE' % (tagSet,))
1216
1217 for component in decodeFun(
1218 substrate, asn1Object.componentTagMap, tagSet, length,
1219 state, **options):
1220 if isinstance(component, SubstrateUnderrunError):
1221 yield component
1222
1223 effectiveTagSet = component.effectiveTagSet
1224
1225 if LOG:
1226 LOG('decoded component %s, effective tag set %s' % (component, effectiveTagSet))
1227
1228 asn1Object.setComponentByType(
1229 effectiveTagSet, component,
1230 verifyConstraints=False,
1231 matchTags=False, matchConstraints=False,
1232 innerFlag=False
1233 )
1234
1235 yield asn1Object
1236
1237 def indefLenValueDecoder(self, substrate, asn1Spec,
1238 tagSet=None, length=None, state=None,

Callers

nothing calls this directly

Calls 3

_passAsn1ObjectMethod · 0.80
setComponentByTypeMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected