graflo._compat¶
Deprecation helpers for graflo's own public API.
A name or config key is deprecated in a minor release and removed in the next major; every warning names both versions and the replacement.
Example
@deprecated(since="1.19.0", removed_in="2.0.0", use="new_fn") ... def old_fn(): ...
Inside a mode="before" model validator::
data = rename_key(data, "old", "new", owner="Resource",
since="1.19.0", removed_in="2.0.0")
Attributes¶
P = ParamSpec('P')
module-attribute
¶
R = TypeVar('R')
module-attribute
¶
Functions:¶
deprecated(*, since, removed_in, use=None)
¶
Mark a function or method deprecated; each call warns at the caller.
Source code in graflo/_compat.py
rename_key(data, old, new, *, owner, since, removed_in)
¶
Move a renamed config key to its new name, warning when the old one is used.
Meant for a mode="before" validator: non-dict input passes through. Setting
both names is an error, since the two values could disagree.
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
Source code in graflo/_compat.py
warn_deprecated(what, *, since, removed_in, use=None, stacklevel=2)
¶
Emit a DeprecationWarning for what.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
what
|
str
|
The deprecated name, as a user would write it. |
required |
since
|
str
|
The graflo version that deprecated it. |
required |
removed_in
|
str
|
The graflo version that removes it. |
required |
use
|
str | None
|
The replacement, if there is one. |
None
|
stacklevel
|
int
|
Frames above the caller to attribute the warning to. |
2
|