ScEpTIC.emulator.io package

Submodules

ScEpTIC.emulator.io.input module

class ScEpTIC.emulator.io.input.InputManager

Bases: object

This class permits to create and manage all the inputs. To create a standard input (one with no arguments which just a simple value attachable to it), just use the create_input method. To create a complex input:

  1. Extend class InputSkeleton (re-implementing the get_val() method, to suit your needs)

  2. Call the define_input() method on the extended class with the appropriate parameters

LONG_TERM = 'LONG_TERM'
MOST_RECENT = 'MOST_RECENT'
consistency_models = {}
classmethod create_input(input_name, function_name, return_type)

Creates a standard input. Name is the identifier considered by the input manager, function_name is the one appearing in the code.

classmethod get_consistency_model(input_name)

Returns the consistency model of a given input.

classmethod get_input_value(input_name)

Gets the value of a given input

input_table = {}
inputs = {}
classmethod set_consistency_model(input_name, consistency_model)

Sets an input consistency model.

classmethod set_input_value(input_name, value)

Sets an input value to the given one.

class ScEpTIC.emulator.io.input.InputSkeleton

Bases: ScEpTIC.AST.builtins.builtin.Builtin

Skeleton of an user-defined input.

classmethod define_input(input_name, function_name, arguments, return_type)

Defines a custom input builtin. input_name is the identifier of the input considered by the input manager. The other arguments are the same of the Builtin class.

get_val()

Returns the value of the input when the input operation is run.

input_functions = {}
input_name = None
input_names = {}
is_input = True
value = None

ScEpTIC.emulator.io.output module

class ScEpTIC.emulator.io.output.OutputManager

Bases: object

This class permits to create and manage all the outputs. To create a standard output (which uses a single argument), just use the create_output method from the OutputManager. To create a complex output:

  1. Extend class OutputSkeleton (re-implementing the get_val() method, to suit your needs)

  2. Call the create_output() method on the extended class with the appropriate parameters

IDEMPOTENT = 0
NON_IDEMPOTENT = 1
classmethod create_output(output_name, function_name, arguments)

Creates a standard output. Name is the identifier considered by the output manager, function_name is the one appearing in the code.

default_idempotent = False
classmethod diff(output_table)

Diffs the current output table with a dump

classmethod dump()

Dumpts the output table

classmethod get_changes()

Returns all the outputs with non-null value, which are the ones that are set on current program run.

classmethod get_measured_idempotency()

Returns a visual representation of the measured idempotency

classmethod measure_idempotency(output_name, idempotency)

Sets the measured idempotency for the given output

measured_idempotency = {}
output_idempotency_table = {}
output_table = {}
classmethod reset()

Resets all the output values.

classmethod restore(output_table)

Restores the output table

classmethod set_default_idempotent(default_idempotent)

Set the default idempotency for all outputs

classmethod set_idempotency(name, idempotency)

Sets the idempotency model of a given output.

class ScEpTIC.emulator.io.output.OutputSkeleton

Bases: ScEpTIC.AST.builtins.builtin.Builtin

Skeleton of an user-defined output.

classmethod define_output(output_name, function_name, arguments, return_type)

Creates an output builtin. To define a simple output, just call the create_output method from the OutputManager class. To define more complex outputs, extend this class and then use this method to link it to the AST. The output_name is the identifier of the output, the other arguments are the same of the Builtin class.

get_output_val()

Returns the output value (i.e. environment state)

get_val()

Sets the value of the output when the output operation is run. Note that this method is named “get_val” as the OutputSkeleton extends the Instruction base class.

output_functions = {}
output_init()
output_name = None
output_names = {}
set_output_val(value)

Updates the output value (that is, the environment state)

Module contents