Decorate the nodes.
47 Decorate the functions
51 if hasattr(opers,
"__call__"):
53 def _call_(self, arg):
57 >>> fun = ... # get the functor
58 >>> arg = ... # get the argument
61 result = opers.__call__(self, arg)
62 return True if result
else False
64 _call_.__doc__ = opers.__call__.__doc__
67 if hasattr(opers,
"__or__"):
73 >>> fun1 = ... # get the functor
74 >>> fun2 = ... # get the functor
77 return opers.__or__(self, arg)
79 _or_.__doc__ = opers.__or__.__doc__
82 if hasattr(opers,
"__ror__"):
88 >>> fun1 = ... # get the functor
89 >>> fun2 = ... # get the functor
92 return opers.__ror__(self, arg)
94 _or_.__doc__ = opers.__or__.__doc__
97 if hasattr(opers,
"__and__"):
103 >>> fun1 = ... # get the functor
104 >>> fun2 = ... # get the functor
105 >>> fun = fun1 & fun2
107 return opers.__and__(self, arg)
109 _and_.__doc__ = opers.__and__.__doc__
112 if hasattr(opers,
"__rand__"):
114 def _rand_(self, arg):
118 >>> fun1 = ... # get the functor
119 >>> fun2 = ... # get the functor
120 >>> fun = fun1 & fun2
122 return opers.__rand__(self, arg)
124 _rand_.__doc__ = opers.__rand__.__doc__
127 if hasattr(opers,
"__invert__"):
129 def _invert_(self, *arg):
133 >>> fun1 = ... # get the functor
136 return opers.__invert__(self, *arg)
138 _invert_.__doc__ = opers.__invert__.__doc__
141 if hasattr(opers,
"__rshift__"):
143 def _rshift_(self, arg):
147 >>> fun1 = ... # get the functor
148 >>> fun1 = ... # get the functor
149 >>> fun = fun1 >> fun2
151 return opers.__rshift__(self, arg)
153 _rshift_.__doc__ = opers.__rshift__.__doc__
156 if hasattr(opers,
"__rrshift__"):
158 def _rrshift_(self, arg):
160 Evaluate the functor as streametr shift
162 >>> fun = ... # get the functor
163 >>> arg = ... # get the argument
166 result = opers.__rrshift__(self, arg)
167 return True if result
else False
169 _rrshift_.__doc__ = opers.__rrshift__.__doc__
173 node.__call__ = _call_
181 node.__rand__ = _rand_
183 node.__rshift__ = _rshift_
185 node.__rrshift__ = _rrshift_
187 node.__invert__ = _invert_
189 node.__repr__ =
lambda s: s.toString()
190 node.__str__ =
lambda s: s.toString()