Evaluator

Context manager

Subclass of Component.

Module: core

Methods and properties

Main methods and properties


__init__

Arguments:

  • schema (Component): Wrapped Component.

  • logging_level (int, optional): Logging level. Defaults to logging.NOTSET.

  • logging_handler (Optional[logging.Handler], optional): Handler that will be used. If value equals to None, default will be created. Defaults to None.

  • fast_exit (bool, optional): If set to True, after first unhandled exeception execution will be terminated. Defaults to True.

  • memory_manager (Optional[MemoryManager], optional): Manages data, that can be accesed in evaluator scope. If equals to None, default memory manager will be created. Defaults to None.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


get_memory

Get data from memory and set to register

Arguments:

  • register (Transformable): Destination.

  • identifiers (List[Union[str, Tuple[str, str]]]): Key/keys that will be used to access data in memory and for setting to register.

  • default (Dict[str, Any]): A map of values to be returned for each provided identifier if the identifier(s) are not found. If an identifier is not found and no default value is provided for it, an exception will be raised. Defaults to None.

  • delete (bool, optional): If equals to True, accessed data will be removed from memory. Defaults to False.

Returns:


set_memory

Set data from register to memory

Arguments:

  • register (Transformable): Source.

  • get_key (str): Key in register.

  • set_key (str): Key in memory.


delete_memory

Delete specified key from memory

Arguments:

  • identifier (str): Key for deletion.


flush_memory

Delete all keys from memory


log

Log messages

Arguments:

  • level (int): Logging level.

  • msg (Any): Message to log.

  • exc_info (bool, optional): Include exception info. Defaults to False.


create_child

Create evaluator in context of current evaluator

Arguments:

  • schema (Component): Component to wrapp.

  • child_name (str): Name of new evaluator.

Returns:


__call__

Component Call

Arguments:

  • input_data (Transformable): Data for processing

  • evaluator (Optional[Evaluator], optional): Evaluator in context of which component executed (parent Evaluator). Defaults to None.

Raises:

  • EvaluatorExecutionFailed: Reraised exception after logging to parent evaluator.

Returns:


run

Run Component. This method should be called to run program.

Arguments:

  • input_data (Optional[Dict[str, Any]], optional): Data for processing. If equals to None, empty dict will be used for input_data. Defaults to None.

  • evaluator (Optional[Evaluator], optional): Evaluator in context of which component executed (parent Evaluator). Defaults to None.

Returns:

  • Dict[str, Any]: Result of execution.



Last updated