class Process: def __init__(self): self.env = None self.__process = None def start(self, env, **kwargs): self.env = env self.__process = env.process(self.process(**kwargs)) def process(self, **kwargs): yield self.env.timeout(0) raise NotImplementedError class TickProcess(Process): def __init__(self, tick): super().__init__() if tick < 1: raise ValueError('tick must be greatert than or equal to 1') self._tick = tick def tick(self): return self.env.timeout(self._tick)