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

Method __init__

src/telegram/_poll.py:514–543  ·  view source on GitHub ↗
(
        self,
        poll_id: str,
        option_ids: Sequence[int],
        user: User | None = None,
        voter_chat: Chat | None = None,
        # tags: required in 22.8, bot api 9.6
        # temporarily optional to avoid breaking changes
        option_persistent_ids: Sequence[str] | None = None,
        *,
        api_kwargs: JSONDict | None = None,
    )

Source from the content-addressed store, hash-verified

512 __slots__ = ("option_ids", "option_persistent_ids", "poll_id", "user", "voter_chat")
513
514 def __init__(
515 self,
516 poll_id: str,
517 option_ids: Sequence[int],
518 user: User | None = None,
519 voter_chat: Chat | None = None,
520 # tags: required in 22.8, bot api 9.6
521 # temporarily optional to avoid breaking changes
522 option_persistent_ids: Sequence[str] | None = None,
523 *,
524 api_kwargs: JSONDict | None = None,
525 ):
526 if option_persistent_ids is None:
527 raise TypeError("`option_persistent_ids` is a required argument since Bot API 9.6")
528
529 super().__init__(api_kwargs=api_kwargs)
530 self.poll_id: str = poll_id
531 self.voter_chat: Chat | None = voter_chat
532 self.option_ids: tuple[int, ...] = parse_sequence_arg(option_ids)
533 self.user: User | None = user
534 self.option_persistent_ids: tuple[str, ...] = parse_sequence_arg(option_persistent_ids)
535
536 self._id_attrs = (
537 self.poll_id,
538 self.option_ids,
539 self.user,
540 self.voter_chat,
541 )
542
543 self._freeze()
544
545 @classmethod
546 def de_json(cls, data: JSONDict, bot: "Bot | None" = None) -> "PollAnswer":

Callers

nothing calls this directly

Calls 3

parse_sequence_argFunction · 0.90
_freezeMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected