ostk.core.container.Object

class Object

Bases: pybind11_object

Methods

array

Create an Object containing an array.

boolean

Create an Object containing a boolean value.

dictionary

Create an Object containing a dictionary.

get_array

Get the array from the Object.

get_boolean

Get the boolean value from the Object.

get_dictionary

Get the dictionary from the Object.

get_integer

Get the integer value from the Object.

get_real

Get the real number value from the Object.

get_string

Get the string value from the Object.

get_type

Get the type of the Object.

integer

Create an Object containing an integer value.

is_array

Check if the Object contains an array.

is_boolean

Check if the Object contains a boolean value.

is_defined

Check if the Object is defined.

is_dictionary

Check if the Object contains a dictionary.

is_integer

Check if the Object contains an integer value.

is_real

Check if the Object contains a real number value.

is_string

Check if the Object contains a string value.

load

Load an Object from a file.

parse

Parse a string as an Object.

real

Create an Object containing a real number value.

string

Create an Object containing a string value.

string_from_type

Get string representation of an Object type.

to_string

Convert the Object to a string representation.

type_from_string

Get Object type from string representation.

undefined

Create an undefined Object.

class Format(self: ostk.core.container.Object.Format, value: int)

Bases: pybind11_object

Enumeration 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_object

Enumeration 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:

Object

static boolean(boolean: bool) ostk.core.container.Object

Create an Object containing a boolean value.

Parameters:

boolean (bool) -- The boolean value.

Returns:

An object containing the boolean.

Return type:

Object

static dictionary(
dictionary: ostk.core.container.Dictionary,
) ostk.core.container.Object

Create an Object containing a dictionary.

Parameters:

dictionary (Dictionary) -- The dictionary.

Returns:

An object containing the dictionary.

Return type:

Object

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:

bool

Raises:

RuntimeError -- If the object is not a boolean.

get_dictionary(
self: ostk.core.container.Object,
) ostk.core.container.Dictionary

Get the dictionary from the Object.

Returns:

The dictionary value.

Return type:

Dictionary

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:

Integer

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:

Real

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:

String

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:

Object.Type

static integer(integer: ostk.core.type.Integer) ostk.core.container.Object

Create an Object containing an integer value.

Parameters:

integer (Integer) -- The integer value.

Returns:

An object containing the integer.

Return type:

Object

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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

static load(
file: ostk.core.filesystem.File,
format: ostk.core.container.Object.Format,
) ostk.core.container.Object

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:

Object

Raises:

RuntimeError -- If the file cannot be loaded or parsed.

static parse(
string: ostk.core.type.String,
format: ostk.core.container.Object.Format,
) ostk.core.container.Object

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:

Object

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.

Parameters:

real (Real) -- The real number value.

Returns:

An object containing the real number.

Return type:

Object

static string(string: ostk.core.type.String) ostk.core.container.Object

Create an Object containing a string value.

Parameters:

string (String) -- The string value.

Returns:

An object containing the string.

Return type:

Object

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:

str

to_string(
self: ostk.core.container.Object,
format: ostk.core.container.Object.Format,
) ostk.core.type.String

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:

str

static type_from_string(
string: ostk.core.type.String,
) ostk.core.container.Object.Type

Get Object type from string representation.

Parameters:

string (str) -- String representation of the type.

Returns:

The object type.

Return type:

Object.Type

static undefined() ostk.core.container.Object

Create an undefined Object.

Returns:

An undefined object.

Return type:

Object