pastas.decorators.deprecate_args_or_kwargs#

pastas.decorators.deprecate_args_or_kwargs(name: str, version: str, reason: str = '') None#

Provide a warning or error when a function argument is deprecated.

This function raises errors or warnings based on the current Pastas version and the deprecation timeline. The behavior is:

  • If current version < version: logs a warning

  • If current version >= version: raises TypeError which indicates that it can be

removed from the codebase entirely in the (near) future.

Parameters:
  • name (str) – The name of the argument that is deprecated.

  • version (str) – The version in which using the argument will raise a TypeError.

  • reason (str, optional) – The reason why the argument is deprecated, or a message directing users to an alternative. Default is an empty string.

Raises:
  • DeprecationWarning – If current version < version and the argument is used.

  • TypeError – If current version >= version and the argument is used.