pypelined.utilities package

pypelined.utilities.safe_eval(literal)

Evaluate a literal value or fall back to string

Safely performs the evaluation of a literal. If the literal is not valid, it is assumed to be a regular string and returned unchanged.

Parameters:literal (str) – literal to evaluate, e.g. “1.0” or “{‘foo’: 3}”
Returns:evaluated or original literal