unienv_interface.utils.symbol_util¶
Functions:
| Name | Description |
|---|---|
get_full_class_name |
|
get_class_from_full_name |
|
get_full_function_name |
Get the full name of a function for serialization. |
get_function_from_full_name |
Get a function from its full name ( |
serialize_function |
Serialize a function to a JSON-compatible dictionary. |
deserialize_function |
Deserialize a function from a JSON-compatible dictionary. |
REMAP
module-attribute
¶
REMAP = {
"unienv_data.storages.common.FlattenedStorage": "unienv_data.storages.flattened.FlattenedStorage"
}
get_full_function_name
¶
Get the full name of a function for serialization.
get_function_from_full_name
¶
Get a function from its full name (module.qualname, qualname may be nested).
serialize_function
¶
Serialize a function to a JSON-compatible dictionary.
Tries to serialize by full name first. If the function doesn't have a proper module name (e.g., lambda, local function), uses cloudpickle + base64.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
Contains either: - {"mode": "name", "value": "full.module.name"} - {"mode": "pickle", "value": "base64_encoded_pickle"} |
deserialize_function
¶
Deserialize a function from a JSON-compatible dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Mapping[str, Any]
|
Mapping containing the serialized function with "mode" and "value" keys. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Callable |
Callable
|
The deserialized function. |