MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / deprecated

Function deprecated

utils/deprecated.py:5–17  ·  view source on GitHub ↗

This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used.

(func)

Source from the content-addressed store, hash-verified

3
4
5def deprecated(func):
6 """This is a decorator which can be used to mark functions
7 as deprecated. It will result in a warning being emitted
8 when the function is used."""
9 @functools.wraps(func)
10 def new_func(*args, **kwargs):
11 warnings.simplefilter('always', DeprecationWarning) # turn off filter
12 warnings.warn("Call to deprecated function {}.".format(func.__name__),
13 category=DeprecationWarning,
14 stacklevel=2)
15 warnings.simplefilter('default', DeprecationWarning) # reset filter
16 return func(*args, **kwargs)
17 return new_func

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected