Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/numpy/_utils/__init__.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

7 statements  

1""" 

2This is a module for defining private helpers which do not depend on the 

3rest of NumPy. 

4 

5Everything in here must be self-contained so that it can be 

6imported anywhere else without creating circular imports. 

7If a utility requires the import of NumPy, it probably belongs 

8in ``numpy.core``. 

9""" 

10 

11from ._convertions import asunicode, asbytes 

12 

13 

14def set_module(module): 

15 """Private decorator for overriding __module__ on a function or class. 

16 

17 Example usage:: 

18 

19 @set_module('numpy') 

20 def example(): 

21 pass 

22 

23 assert example.__module__ == 'numpy' 

24 """ 

25 def decorator(func): 

26 if module is not None: 

27 func.__module__ = module 

28 return func 

29 return decorator