BooleanValue#

class BooleanValue(source: object = None)#

Bases: ansys.tools.variableinterop.variable_value.IVariableValue

Stores a value as a BooleanValue variable type.

Overview#

accept

Invoke the visitor pattern of this object using the passed-in visitor

to_api_string

Convert the value to an API string.

to_real_value

Convert a given BooleanValue type to a RealValue type.

to_integer_value

Convert a given BooleanValue type to an IntegerValue type.

to_display_string

Convert the value to a formatted string.

variable_type

Variable type of the object.

api_str_to_bool

Mapping of acceptable normalized values for API string conversion to their

int64_to_bool

Convert a NumPy int64 type to a Boolean value per interchange

int_to_bool

Convert an integer to a Boolean value per interchange specifications.

float_to_bool

Convert a float value to a Boolean value per interchange specifications.

str_to_bool

Convert a string to a Boolean value per interchange specifications.

from_api_string

Convert an API string back into a BooleanValue type.

__add__

Magic method add.

__and__

Magic method and.

__bool__

Magic method bool.

__eq__

Return self==value.

__floordiv__

Magic method floordiv.

__gt__

Magic method gt.

__ge__

Magic method ge.

__hash__

Return hash(self).

__lshift__

Magic method lshift.

__mod__

Magic method mod.

__mul__

Magic method mul.

__ne__

Return self!=value.

__or__

Magic method or.

__pow__

Magic method pow.

__rshift__

Magic method rshift.

__str__

Return str(self).

__truediv__

Magic method truediv.

__xor__

Magic method xor.

Import detail#

from ansys.tools.variableinterop.scalar_values import BooleanValue

Property detail#

property BooleanValue.variable_type: VariableType#

Variable type of the object.

Returns:
VariableType

Variable type of the object.

Attribute detail#

BooleanValue.api_str_to_bool: Dict[str, bool]#

Mapping of acceptable normalized values for API string conversion to their corresponding Boolean value.

Method detail#

static BooleanValue.int64_to_bool(val: numpy.int64) bool#

Convert a NumPy int64 type to a Boolean value per interchange specifications.

static BooleanValue.int_to_bool(val: int) bool#

Convert an integer to a Boolean value per interchange specifications.

static BooleanValue.float_to_bool(val: float) bool#

Convert a float value to a Boolean value per interchange specifications.

static BooleanValue.str_to_bool(val: str) bool#

Convert a string to a Boolean value per interchange specifications.

BooleanValue.__add__(other)#

Magic method add.

BooleanValue.__and__(other)#

Magic method and.

BooleanValue.__bool__()#

Magic method bool.

BooleanValue.__eq__(other)#

Return self==value.

BooleanValue.__floordiv__(other)#

Magic method floordiv.

BooleanValue.__gt__(other)#

Magic method gt.

BooleanValue.__ge__(other)#

Magic method ge.

BooleanValue.__hash__()#

Return hash(self).

BooleanValue.__lshift__(other)#

Magic method lshift.

BooleanValue.__mod__(other)#

Magic method mod.

BooleanValue.__mul__(other)#

Magic method mul.

BooleanValue.__ne__(other)#

Return self!=value.

BooleanValue.__or__(other)#

Magic method or.

BooleanValue.__pow__(other)#

Magic method pow.

BooleanValue.__rshift__(other)#

Magic method rshift.

BooleanValue.__str__()#

Return str(self).

BooleanValue.__truediv__(other)#

Magic method truediv.

BooleanValue.__xor__(other)#

Magic method xor.

BooleanValue.accept(visitor: ansys.tools.variableinterop.ivariable_visitor.IVariableValueVisitor[ansys.tools.variableinterop.ivariable_visitor.T]) ansys.tools.variableinterop.ivariable_visitor.T#

Invoke the visitor pattern of this object using the passed-in visitor implementation.

Parameters:
visitorIVariableValueVisitor

Visitor object to call.

Returns:
T

Results of the visitor invocation.

BooleanValue.to_api_string(context: ansys.tools.variableinterop.isave_context.ISaveContext | None = None) str#

Convert the value to an API string.

Returns:
str

String appropriate for use in files and APIs.

BooleanValue.to_real_value() RealValue#

Convert a given BooleanValue type to a RealValue type.

True is converted to 1.0, and False is converted to 0.0.

Returns:
RealValue

RealValue type with value representing the original BooleanValue type.

static BooleanValue.from_api_string(value: str) BooleanValue#

Convert an API string back into a BooleanValue type.

The conversion is performed according to the type interoperability specifications.

Values that are parseable as floating-point numbers are parsed in that manner and then converted to a BooleanValue type.

Values that are non-numeric are checked to see if they match any of the following values. The comparison is case-insensitive.

  • For True: "true", "yes", or "y".

  • For False: "false", "no", or "n".

Values not interpretable result in a ValueError.

Parameters:
valuestr

String to parse.

Returns:
BooleanValue

BooleanValue type parsed from the API string.

BooleanValue.to_integer_value() IntegerValue#

Convert a given BooleanValue type to an IntegerValue type.

True is converted to 1, and False is converted to 0.

Returns:
IntegerValue

IntegerValue type with the value representing the original BooleanValue type.

BooleanValue.to_display_string(locale_name: str) str#

Convert the value to a formatted string.

Parameters:
locale_namestr

Locale to format the string in.

Returns:
str

String appropriate for use in user-facing areas.