File: utils.py

package info (click to toggle)
python-asyncmy 0.2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 676 kB
  • sloc: python: 3,528; makefile: 40
file content (12 lines) | stat: -rw-r--r-- 178 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
from asyncmy.structs import B


def byte2int(b):
    if isinstance(b, int):
        return b
    else:
        return B.unpack(b)[0]


def int2byte(i: int):
    return B.pack(i)