예제 #1
0
파일: _tea.py 프로젝트: yonghe1979/biosteam
 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
예제 #2
0
 def copy(self, system=None):
     """Create a copy."""
     new = copy_(self)
     if system is not None:
         new.system = system
         system._TEA = new
     return new
예제 #3
0
 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
예제 #4
0
 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)
예제 #5
0
 def __call__(self, *args, **kwargs):
    """Multiplex event"""
    for listener in copy_(self.listeners):
       listener.callback(*args, **kwargs)
예제 #6
0
 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)