Ejemplo n.º 1
0
 def DictToTLVWithWriter(self, debugPath: str, tag, data: Mapping, writer: tlv.TLVWriter):
     writer.startStructure(tag)
     for field in self.Fields:
         val = data.get(field.Label, None)
         field.PutFieldToTLV(field.Tag, val, writer,
                             debugPath + f'.{field.Label}')
     writer.endContainer()
Ejemplo n.º 2
0
 def DictToTLVWithWriter(self, debugPath: str, tag, data: Mapping,
                         writer: tlv.TLVWriter):
     writer.startStructure(tag)
     for field in self.Fields:
         val = data.get(field.Label, None)
         if val is None:
             raise ValueError(
                 f"Field {debugPath}.{field.Label} is missing in the given dict"
             )
         field.PutFieldToTLV(field.Tag, val, writer,
                             debugPath + f'.{field.Label}')
     writer.endContainer()