Skip to content
Construct PsiQDK Algorithms

deprecate

deprecate

deprecate

deprecate(until: str | None = None, warn_msg: str | None = None) -> Callable

Can be used to deprecate a function which should not be used anymore.

Parameters:

Name Type Description Default
until str | None

At what version is the old function location deprecated? Example: '3.0.0'

None
warn_msg str | None

Provide a specific warning message. Defaults to a generic message.

None

Returns:

Type Description
Callable

The wrapped function.

Example
@deprecate(until='3.0.0', warn_msg='some_func will be deprecated, use xxx instead')
def some_func(*args, **kwargs):
    pass

deprecate_location

deprecate_location(new_path: str, until: str | None = None, warn_msg: str | None = None) -> Callable

Can be used as a wrapper when moving a function to indicate that the current location will be deprecated.

Parameters:

Name Type Description Default
new_path str

import-path to the new function. Example: 'package.module.function'

required
until optional

At what version is the old function location deprecated? Example: '3.0.0'

None
warn_msg optional

A specific warning message to use.

None

Returns:

Type Description
callable

The wrapped function.

Example
@deprecate_location('new_module.some_func')
def some_func(*args, **kwargs):
    pass

get_deprecations_from

get_deprecations_from(version: str | None = None) -> Iterable[str]

Returns the deprecation decorators remaining after the specified version.

Note

Deprecations are only included if the module they live in is loaded.

Parameters:

Name Type Description Default
version str | None

include deprecations at and before this version. Example: '3.0.0' Default: include all deprecations.

None

Yields:

Type Description
str

The path to the deprecated function.