Lines Matching refs:self
27 def __init__(self, msg):
28 self.msg = msg
29 def __repr__(self):
30 return repr(self.msg)
31 def __str__(self):
32 return str(self.msg)
42 def result(self, value):
44 return function(self, value)
53 def __init__(self):
54 self.reset()
56 def reset(self):
57 self.__buf = BytesIO()
59 def get_buffer(self):
60 return self.__buf.getvalue()
65 def pack_uint(self, x):
66 self.__buf.write(struct.pack('>L', x))
69 def pack_int(self, x):
70 self.__buf.write(struct.pack('>l', x))
74 def pack_bool(self, x):
75 if x: self.__buf.write(b'\0\0\0\1')
76 else: self.__buf.write(b'\0\0\0\0')
78 def pack_uhyper(self, x):
80 self.pack_uint(x>>32 & 0xffffffff)
84 self.pack_uint(x & 0xffffffff)
91 def pack_float(self, x):
92 self.__buf.write(struct.pack('>f', x))
95 def pack_double(self, x):
96 self.__buf.write(struct.pack('>d', x))
98 def pack_fstring(self, n, s):
104 self.__buf.write(data)
108 def pack_string(self, s):
110 self.pack_uint(n)
111 self.pack_fstring(n, s)
116 def pack_list(self, list, pack_item):
118 self.pack_uint(1)
120 self.pack_uint(0)
122 def pack_farray(self, n, list, pack_item):
128 def pack_array(self, list, pack_item):
130 self.pack_uint(n)
131 self.pack_farray(n, list, pack_item)
138 def __init__(self, data):
139 self.reset(data)
141 def reset(self, data):
142 self.__buf = data
143 self.__pos = 0
145 def get_position(self):
146 return self.__pos
148 def set_position(self, position):
149 self.__pos = position
151 def get_buffer(self):
152 return self.__buf
154 def done(self):
155 if self.__pos < len(self.__buf):
158 def unpack_uint(self):
159 i = self.__pos
160 self.__pos = j = i+4
161 data = self.__buf[i:j]
166 def unpack_int(self):
167 i = self.__pos
168 self.__pos = j = i+4
169 data = self.__buf[i:j]
176 def unpack_bool(self):
177 return bool(self.unpack_int())
179 def unpack_uhyper(self):
180 hi = self.unpack_uint()
181 lo = self.unpack_uint()
184 def unpack_hyper(self):
185 x = self.unpack_uhyper()
190 def unpack_float(self):
191 i = self.__pos
192 self.__pos = j = i+4
193 data = self.__buf[i:j]
198 def unpack_double(self):
199 i = self.__pos
200 self.__pos = j = i+8
201 data = self.__buf[i:j]
206 def unpack_fstring(self, n):
209 i = self.__pos
211 if j > len(self.__buf):
213 self.__pos = j
214 return self.__buf[i:i+n]
218 def unpack_string(self):
219 n = self.unpack_uint()
220 return self.unpack_fstring(n)
225 def unpack_list(self, unpack_item):
228 x = self.unpack_uint()
236 def unpack_farray(self, n, unpack_item):
242 def unpack_array(self, unpack_item):
243 n = self.unpack_uint()
244 return self.unpack_farray(n, unpack_item)