snakeoil.struct_compat module¶
Minor struct enhancements, and python version compatibility implementations
This is deprecated. Use struct, with s.unpack(fd.read(s.size))
and fd.write(s.pack(...)) in place of Struct.read and Struct.write.
- class snakeoil.struct_compat.Struct[source]¶
Bases:
StructStruct extension class adding read and write methods for handling files
- snakeoil.struct_compat.pack(format, v1, v2, ...) bytes¶
Return a bytes object containing the values v1, v2, … packed according to the format string. See help(struct) for more on format strings.
- snakeoil.struct_compat.unpack(format, buffer, /)¶
Return a tuple containing values unpacked according to the format string.
The buffer’s size in bytes must be calcsize(format).
See help(struct) for more on format strings.