Coverage for /usr/lib/python3/dist-packages/numpy/_utils/_convertions.py: 33%

9 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-14 15:55 +0200

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