示例#1
0
 def _to_field(self, name, value, parent, little_endian=False):
     field_name, field_value = self._encode_value(
         value, parent, little_endian=little_endian)
     return BinaryField(self.length.value,
                        self._get_name(name),
                        field_name,
                        field_value,
                        little_endian=little_endian)
示例#2
0
 def _create_field(self, bin_str, data_index, field):
     return BinaryField(field.length.value, field.name,
                        self._binary_substring(bin_str, data_index, field))
示例#3
0
 def _bin_container(self, little_endian=False):
     cont = BinaryContainer('foo', little_endian=little_endian)
     cont['three'] = BinaryField(3, 'three', to_bin('0b101'))
     cont['six'] = BinaryField(6, 'six', to_bin('0b101010'))
     cont['seven'] = BinaryField(7, 'seven', to_bin('0b0101010'))
     return cont