Base Module

Defines bases classes and functions.

Operators

Define base classe to provide generic base operators

class AbstractBaseOperators

Base class defining behaviors for common operators

The derived classes should implement the operation_value property to return the attribute of the class that will be used with base operators.

abstract property operation_value: Any

Overwrite in derived class to return the value used by the class for the base operators.

Registers

Define functions to update two-way dict using common dict

register(register: dict[Any, Any], registered_key: Any, registered_value: Any) None

Register the key and value to the provided register.

Parameters:
  • register – the register to fill.

  • registered_key – the key to register.

  • registered_value – the value to register.

Raises:

ValueError – Raises a ValueError if either the key or value is already registered in the provided register.

check_key_value_type(key: Any, key_type: type[Any], value: Any, value_type: type[Any]) None

Check if key and params are of the expected types.

If not, it raises a type error.

Parameters:
  • key (Any) – the key value

  • key_type (type) – the expected type for the key

  • value (Any) – the value

  • value_type (type) – the expected type for the value

Raises:

TypeError – raise a type error if key or value param is not of the expected types

exception RegisterError

Error Raised when a key or value has already been registered.