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

6 statements  

« prev     ^ index     » next       coverage.py v7.0.5, created at 2023-01-17 06:27 +0000

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 

11 

12def set_module(module): 

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

14 

15 Example usage:: 

16 

17 @set_module('numpy') 

18 def example(): 

19 pass 

20 

21 assert example.__module__ == 'numpy' 

22 """ 

23 def decorator(func): 

24 if module is not None: 

25 func.__module__ = module 

26 return func 

27 return decorator