Пример #1
0
    st.float64: lambda x: not_implemented(),
    st.unit: lambda x: b"",
    st.char: lambda x: not_implemented(),
    str: lambda x: encode_str(x),
    bytes: lambda x: encode_bytes(x),
}

primitive_decode_map = {
    st.bool:
    lambda content: (
        st.bool(int.from_bytes(content[:1], byteorder="little", signed=False)),
        content[1:],
    ),
    st.uint8:
    lambda content: (
        st.uint8(int.from_bytes(content[:1], byteorder="little", signed=False)
                 ),
        content[1:],
    ),
    st.uint16:
    lambda content: (
        st.uint16(int.from_bytes(content[:2], byteorder="little", signed=False)
                  ),
        content[2:],
    ),
    st.uint32:
    lambda content: (
        st.uint32(int.from_bytes(content[:4], byteorder="little", signed=False)
                  ),
        content[4:],
    ),
    st.uint64:
Пример #2
0
def make_address(content: bytes) -> libra.AccountAddress:
    assert len(content) == 16
    # pyre-fixme
    return libra.AccountAddress(value=tuple(st.uint8(x) for x in content))
Пример #3
0
 def deserialize_u8(self) -> st.uint8:
     return st.uint8(int.from_bytes(self.read(1), byteorder="little", signed=False))
Пример #4
0
def make_address(content: bytes) -> starcoin.AccountAddress:
    assert len(content) == 16
    # pyre-fixme
    return starcoin.AccountAddress(tuple(st.uint8(x) for x in content))