Ejemplo n.º 1
0
class Garzon(h.Struct):
    arr = h.Array(field_type=h.UInt8(3), length=3, value=(1, 2), fill=True)
    nested_vla_len = h.UInt16()
    nested_vla = h.Vector(field_type=h.Int32(),
                          length=nested_vla_len,
                          value=(9, 10, 100))
    x = h.UInt8(5)
Ejemplo n.º 2
0
    class Ronen(h.Struct):
        x = h.UInt8(2)
        arr = h.Array(10, h.FieldPlaceholder, value=list(range(10)))

        @h.Struct.from_bytes_hook(arr)
        def foo(self):
            self.arr.type = h.UInt16()
Ejemplo n.º 3
0
class Shine(h.Struct):
    arr = h.Array(field_type=h.UInt8(3), length=3, value=(1, 2), fill=True)
    vec_len = h.UInt8()
    vec = h.Vector(field_type=h.UInt8(), length=vec_len)
    y = h.UInt64(9)
    z_len = h.UInt8()
    z = h.Vector(field_type=Garzon(), length=z_len, value=[
        Garzon(nested_vla=(11, 12, 13, 14, 15)), Garzon(arr=(9,)), Garzon()])
    vec2_len = h.UInt8()
    vec2 = h.Vector(field_type=h.UInt32(), length=vec2_len, value=(53, 99, 123))
    x = h.UInt16(104)
Ejemplo n.º 4
0
 class Hand(h.Struct):
     cards = h.Array(5, Card)
Ejemplo n.º 5
0
 class C(h.Struct):
     x = h.Array(5)
     y = h.UInt8
Ejemplo n.º 6
0
class Lior(h.Struct):
    a = h.Array(5, fill=True)
Ejemplo n.º 7
0
 class T(h.Struct):
     x = h.InclusiveLengthField(h.UInt8)
     y = h.Array(10, fill=True)
Ejemplo n.º 8
0
 class Shustin2(h.Struct):
     arr = h.Array(3, h.UInt8(8), validator=lambda x: x > 9, fill=True)
Ejemplo n.º 9
0
class Isaac(h.Struct):
    arr = h.Array(field_type=h.UInt8(3), length=3, value=(1, 2), fill=True)
    x = h.UInt8(5)
Ejemplo n.º 10
0
 class Data(h.Struct):
     data = h.Array(10)
Ejemplo n.º 11
0
class Yakov(h.Struct):
    arr = h.Array(3)
Ejemplo n.º 12
0
 class Raif(h.Struct):
     a = h.Array(5, h.UInt16(1))
Ejemplo n.º 13
0
 class Raif(h.Struct):
     a = h.Array(5, h.UInt16(), fill=True)
Ejemplo n.º 14
0
 class Lior(h.Struct):
     a = h.Array(5, h.UInt16, fill=True)
Ejemplo n.º 15
0
 class Good(h.Struct):
     i32 = h.Int32(5, validator=lambda z: z > 4)
     i32_range = h.Int32(14, validator=range(0, 30, 2))
     i32_set = h.Int32(2, validator={1, 2, 3})
     i32_arr = h.Array(length=5, field_type=h.UInt8(5), validator=5)