def get_trigger_name(trigger_name): """Standardise a trigger name. E.g. 'foo:fail' becomes 'foo:failed' etc. """ for standard_name, alt_names in _ALT_TRIGGER_NAMES.items(): if trigger_name == standard_name or trigger_name in alt_names: return standard_name raise TriggerExpressionError( f"Illegal task trigger name: {trigger_name}")
def _conditional_is_satisfied(self): """Evaluate the prerequisite's condition expression. Does not cache the result. """ try: res = eval(self.conditional_expression) except (SyntaxError, ValueError) as exc: err_msg = str(exc) if str(exc).find("unexpected EOF") != -1: err_msg += ( " (could be unmatched parentheses in the graph string?)") raise TriggerExpressionError( '"%s":\n%s' % (self.get_raw_conditional_expression(), err_msg)) return res
def _conditional_is_satisfied(self): """Evaluate the prerequisite's condition expression. Does not cache the result. """ try: res = eval(self.conditional_expression) # nosec # * the expression is constructed internally # * https://github.com/cylc/cylc-flow/issues/4403 except (SyntaxError, ValueError) as exc: err_msg = str(exc) if str(exc).find("unexpected EOF") != -1: err_msg += ( " (could be unmatched parentheses in the graph string?)") raise TriggerExpressionError( '"%s":\n%s' % (self.get_raw_conditional_expression(), err_msg)) return res