Spaces:
Running
on
Zero
Running
on
Zero
from coze import Coze | |
class CozeManager: | |
"""Manages a collection of Coze entities""" | |
def __init__(self): | |
self.coze_list = [] | |
def add_coze(self, coze: Coze): | |
"""Adds a new Coze entity to the collection""" | |
self.coze_list.append(coze) | |
def get_coze(self, id: int) -> Coze: | |
"""Retrieves a Coze entity by ID""" | |
for coze in self.coze_list: | |
if coze.id == id: | |
return coze | |
return None | |
def stop_coze(self, id: int): | |
"""Stops a Coze entity by ID""" | |
coze = self.get_coze(id) | |
if coze: | |
coze.is_stopped = True | |
def is_coze_stopped(self, id: int) -> bool: | |
"""Checks if a Coze entity is stopped""" | |
coze = self.get_coze(id) | |
return coze.is_stopped if coze else False |