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

Class SetEncoder

pager_lib/pyasn1/codec/native/encoder.py:74–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72
73
74class SetEncoder(AbstractItemEncoder):
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 1

encoder.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected