mirror of
http://forgejo.openclaw.svc.cluster.local:3000/mrhavens/intellecton.git
synced 2026-06-18 01:22:57 +00:00
18 lines
329 B
Python
18 lines
329 B
Python
|
|
"""
|
||
|
|
A set of methods retained from np.compat module that
|
||
|
|
are still used across codebase.
|
||
|
|
"""
|
||
|
|
|
||
|
|
__all__ = ["asunicode", "asbytes"]
|
||
|
|
|
||
|
|
|
||
|
|
def asunicode(s):
|
||
|
|
if isinstance(s, bytes):
|
||
|
|
return s.decode('latin1')
|
||
|
|
return str(s)
|
||
|
|
|
||
|
|
|
||
|
|
def asbytes(s):
|
||
|
|
if isinstance(s, bytes):
|
||
|
|
return s
|
||
|
|
return str(s).encode('latin1')
|