Skip to content

Allow infinite waring

Compare
Choose a tag to compare
@Borda Borda released this 21 Mar 22:30
· 77 commits to main since this release

Allow infinite waring raising.

from deprecate import deprecated

@deprecated(
  target=None, deprecated_in="0.1", remove_in="0.5",
  # number or warnings per lifetime (with -1 for always)
  num_warns=5
)
def my_sum(a: int, b: int = 5) -> int:
    """My deprecated function which still has to have implementation."""
    return a + b

# call this function will raise deprecation warning:
#   The `my_sum` was deprecated since v0.1. It will be removed in v0.5.
print(my_sum(1, 2))