MCPcopy
hub / github.com/dabeaz/python-cookbook / wrapper

Function wrapper

src/9/defining_decorators_as_classes/example2.py:7–10  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

5 ncalls = 0
6 @wraps(func)
7 def wrapper(*args, **kwargs):
8 nonlocal ncalls
9 ncalls += 1
10 return func(*args, **kwargs)
11 wrapper.ncalls = lambda: ncalls
12 return wrapper
13

Callers

nothing calls this directly

Calls 1

funcFunction · 0.50

Tested by

no test coverage detected