You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now we've lost track of deprecated functions. See #111
importwarningsimportfunctools__version__="0.1.1"defdeprecate(*, start: str, removed: str):
if__version__>=removed:
raiseRuntimeError(f"After incrementing version {__version__} this function has to be removed")
else:
defwrapper(fn):
@functools.wraps(fn)defwrapped_fn(*args, **kwargs):
warnings.warn(f"This function is deprecated in version {start} and "f"will be removed at version {removed}. Current version is {__version__}.", DeprecationWarning)
returnfn(*args, **kwargs)
returnwrapped_fnreturnwrapper
/var/folders/rx/rk9gm4ln35z802s3p81wfz8r0000gp/T/ipykernel_10024/2831940282.py:9: DeprecationWarning: This function is deprecated in version 0.0.1 and will be removed at version 1.1.1. Current version is 0.1.1.
warnings.warn(f"This function is deprecated in version {start} and "
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In [19], line 1
----> 1 @deprecate(start="0.0.1", removed="0.1.1")
2 def add(x, y):
3 return x + y
Cell In [16], line 4, in deprecate(start, removed)
2 def deprecate(*, start: str, removed: str):
3 if __version__ >= removed:
----> 4 raise RuntimeError(f"After incrementing version {__version__} this function has to be removed")
5 else:
6 def wrapper(fn):
RuntimeError: After incrementing version 0.1.1 this function has to be removed
Description
Right now we've lost track of deprecated functions. See #111
gives
And during increment version PR
For flexibility we can build similar thing on top of
https://borda.github.io/pyDeprecate/
The text was updated successfully, but these errors were encountered: