def begin(self): if self.in_transaction(): self.abort() self.collectors = adict({p: deque() for p in self.updates.keys()})
def load_state(self, data): self.stdout = data['stdout'] self.logs = adict(data['logs']) self.updates = adict(data['updates']) if 'collectors' in data: self.collectors = adict(data['collectors'])
def get_full(self, player=None): if player is not None: return ''.join(self.logs[player]) return adict({p: ''.join(self.logs[p]) for p in self.logs})
def __init__(self, *players, stdout=False): self.stdout = stdout self.logs = adict({p: deque() for p in players}) self.updates = adict({p: deque() for p in players}) self.collectors = None
def reset(self, *players): self.logs = adict({p:deque() for p in players}) self.updates = adict({p:deque() for p in players}) self.collectors = None