GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

_libmuprivpython3.py 481 Bytes
Newer Older
Kunshan Wang's avatar
Kunshan Wang committed
1 2 3 4 5
from _libmuprivcommon import _assert_instance

def _is_str_like(v):
    return isinstance(v, str) or isinstance(v, bytes)

6
def _encode(v, encoding):
Kunshan Wang's avatar
Kunshan Wang committed
7 8
    _assert_instance(v, bytes, str)
    if isinstance(v, str):
9
        return v.encode(encoding)
Kunshan Wang's avatar
Kunshan Wang committed
10 11 12
    else:
        return v

13
def _decode(v, encoding):
Kunshan Wang's avatar
Kunshan Wang committed
14 15
    _assert_instance(v, bytes, str)
    if isinstance(v, bytes):
16
        return v.decode(encoding)
Kunshan Wang's avatar
Kunshan Wang committed
17 18 19 20 21
    else:
        return v

def _assert_int_like(v):
    _assert_instance(v, int)