Portable

class ioiocore.portable.Portable(**kwargs)[source]

Bases: Interface

A class representing a portable object, inheriting from Interface. Handles configuration, implementation, and serialization of the portable object.

class Configuration(id='TBG', **kwargs)[source]

Bases: Configuration

Configuration class for the Portable.

Parameters:

id (str)

ID

The key for the portable object ID.

Type:

str

class Keys[source]

Bases: Keys

Keys for the Portable configuration.

ID = 'id'
__init__(id='TBG', **kwargs)[source]

Initializes the portable configuration.

Parameters:
  • id (str, optional) – The ID of the portable object (default is ID_TO_BE_GENERATED).

  • **kwargs – Additional keyword arguments for further configuration.

__init__(**kwargs)[source]

Initializes the Portable object.

Parameters:

**kwargs – Additional keyword arguments for further configuration.

static add_preinstalled_module(module)[source]

Adds a preinstalled module for the Portable object.

Parameters:

module (str) – The name of the module to be added.

config: Configuration
create_config(**kwargs)[source]

Factory method to create the configuration for the Portable object.

Parameters:

**kwargs – Additional keyword arguments for configuring the Portable object.

create_implementation(**kwargs)[source]

Factory method to create the implementation for the Portable object.

Parameters:

**kwargs – Additional keyword arguments for implementing the Portable object.

static deserialize(data)[source]

Deserializes a Portable object from a dictionary.

Parameters:

data (dict) – The dictionary containing the serialized data.

Returns:

The deserialized Portable object.

Return type:

Portable

static get_by_id(id)[source]

Retrieves a Portable object by its ID.

Parameters:

id (str) – The ID of the Portable object.

Returns:

The Portable object with the given ID.

Return type:

Portable

static reset()[source]

Resets the Portable object.

This static method calls the reset method on the PortableImp.

serialize()[source]

Serializes the Portable object.

Returns:

A dictionary representation of the Portable object.

Return type:

dict