Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/nodes.py b/nodes.py
- index 34864bd..150dc1c 100644
- --- a/nodes.py
- +++ b/nodes.py
- @@ -39,7 +39,16 @@ class Node(object):
- def __init__(self):pass
- def __repr__(self):
- - return self.__class__.__name__
- + # return self.__class__.__name__
- +
- + #def __str__(self):
- + cls = self.__class__
- + string = cls.__name__
- + print("TYPE", list(map(type, self.init_args)))
- + print("IA",self.init_args)
- + if self.init_args:
- + return str(self.init_args)
- + return string
- def __call__(self, args):
- self.added_args = 0
- @@ -127,6 +136,8 @@ class Node(object):
- pass
- def add_arg(self, args):
- + print("self", self)
- + print("repr %r"%(self))
- if settings.WARNINGS: print("Missing arg to %r, evaling input."%self)
- arg = safe_eval.evals[settings.SAFE](input())
- if self.__class__.reverse_first:
- @@ -169,7 +180,9 @@ class Node(object):
- results = results([])[0]
- args.append(results)
- #print(code, cls, args)
- - return code, cls(*args)
- + obj = cls(*args)
- + obj.setup_repr(args)
- + return code, obj
- return None, None
- @classmethod
- @@ -206,7 +219,10 @@ class Node(object):
- raise(AssertionError(cls.__name__+"(%r): returned %r. Has True/False"%(in_stack, rtn_stack)))
- if rtn_stack != out_stack:
- raise AssertionError(cls.__name__+"(%r): %r returned %r"%(in_stack, out_stack, rtn_stack))
- -
- +
- + def setup_repr(self, args):
- + self.init_args = args
- +
- def prefer(func):
- func.prefer = True
- return func
- diff --git a/settings.py b/settings.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement