How to use the siuba.siu.BinaryOp function in siuba

To help you get started, we’ve selected a few siuba examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github machow / siuba / siuba / dply / verbs.py View on Github external
def __call__(self, *args, **kwargs):
        call = Call('__call__',
                    BinaryOp('__getattr__', MetaArg("_"), self.name),
                    *args,
                    **kwargs
                    )

        return self.to_copy(name = call)
github machow / siuba / siuba / siu.py View on Github external
def __getattr__(self, x):
        # temporary hack working around ipython pretty.py printing
        #if x == "__class__": return Symbolic

        return Symbolic(BinaryOp(
                "__getattr__",
                self.__source,
                strip_symbolic(x)
                ))
github machow / siuba / siuba / siu.py View on Github external
def needs_paren(self, x):
        if isinstance(x, BinaryOp):
            sub_lvl = BINARY_LEVELS[x.func]
            level = BINARY_LEVELS[self.func]
            if sub_lvl != 0 and sub_lvl > level:
                return True

        return False
github machow / siuba / siuba / siu.py View on Github external
def _binary_op(self, x):
        if left_assoc:
            node = BinaryOp(op_name, strip_symbolic(self), strip_symbolic(x))
        else:
            node = BinaryOp(op_name, strip_symbolic(x), strip_symbolic(self))

        return Symbolic(node, ready_to_call = True)
    return _binary_op
github machow / siuba / siuba / siu.py View on Github external
def __getitem__(self, x):
        return Symbolic(BinaryOp(
                "__getitem__",
                self.__source,
                slice_to_call(x),
                ),
                ready_to_call = True)