Artifact 43d79c2f5e31b15c8e77d8051fc119bb785a647e:
- File gluon/contrib/pymysql/util.py — part of check-in [5e6e1e2c0a] at 2011-11-20 05:28:20 on branch feature/web2py_auth — Upgraded to web2py 1.99.2 (user: spiffy, size: 330) [annotate] [blame] [check-ins using] [more...]
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