File size: 810 Bytes
b1ce64c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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