def like(system, other): """Create a TEA object from `system` with the same settings as `other`.""" self = copy_(other) self.units = sorted(system._costunits, key=lambda x: x.line) self.system = system system._TEA = self return self
def copy(self, system=None): """Create a copy.""" new = copy_(self) if system is not None: new.system = system system._TEA = new return new
def like(system, other): """Create a TEA object from `system` with the same settings as `other`.""" self = copy_(other) self.units = sorted([i for i in system.units if i._design or i._cost], key=lambda x: x.line) self.system = system self.feeds = system.feeds self.products = system.products system._TEA = self return self
def __call__(self, *args, **kwargs) -> bool: """Multiplex event; returns True if the event has been eaten completely.""" for listener in copy_(self.listeners): try: listener.callback(*args, **kwargs) except BaseException as exc: self.log(40, '{0} caught exception in handler call ' '{1}(*{2}, **{3}):'.format(self, listener.callback, args, kwargs), exc_info=True)
def __call__(self, *args, **kwargs): """Multiplex event""" for listener in copy_(self.listeners): listener.callback(*args, **kwargs)
def __call__(self, *args, **kwargs): # Shallow copy each arg. args = (copy_(arg) for arg in args) kwargs = {k: copy_(v) for k, v in kwargs} return super().__call__(*args, **kwargs)