Artifact 22ae6bac876902d9ba6264dc828d19c0f3c425f6:
- File gluon/contrib/pymysql/util.py — part of check-in [eba4a35a21] at 2011-08-08 04:53:38 on branch develop — Added web2py 1.98.2 (user: spiffy, size: 329) [annotate] [blame] [check-ins using]
import struct def byte2int(b): if isinstance(b, int): return b else: return struct.unpack("!B", b)[0] def int2byte(i): return struct.pack("!B", i) def join_bytes(bs): if len(bs) == 0: return "" else: rv = bs[0] for b in bs[1:]: rv += b return rv