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

Method encode

pager_lib/pyasn1/codec/native/encoder.py:77–90  ·  view source on GitHub ↗
(self, value, encodeFun, **options)

Source from the content-addressed store, hash-verified

75 protoDict = dict
76
77 def encode(self, value, encodeFun, **options):
78 inconsistency = value.isInconsistent
79 if inconsistency:
80 raise error.PyAsn1Error(
81 f"ASN.1 object {value.__class__.__name__} is inconsistent")
82
83 namedTypes = value.componentType
84 substrate = self.protoDict()
85
86 for idx, (key, subValue) in enumerate(value.items()):
87 if namedTypes and namedTypes[idx].isOptional and not value[idx].isValue:
88 continue
89 substrate[key] = encodeFun(subValue, **options)
90 return substrate
91
92
93class SequenceEncoder(SetEncoder):

Callers 8

__call__Method · 0.45
prettyInMethod · 0.45
__bytes__Method · 0.45
__init__Method · 0.45
queryMethod · 0.45
_execute_commandMethod · 0.45
_do_execute_manyMethod · 0.45

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected