Decorate the nodes.
48 Decorate the functions
52 if hasattr(opers,
"__call__"):
54 def _call_(self, arg):
58 >>> fun = ... # get the functor
59 >>> arg = ... # get the argument
62 result = opers.__call__(self, arg)
63 return True if result
else False
65 _call_.__doc__ = opers.__call__.__doc__
68 if hasattr(opers,
"__or__"):
74 >>> fun1 = ... # get the functor
75 >>> fun2 = ... # get the functor
78 return opers.__or__(self, arg)
80 _or_.__doc__ = opers.__or__.__doc__
83 if hasattr(opers,
"__ror__"):
89 >>> fun1 = ... # get the functor
90 >>> fun2 = ... # get the functor
93 return opers.__ror__(self, arg)
95 _or_.__doc__ = opers.__or__.__doc__
98 if hasattr(opers,
"__and__"):
100 def _and_(self, arg):
104 >>> fun1 = ... # get the functor
105 >>> fun2 = ... # get the functor
106 >>> fun = fun1 & fun2
108 return opers.__and__(self, arg)
110 _and_.__doc__ = opers.__and__.__doc__
113 if hasattr(opers,
"__rand__"):
115 def _rand_(self, arg):
119 >>> fun1 = ... # get the functor
120 >>> fun2 = ... # get the functor
121 >>> fun = fun1 & fun2
123 return opers.__rand__(self, arg)
125 _rand_.__doc__ = opers.__rand__.__doc__
128 if hasattr(opers,
"__invert__"):
130 def _invert_(self, *arg):
134 >>> fun1 = ... # get the functor
137 return opers.__invert__(self, *arg)
139 _invert_.__doc__ = opers.__invert__.__doc__
142 if hasattr(opers,
"__rshift__"):
144 def _rshift_(self, arg):
148 >>> fun1 = ... # get the functor
149 >>> fun1 = ... # get the functor
150 >>> fun = fun1 >> fun2
152 return opers.__rshift__(self, arg)
154 _rshift_.__doc__ = opers.__rshift__.__doc__
157 if hasattr(opers,
"__rrshift__"):
159 def _rrshift_(self, arg):
161 Evaluate the functor as streametr shift
163 >>> fun = ... # get the functor
164 >>> arg = ... # get the argument
167 result = opers.__rrshift__(self, arg)
168 return True if result
else False
170 _rrshift_.__doc__ = opers.__rrshift__.__doc__
174 node.__call__ = _call_
182 node.__rand__ = _rand_
184 node.__rshift__ = _rshift_
186 node.__rrshift__ = _rrshift_
188 node.__invert__ = _invert_
190 node.__repr__ =
lambda s: s.toString()
191 node.__str__ =
lambda s: s.toString()