Пример #1
0
 def ___call__(input):
     # first evaluate the inner function
     r = self.evaluate(input)
     # then call the method
     return r.__call__(
         *[evaluate(other, input) for other in args], **{
             arg_name: evaluate(other, input)
             for arg_name, other in kwargs.items()
         })
Пример #2
0
            def evaluate_both_inner_functions_and_combine(input):
                # first evaluate self
                left = self.evaluate(input)

                # evaluate the right part
                right = evaluate(other, input)

                return (left and not right) or (not left and right)
Пример #3
0
 def evaluate_both_inner_functions_and_combine(input):
     # first evaluate self
     left = self.evaluate(input)
     if left:
         # short-circuit: the left part is True, no need to evaluate the right part
         return True
     else:
         # evaluate the right part
         return bool(evaluate(other, input))
Пример #4
0
 def ___rdivmod__(input):
     # first evaluate the inner function
     r = self.evaluate(input)
     # then call the method
     return divmod(evaluate(other, input), r)
Пример #5
0
 def ___rpow__(input):
     # first evaluate the inner function
     r = self.evaluate(input)
     # then call the method
     return evaluate(other, input)**r
Пример #6
0
 def ___getitem__(input):
     # first evaluate the inner function
     r = self.evaluate(input)
     # then call the method
     return r.__getitem__(evaluate(key, input))
Пример #7
0
 def ___getattr__(input):
     # first evaluate the inner function
     r = self.evaluate(input)
     # then call the method
     return getattr(r, evaluate(name, input))