Skip to content

API Reference

The examples below are rendered directly from the demo module included in this documentation tree. Functions use @deprecated(update_docstring=True) and classes use deprecated_class(update_docstring=True), so you can see exactly how the injected notice looks once rendered.


Deprecated function with deprecated argument

old_add_with_verbose is deprecated and has one argument (verbose) that has been removed. Both the inline argument annotation and the general deprecation notice are injected into the docstring.

demo.old_add_with_verbose(x, y, verbose=False)

Add two integers, formerly with optional logging (legacy).

The verbose argument has been removed; the function itself is also deprecated in favour of new_add.

Parameters:

Name Type Description Default
x int

First operand.

required
y int

Second operand.

required
verbose bool

Deprecated — logging is no longer supported. Deprecated since v1.0 — no longer used. Will be removed in v2.0.

False

Returns:

Type Description
int

The sum of x and y.

Deprecated in 1.0

Will be removed in 2.0. Use demo.new_add instead.


Deprecated class

OldCalculator is deprecated in favour of NewCalculator. The deprecation notice is injected into __init__'s docstring.

demo.OldCalculator

Legacy calculator — use NewCalculator instead.

Deprecated in 1.0

Will be removed in 2.0. Use demo.NewCalculator instead.

__init__(precision=2)

Initialize OldCalculator.

Parameters:

Name Type Description Default
precision int

Number of decimal places to round to.

2

add(x, y)

Return the sum of two numbers.

Parameters:

Name Type Description Default
x float

First operand.

required
y float

Second operand.

required

Returns:

Type Description
float

Rounded sum.