def _2_string(self,depth=0,sb=None): sb += ['\n', " "*depth, "("+self._op, " "] if self._children is not None: for child in self._children: if _is_fr(child) and child._ex._cache._id is None: child._ex._2_string(depth+2,sb) elif _is_fr(child): sb+=['\n', ' '*(depth+2), child._ex._cache._id] elif isinstance(child, ExprNode): child._2_string(depth+2,sb) else: sb+=['\n', ' '*(depth+2), str(child)] sb+=['\n',' '*depth+") "] + ['\n'] * (depth==0) # add a \n if depth == 0 return sb
def _2_string(self, depth=0, sb=None): sb += ['\n', " " * depth, "(" + self._op, " "] if self._children is not None: for child in self._children: if _is_fr(child) and child._ex._cache._id is None: child._ex._2_string(depth + 2, sb) elif _is_fr(child): sb += ['\n', ' ' * (depth + 2), child._ex._cache._id] elif isinstance(child, ExprNode): child._2_string(depth + 2, sb) else: sb += ['\n', ' ' * (depth + 2), str(child)] sb += ['\n', ' ' * depth + ") "] + ['\n'] * (depth == 0) # add a \n if depth == 0 return sb
def __init__(self, op="", *args): # assert isinstance(op, str), op self._op = op # Base opcode string self._children = tuple( a._ex if _is_fr(a) else a for a in args ) # ast children; if not None and _cache._id is not None then tmp self._cache = H2OCache() # ncols, nrows, names, types
def __init__(self, op="", *args): # assert isinstance(op, str), op self._op = op # Base opcode string self._children = tuple( a._ex if _is_fr(a) else a for a in args) # ast children; if not None and _cache._id is not None then tmp self._cache = H2OCache() # ncols, nrows, names, types # try to fuse/simplify expression if self.__ENABLE_EXPR_OPTIMIZATIONS__: self._optimize()
def __init__(self, op="", *args): # assert isinstance(op, str), op self._op = op # Base opcode string self._children = tuple( a._ex if _is_fr(a) else a for a in args) # ast children; if not None and _cache._id is not None then tmp self._cache = H2OCache() # ncols, nrows, names, types