ostk.core.container.Object¶
- class Object¶
Bases:
pybind11_objectMethods
Create an Object containing an array.
Create an Object containing a boolean value.
Create an Object containing a dictionary.
Get the array from the Object.
Get the boolean value from the Object.
Get the dictionary from the Object.
Get the integer value from the Object.
Get the real number value from the Object.
Get the string value from the Object.
Get the type of the Object.
Create an Object containing an integer value.
Check if the Object contains an array.
Check if the Object contains a boolean value.
Check if the Object is defined.
Check if the Object contains a dictionary.
Check if the Object contains an integer value.
Check if the Object contains a real number value.
Check if the Object contains a string value.
Load an Object from a file.
Parse a string as an Object.
Create an Object containing a real number value.
Create an Object containing a string value.
Get string representation of an Object type.
Convert the Object to a string representation.
Get Object type from string representation.
Create an undefined Object.
- class Format(self: ostk.core.container.Object.Format, value: int)¶
Bases:
pybind11_objectEnumeration of Object serialization formats.
Defines the supported formats for serializing/deserializing Objects.
Members:
Undefined : Undefined format
JSON : JSON format
YAML : YAML format
- property name¶
- class Type(self: ostk.core.container.Object.Type, value: int)¶
Bases:
pybind11_objectEnumeration of Object types.
Defines the different types that an Object can represent.
Members:
Undefined : Undefined object type
Boolean : Boolean object type
Integer : Integer object type
Real : Real number object type
String : String object type
Dictionary : Dictionary object type
Array : Array object type
- property name¶
- static array(array: list[ostk.core.container.Object]) ostk.core.container.Object¶
Create an Object containing an array.
- Parameters:
array (Array) -- The array.
- Returns:
An object containing the array.
- Return type:
- static boolean(boolean: bool) ostk.core.container.Object¶
Create an Object containing a boolean value.
- static dictionary(
- dictionary: ostk.core.container.Dictionary,
Create an Object containing a dictionary.
- Parameters:
dictionary (Dictionary) -- The dictionary.
- Returns:
An object containing the dictionary.
- Return type:
- get_array(self: ostk.core.container.Object) list[ostk.core.container.Object]¶
Get the array from the Object.
- Returns:
The array value.
- Return type:
Array
- Raises:
RuntimeError -- If the object is not an array.
- get_boolean(self: ostk.core.container.Object) bool¶
Get the boolean value from the Object.
- Returns:
The boolean value.
- Return type:
- Raises:
RuntimeError -- If the object is not a boolean.
- get_dictionary(
- self: ostk.core.container.Object,
Get the dictionary from the Object.
- Returns:
The dictionary value.
- Return type:
- Raises:
RuntimeError -- If the object is not a dictionary.
- get_integer(self: ostk.core.container.Object) ostk.core.type.Integer¶
Get the integer value from the Object.
- Returns:
The integer value.
- Return type:
- Raises:
RuntimeError -- If the object is not an integer.
- get_real(self: ostk.core.container.Object) ostk.core.type.Real¶
Get the real number value from the Object.
- Returns:
The real number value.
- Return type:
- Raises:
RuntimeError -- If the object is not a real number.
- get_string(self: ostk.core.container.Object) ostk.core.type.String¶
Get the string value from the Object.
- Returns:
The string value.
- Return type:
- Raises:
RuntimeError -- If the object is not a string.
- get_type(self: ostk.core.container.Object) ostk.core.container.Object.Type¶
Get the type of the Object.
- Returns:
The type of the object.
- Return type:
- static integer(integer: ostk.core.type.Integer) ostk.core.container.Object¶
Create an Object containing an integer value.
- is_array(self: ostk.core.container.Object) bool¶
Check if the Object contains an array.
- Returns:
True if the object is an array, False otherwise.
- Return type:
- is_boolean(self: ostk.core.container.Object) bool¶
Check if the Object contains a boolean value.
- Returns:
True if the object is a boolean, False otherwise.
- Return type:
- is_defined(self: ostk.core.container.Object) bool¶
Check if the Object is defined.
- Returns:
True if the object is defined, False otherwise.
- Return type:
- is_dictionary(self: ostk.core.container.Object) bool¶
Check if the Object contains a dictionary.
- Returns:
True if the object is a dictionary, False otherwise.
- Return type:
- is_integer(self: ostk.core.container.Object) bool¶
Check if the Object contains an integer value.
- Returns:
True if the object is an integer, False otherwise.
- Return type:
- is_real(self: ostk.core.container.Object) bool¶
Check if the Object contains a real number value.
- Returns:
True if the object is a real number, False otherwise.
- Return type:
- is_string(self: ostk.core.container.Object) bool¶
Check if the Object contains a string value.
- Returns:
True if the object is a string, False otherwise.
- Return type:
- static load(
- file: ostk.core.filesystem.File,
- format: ostk.core.container.Object.Format,
Load an Object from a file.
- Parameters:
file (File) -- The file to load from.
format (Object.Format) -- The format of the file content.
- Returns:
The loaded object.
- Return type:
- Raises:
RuntimeError -- If the file cannot be loaded or parsed.
- static parse(
- string: ostk.core.type.String,
- format: ostk.core.container.Object.Format,
Parse a string as an Object.
- Parameters:
string (str) -- The string to parse.
format (Object.Format) -- The format of the string (JSON or YAML).
- Returns:
The parsed object.
- Return type:
- Raises:
RuntimeError -- If the string cannot be parsed.
- static real(real: ostk.core.type.Real) ostk.core.container.Object¶
Create an Object containing a real number value.
- static string(string: ostk.core.type.String) ostk.core.container.Object¶
Create an Object containing a string value.
- static string_from_type(type: ostk.core.container.Object.Type) ostk.core.type.String¶
Get string representation of an Object type.
- Parameters:
type (Object.Type) -- The object type.
- Returns:
String representation of the type.
- Return type:
- to_string(
- self: ostk.core.container.Object,
- format: ostk.core.container.Object.Format,
Convert the Object to a string representation.
- Parameters:
format (Object.Format) -- The output format (JSON or YAML).
- Returns:
String representation of the object.
- Return type:
- static type_from_string(
- string: ostk.core.type.String,
Get Object type from string representation.
- Parameters:
string (str) -- String representation of the type.
- Returns:
The object type.
- Return type:
- static undefined() ostk.core.container.Object¶
Create an undefined Object.
- Returns:
An undefined object.
- Return type: