Skip to content
SR-Forge

Deprecation Utilities

Tools for handling deprecated functions and classes.

deprecated_class(old_name: str, new_cls: type) -> type

Create a deprecated class alias that warns on instantiation.

This function creates a new class that inherits from new_cls but issues a DeprecationWarning when it's initialized. The alias will have the old_name and can be used with isinstance checks as if it were the new class.

Parameters:

Name Type Description Default
old_name str

The name for the new deprecated class alias.

required
new_cls type

The new, non-deprecated class to wrap.

required

Returns:

Name Type Description
type type

A new class type that serves as a deprecated alias for new_cls.