mistral_common.deprecation
deprecated_import(old_path, new_module, name, version)
Warn once and lazily import a symbol that moved to a new module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old_path
|
str
|
The old module path (e.g. |
required |
new_module
|
str
|
The new module path (e.g. |
required |
name
|
str
|
The symbol name (e.g. |
required |
version
|
str
|
The version in which the symbol will be removed. |
required |
Returns:
| Type | Description |
|---|---|
object
|
The imported symbol from the new module. |
Source code in src/mistral_common/deprecation.py
warn_once(key, message, category, stacklevel)
Emit a warning only on the first call for a given key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Unique identifier for this warning. |
required |
message
|
str
|
The warning message. |
required |
category
|
type[Warning]
|
The warning category class. |
required |
stacklevel
|
int
|
Stack level for the warning. |
required |