The api_serialization.py
module#
Summary#
Visits values and converts them to an API string. |
Convert a variable value to an API string. |
|
Generate a value from an API string. |
Description#
Defines the ToAPIStringVisitor
class.
Module detail#
- api_serialization.to_api_string(value: ansys.tools.variableinterop.variable_value.IVariableValue, save_context: ansys.tools.variableinterop.isave_context.ISaveContext | None = None) str #
Convert a variable value to an API string.
- Parameters:
- value
IVariableValue
Value to convert to an API string.
- save_context
Optional
[ISaveContext
],optional
Save context to use for conversion. The default value is
None
, which indicates that you do not want to support file values.
- value
- Returns:
str
Serialized form of the value.
- api_serialization.from_api_string(var_type: ansys.tools.variableinterop.variable_type.VariableType, source: str, fscope: ansys.tools.variableinterop.file_scope.FileScope | None = None, load_context: ansys.tools.variableinterop.isave_context.ILoadContext | None = None) ansys.tools.variableinterop.variable_value.IVariableValue #
Generate a value from an API string.
- Parameters:
- var_type
VariableType
Variable type to generate.
- source
str
Source string.
- fscope
Optional
[FileScope
],optional
File scope to use to deserialize file variables. The default is
None
, which indictates that file variables are not needed.- load_context
Optional
[ILoadContext
],optional
Load context to read file contents from. The default is
None
, which indicates file variables are not needed.
- var_type
- Returns:
IVariableValue
Implementation of
IVariableValue
of the correct type with a value parsed from the specified string.