wg-backend-django/dell-env/lib/python3.11/site-packages/numpy/_utils/_convertions.py
2023-10-30 14:40:43 +07:00

19 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')