Пример #1
0
 def _eval_progress(self, match):
     '''
     Runs the user-supplied progress calculation rule
     '''
     _locals = {k: safe_float(v) for k, v in match.groupdict().items()}
     if "x" not in _locals:
         _locals["x"] = [safe_float(x) for x in match.groups()]
     try:
         return int(eval(self.progress_expr, {}, _locals))
     except:
         return None
Пример #2
0
 def _eval_progress(self, match):
     '''
     Runs the user-supplied progress calculation rule
     '''
     _locals = {k: safe_float(v) for k, v in match.groupdict().items()}
     if "x" not in _locals:
         _locals["x"] = [safe_float(x) for x in match.groups()]
     try:
         return int(eval(self.progress_expr, {}, _locals))
     except:
         return None
Пример #3
0
 def _calculate_progress(self, match):
     '''
     Calculates the final progress value found by the regex
     '''
     if not self.progress_expr:
         return safe_float(match.group(1))
     else:
         return self._eval_progress(match)
Пример #4
0
 def _calculate_progress(self, match):
     '''
     Calculates the final progress value found by the regex
     '''
     if not self.progress_expr:
         return safe_float(match.group(1))
     else:
         return self._eval_progress(match)