MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / Checklist

Class Checklist

src/telegram/_checklists.py:175–282  ·  view source on GitHub ↗

Describes a checklist. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if all their :attr:`tasks` are equal. .. versionadded:: 22.3 Args: title (:obj:`str`): Title of the checklist. title_entities (Seq

Source from the content-addressed store, hash-verified

173
174
175class Checklist(TelegramObject):
176 """
177 Describes a checklist.
178
179 Objects of this class are comparable in terms of equality.
180 Two objects of this class are considered equal, if all their :attr:`tasks` are equal.
181
182 .. versionadded:: 22.3
183
184 Args:
185 title (:obj:`str`): Title of the checklist.
186 title_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
187 entities that appear in the checklist title.
188 tasks (Sequence[:class:`telegram.ChecklistTask`]): List of tasks in the checklist.
189 others_can_add_tasks (:obj:`bool`, optional): :obj:`True` if users other than the creator
190 of the list can add tasks to the list
191 others_can_mark_tasks_as_done (:obj:`bool`, optional): :obj:`True` if users other than the
192 creator of the list can mark tasks as done or not done
193
194 Attributes:
195 title (:obj:`str`): Title of the checklist.
196 title_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. Special
197 entities that appear in the checklist title.
198 tasks (Tuple[:class:`telegram.ChecklistTask`]): List of tasks in the checklist.
199 others_can_add_tasks (:obj:`bool`): Optional. :obj:`True` if users other than the creator
200 of the list can add tasks to the list
201 others_can_mark_tasks_as_done (:obj:`bool`): Optional. :obj:`True` if users other than the
202 creator of the list can mark tasks as done or not done
203 """
204
205 __slots__ = (
206 "others_can_add_tasks",
207 "others_can_mark_tasks_as_done",
208 "tasks",
209 "title",
210 "title_entities",
211 )
212
213 def __init__(
214 self,
215 title: str,
216 tasks: Sequence[ChecklistTask],
217 title_entities: Sequence[MessageEntity] | None = None,
218 others_can_add_tasks: bool | None = None,
219 others_can_mark_tasks_as_done: bool | None = None,
220 *,
221 api_kwargs: JSONDict | None = None,
222 ):
223 super().__init__(api_kwargs=api_kwargs)
224 self.title: str = title
225 self.title_entities: tuple[MessageEntity, ...] = parse_sequence_arg(title_entities)
226 self.tasks: tuple[ChecklistTask, ...] = parse_sequence_arg(tasks)
227 self.others_can_add_tasks: bool | None = others_can_add_tasks
228 self.others_can_mark_tasks_as_done: bool | None = others_can_mark_tasks_as_done
229
230 self._id_attrs = (self.tasks,)
231
232 self._freeze()

Callers 3

checklistFunction · 0.90
test_equalityMethod · 0.90

Calls

no outgoing calls

Tested by 2

checklistFunction · 0.72
test_equalityMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…