class Inline:
def __init__(self, function):
self.function = function
def right(self, left_value):
class Inline:
def left(this, right_value):
return self.function(left_value, right_value)
__add__ = __sub__ = __mul__ = __truediv__ = __floordiv__ = __mod__ = __divmod__ = left
__pow__ = __rshift__ = __and__ = __xor__ = __or__ = __lt__ = left
def __str__(this):
return "Inline({}({}, ))".format(self.function.__name__, left_value)
def __repr__(this):
return "Inline({}({}, ))".format(self.function.__name__, left_value)
def __call__(this, right_value):
return self.function(left_value, right_value)
return Inline()
def left(self, right_value):
class Inline:
def right(this, left_value):
return self.function(left_value, right_value)
__radd__ = __rsub__ = __rmul__ = __rtruediv__ = __rfloordiv__ = __rmod__ = __rdivmod__ = right
__rpow__ = __rrshift__ = __rand__ = __rxor__ = __ror__ = right
def __str__(this):
return "Inline({}( , {}))".format(self.function.__name__, right_value)
def __repr__(this):
return "Inline({}( , {}))".format(self.function.__name__, right_value)
def __call__(this, left_value):
return self.function(left_value, right_value)
return Inline()
__add__ = __sub__ = __mul__ = __truediv__ = __floordiv__ = __mod__ = __divmod__ = left
__pow__ = __lshift__ = __rshift__ = __and__ = __xor__ = __or__ = left
__radd__ = __rsub__ = __rmul__ = __rtruediv__ = __rfloordiv__ = __rmod__ = __rdivmod__ = right
__rpow__ = __rlshift__ = __rrshift__ = __rand__ = __rxor__ = __ror__ = right
def __call__(self, left_value, right_value):
return self.function(left_value, right_value)
def __str__(self):
return "Inline({}( , ))".format(self.function.__name__)
def __repr__(self):
return "Inline({}( , ))".format(self.function.__name__)
to = Inline(range)
mappedover = Inline(map)
roundto = Inline(round)
issubclassof = Inline(issubclass)
dot = Inline(getattr)
filtering = Inline(filter)
topowof = Inline(pow)
divmod = Inline(divmod)
zippedwith = Inline(zip)
class InlineConverter:
def __init__(self, function):
self.function = function
def __rrshift__(self, val):
return self.function(val)
tolist = InlineConverter(list)
todict = InlineConverter(dict)
totuple = InlineConverter(tuple)
tostr = InlineConverter(str)
toint = InlineConverter(int)
toroundedint = InlineConverter(round)