serialize
¶
Functions:
Name | Description |
---|---|
load_class |
Load a class from a string path |
frozen |
Convert the instance to a frozen instance |
object_hook |
Convert the dictionary to an instance |
loads |
Deserialize the JSON string to an instance |
to_dict_with_class_info |
Convert the instance to a dictionary with class information |
dumps |
Serialize the instance to a JSON string |
load_class
¶
load_class(path: str, strict: bool = True) -> Any
Load a class from a string path
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
The path to the class. |
required |
strict
|
bool
|
If True, raise an error if the class is not in ffmpeg package. |
True
|
Returns:
Type | Description |
---|---|
Any
|
The class. |
frozen
¶
frozen(v: Any) -> Any
Convert the instance to a frozen instance
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v
|
Any
|
The instance to convert. |
required |
Returns:
Type | Description |
---|---|
Any
|
The frozen instance. |
object_hook
¶
object_hook(obj: Any, strict: bool = True) -> Any
Convert the dictionary to an instance
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
Any
|
The dictionary to convert. |
required |
Returns:
Type | Description |
---|---|
Any
|
The instance. |
loads
¶
loads(raw: str, strict: bool = True) -> Any
Deserialize the JSON string to an instance
Parameters:
Name | Type | Description | Default |
---|---|---|---|
raw
|
str
|
The JSON string to deserialize. |
required |
Returns:
Type | Description |
---|---|
Any
|
The deserialized instance. |
to_dict_with_class_info
¶
to_dict_with_class_info(instance: Any) -> Any
Convert the instance to a dictionary with class information
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance
|
Any
|
The instance to convert. |
required |
Returns:
Type | Description |
---|---|
Any
|
The dictionary with class information |
dumps
¶
dumps(instance: Any) -> str
Serialize the instance to a JSON string
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance
|
Any
|
The instance to serialize. |
required |
Returns:
Type | Description |
---|---|
str
|
The serialized instance. |