Decorators
File 12 appendix/decorator.py
File 13 appendix/decorated.py
import inspect
from appendix.decorated import func_with_wraps, func_without_wraps
funcs = [func_with_wraps, func_without_wraps]
for func in funcs:
sourcefile = inspect.getsourcefile(func)
is_wrapped = hasattr(func, '__wrapped__')
print(f"[{func.__name__}]: {sourcefile}, {is_wrapped}")
[1] 2020-12-20 11:36:14 (93.8ms) python3 (1.47s)
[func_with_wraps]: ../../examples\appendix\decorator.py, True
[_func]: ../../examples\appendix\decorator.py, False
module
appendix.decorated
Decorator examples.
Functions
fixture
(
)
— Fixture.fixture_with_wraps
(
)
— Fixture.func_with_wraps
(
)
— Decorated function withwraps
.func_with_wraps_double
(
)
— Doubly decorated function withwraps
.
function
appendix.decorated.
func_with_wraps
(
)
Decorated function with wraps
.
function
appendix.decorated.
func_with_wraps_double
(
)
Doubly decorated function with wraps
.
generator
appendix.decorated.
fixture
(
)
Fixture.
generator
appendix.decorated.
fixture_with_wraps
(
)
Fixture.