AIM-PIbd-32-Kurbanova-A-A/aimenv/Lib/site-packages/numpy/_utils/_convertions.py

19 lines
329 B
Python
Raw Normal View History

2024-10-02 22:15:59 +04:00
"""
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')