stable_learning_control.utils.safer_eval_util

A module that makes eval calls inside the utility scripts safer.

This is done by setting the globals to a dictionary containing only modules we want the end user to access. This way, users can not use the eval method to (accidentally) execute arbitrary code on the system through the CLI.

Attributes

tf

tf_nn

torch_nn

AVAILABLE_GLOBAL_MODULES

Functions

safer_eval(*args[, backend])

Function that executes the eval function with a safer set of globals.

Module Contents

stable_learning_control.utils.safer_eval_util.tf[source]
stable_learning_control.utils.safer_eval_util.tf_nn[source]
stable_learning_control.utils.safer_eval_util.torch_nn[source]
stable_learning_control.utils.safer_eval_util.AVAILABLE_GLOBAL_MODULES[source]
stable_learning_control.utils.safer_eval_util.safer_eval(*args, backend=None)[source]

Function that executes the eval function with a safer set of globals.

Note

This is done by setting the globals to a dictionary containing only modules we want the end user to access. This way, users can not use the eval method to (accidentally) execute arbitrary code on the system through the CLI.

Parameters:

backend (str) – The machine learning backend you want to use. Options are tf2 or torch. Defaults to None meaning no backend is assumed and both backends are tried.

Returns:

The eval return values.

Return type:

args