예제 #1
0
 def _eval_subs(self, old, new):
     if self == old:
         return new
     elif isinstance(old, FunctionClass) and isinstance(new, FunctionClass):
         if old == self.func and old.nofargs == new.nofargs:
             return new(*self[:])
     obj = self.func._eval_apply_subs(*(self[:] + (old,) + (new,)))
     if obj is not None:
         return obj
     return Basic._seq_subs(self, old, new)
예제 #2
0
 def _eval_subs(self, old, new):
     if self == old:
         return new
     elif old.is_Function and new.is_Function:
         if old == self.func:
             if self.nargs is new.nargs or not new.nargs:
                 return new(*self.args)
             # Written down as an elif to avoid a super-long line
             elif isinstance(new.nargs,tuple) and self.nargs in new.nargs:
                 return new(*self.args)
     return Basic._seq_subs(self, old, new)
예제 #3
0
 def _eval_subs(self, old, new):
     if self == old:
         return new
     elif old.is_Function and new.is_Function:
         if old == self.func:
             if self.nargs is new.nargs or not new.nargs:
                 return new(*self.args)
             # Written down as an elif to avoid a super-long line
             elif isinstance(new.nargs, tuple) and self.nargs in new.nargs:
                 return new(*self.args)
     return Basic._seq_subs(self, old, new)
예제 #4
0
 def _eval_subs(self, old, new):
     if self == old:
         return new
     elif old.is_Function and new.is_Function:
         if old == self.func:
             if self.nargs is new.nargs or not new.nargs:
                 return new(*self.args[:])
             # Written down as an elif to avoid a super-long line
             elif isinstance(new.nargs,tuple) and self.nargs in new.nargs:
                 return new(*self.args[:])
     obj = self.func._eval_apply_subs(*(self.args[:] + (old,) + (new,)))
     if obj is not None:
         return obj
     return Basic._seq_subs(self, old, new)
예제 #5
0
 def _eval_subs(self, old, new):
     if self == old:
         return new
     elif old.is_Function and new.is_Function:
         if old == self.func:
             if self.nargs is new.nargs or not new.nargs:
                 return new(*self.args[:])
             # Written down as an elif to avoid a super-long line
             elif isinstance(new.nargs, tuple) and self.nargs in new.nargs:
                 return new(*self.args[:])
     obj = self.func._eval_apply_subs(*(self.args[:] + (old, ) + (new, )))
     if obj is not None:
         return obj
     return Basic._seq_subs(self, old, new)