Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_convertions.py19 linesDownload Raw Back to _utils
1"""
2A set of methods retained from np.compat module that
3are still used across codebase.
4"""
5
6__all__ = ["asunicode", "asbytes"]
7
8
9def asunicode(s):
10    if isinstance(s, bytes):
11        return s.decode('latin1')
12    return str(s)
13
14
15def asbytes(s):
16    if isinstance(s, bytes):
17        return s
18    return str(s).encode('latin1')
19 
codekingpro/portable-devtools · Team Ai