def sub(self, other, nb_cpu=1): """Subtract two RleDicts. Same as -, but sub takes nb_cpu argument.""" return m.binary_operation("sub", self, other, nb_cpu)
def mul(self, other, nb_cpu=1): """Multiply two RleDicts. Same as *, but mul takes nb_cpu argument.""" return m.binary_operation("mul", self, other, nb_cpu)
def div(self, other, nb_cpu=1): """Divide two RleDicts. Same as /, but div takes nb_cpu argument.""" return m.binary_operation("div", self, other, nb_cpu)
def add(self, other, nb_cpu=1): """Add two RleDicts. Same as +, but add takes nb_cpu argument.""" return m.binary_operation("add", self, other, nb_cpu)
def __truediv__(self, other): if isinstance(other, Number): return RleDict({cs: v / other for cs, v in self.items()}) return m.binary_operation("div", self, other)
def __sub__(self, other): if isinstance(other, Number): return RleDict({cs: v - other for cs, v in self.items()}) return m.binary_operation("sub", self, other)