summaryrefslogtreecommitdiffstats
path: root/libs/tiny_struct/struct.py
blob: 927bba3ba1750d5918b7c6f7352d353908b3b6cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from ustruct import *

error = ValueError

class Struct(object):
	def __init__(self, format):
		self.format = format
		self.size = calcsize(format)

	def pack(self, *x):
		return pack(self.format, *x)

	def unpack(self, buffer):
		return unpack(self.format, buffer)

	def unpack_from(self, buffer, offset=0):
		return unpack_from(self.format, buffer, offset)
bues.ch cgit interface