Пример #1
0
 def eval_file(self, filename, env=None):
     path = self.find_file(filename)
     if path is None:
         msg = f"load error: {filename} not found"
         raise exceptions.EvalError(msg)
     with path.open() as in_stream:
         return self.eval_stream(in_stream, env=env)
Пример #2
0
def arithmetic_eq(x, *rest):
    if len(rest) < 1:
        raise exceptions.EvalError("=: expected at least 2 arguments")
    for y in rest:
        if x != y:
            return False
        x = y
    return True
Пример #3
0
def ge(x, *rest):
    if len(rest) < 1:
        raise exceptions.EvalError(">=: expected at least 2 arguments")
    for y in rest:
        if not x >= y:
            return False
        x = y
    return True