コード例 #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))