CommonVariableMetadata#
- class CommonVariableMetadata#
Bases: abc.ABC
Provides metadata common to all variables.
Overview#
Invoke the visitor pattern of this object using the passed-in visitor |
Determine if the object is equal to the metadata. |
|
Get a deep copy of the metadata. |
|
Get the default value that should be used for a variable described by this |
|
Convert the value of the variable to the appropriate type for this metadata. |
Description of the variable. |
|
Custom metadata stored in a dictionary. |
|
Variable type of the object. |
Determine if the object is equal to the metadata. |
Import detail#
from ansys.tools.variableinterop.common_variable_metadata import CommonVariableMetadata
Property detail#
- property CommonVariableMetadata.custom_metadata: Dict[str, ansys.tools.variableinterop.variable_value.IVariableValue]#
Custom metadata stored in a dictionary.
- property CommonVariableMetadata.variable_type: VariableType#
- Abstractmethod:
Variable type of the object.
- Returns:
VariableType
Variable type of the object.
Method detail#
- CommonVariableMetadata.__eq__(other)#
Determine if the object is equal to the metadata.
- CommonVariableMetadata.equals(other: Any) bool #
Determine if the object is equal to the metadata.
- Parameters:
- other
Any
Other object to compare this object to.
- other
- Returns:
- bool
True
if the metadata objects are equal,False
otherwise.
- CommonVariableMetadata.clone() CommonVariableMetadata #
Get a deep copy of the metadata.
- abstract CommonVariableMetadata.accept(visitor: ansys.tools.variableinterop.ivariablemetadata_visitor.IVariableMetadataVisitor[ansys.tools.variableinterop.ivariablemetadata_visitor.T]) ansys.tools.variableinterop.ivariablemetadata_visitor.T #
Invoke the visitor pattern of this object using the passed-in visitor implementation.
- Parameters:
- visitor
IVariableMetadataVisitor
[T
] Visitor object to call.
- visitor
- Returns:
T
Results of the visitor invocation.
- CommonVariableMetadata.get_default_value() ansys.tools.variableinterop.variable_value.IVariableValue #
Get the default value that should be used for a variable described by this metadata.
The metadata may have set the lower bound, upper bound, or enumerated values, which restricts what values are valid. This method selects a valid default value.
If the type’s default value (such as
0
or an empty string) is a valid value for the metadata, use it.If the metadata has enumerated values, select the first enumerated value that is valid per the other restrictions.
If the metadata has a lower bound and it is valid, use it.
If metadata does not have a lower bound but does have an upper bound, use the upper bound.
If no value is valid, use the type’s default value.
- CommonVariableMetadata.runtime_convert(source: ansys.tools.variableinterop.variable_value.IVariableValue) ansys.tools.variableinterop.variable_value.IVariableValue #
Convert the value of the variable to the appropriate type for this metadata.
- Parameters:
- source
IVariableValue
Value to convert
- source
- Returns:
IVariableValue
Value converted to the appropriate type.