source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/gluon/contrib/pymysql/util.py

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100755
File size: 332 bytes
Line 
1import struct
2
3
4def byte2int(b):
5    if isinstance(b, int):
6        return b
7    else:
8        return struct.unpack("!B", b)[0]
9
10
11def int2byte(i):
12    return struct.pack("!B", i)
13
14
15def join_bytes(bs):
16    if len(bs) == 0:
17        return ""
18    else:
19        rv = bs[0]
20        for b in bs[1:]:
21            rv += b
22        return rv
Note: See TracBrowser for help on using the repository browser.