
    /j                        d Z ddlZddlmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z'm(Z(m)Z)m*Z* ddl+m,Z,m-Z-m.Z. ddl/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9 ddl:m;Z; er
ddlm<Z<m=Z=m>Z>  G d de!      Z? G d de!      Z@ G d  d!e!      ZA G d" d#e!      ZB G d$ d%e!      ZC G d& d'e!      ZD G d( d)e!      ZEy)*z?This module contains an object that represents a Telegram Poll.    N)Sequence)TYPE_CHECKINGFinal)	constants)Chat)	Animation)Audio)Document)	LivePhoto)Location)	PhotoSize)Sticker)Venue)Video)MessageEntity)TelegramObject)User)enum)de_json_optionalde_list_optionalparse_sequence_argto_timedelta)extract_tzinfo_from_defaultsfrom_timestampget_timedelta_value)DEFAULT_NONE)parse_message_entitiesparse_message_entity)JSONDictODVInput
TimePeriod)warn)PTBDeprecationWarning)BotInputPollOptionMediaMaybeInaccessibleMessagec                        e Zd ZdZdZ	 	 	 	 	 	 	 	 	 ddddedz  dedz  dedz  dedz  d	e	dz  d
e
e   dz  dedz  dedz  dedz  dedz  f fdZeddedddd f fd       Z xZS )	PollMediaaW
  
    At most one of the optional fields can be present in any given object.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if all of their attributes are equal.

    .. versionadded:: 22.8

    Args:
        animation (:class:`telegram.Animation`, optional): Media is an animation, information about
            the animation
        audio (:class:`telegram.Audio`, optional): Media is an audio file, information about the
            file; currently, can't be received in a poll option
        document (:class:`telegram.Document`, optional): Media is a general file, information about
            the file; currently, can't be received in a poll option
        live_photo (:class:`telegram.LivePhoto`, optional): Media is a live photo, information
            about the live photo
        location (:class:`telegram.Location`, optional): Media is a shared location, information
            about the location
        photo (Sequence[:class:`telegram.PhotoSize`], optional): Media is a photo, available sizes
            of the photo
        sticker (:class:`telegram.Sticker`, optional): Media is a sticker, information about the
            sticker; currently, for poll options only
        venue (:class:`telegram.Venue`, optional): Media is a venue, information about the venue
        video (:class:`telegram.Video`, optional): Media is a video, information about the video

    Attributes:
        animation (:class:`telegram.Animation`): Optional. Media is an animation, information about
            the animation
        audio (:class:`telegram.Audio`): Optional. Media is an audio file, information about the
            file; currently, can't be received in a poll option
        document (:class:`telegram.Document`): Optional. Media is a general file, information about
            the file; currently, can't be received in a poll option
        live_photo (:class:`telegram.LivePhoto`, optional): Media is a live photo, information
            about the live photo
        location (:class:`telegram.Location`): Optional. Media is a shared location, information
            about the location
        photo (tuple[:class:`telegram.PhotoSize`]): Optional. Media is a photo, available sizes
            of the photo
        sticker (:class:`telegram.Sticker`): Optional. Media is a sticker, information about the
            sticker; currently, for poll options only
        venue (:class:`telegram.Venue`): Optional. Media is a venue, information about the venue
        video (:class:`telegram.Video`): Optional. Media is a video, information about the video
    )		animationaudiodocument
live_photolocationphotostickervenuevideoN
api_kwargsr)   r*   r+   r,   r-   r.   r/   r0   r1   r3   c
          	         t         |   |
       || _        || _        || _        || _        || _        t        |      | _        || _	        || _
        |	| _        | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                  f	| _        | j                          y Nr2   )super__init__r)   r*   r+   r,   r-   r   r.   r/   r0   r1   	_id_attrs_freeze)selfr)   r*   r+   r,   r-   r.   r/   r0   r1   r3   	__class__s              L/var/www/html/maxservice/venv/lib/python3.12/site-packages/telegram/_poll.pyr7   zPollMedia.__init__w   s     	J/+4#(
)1,6)1,>u,E
'.#(
#(
 NNJJMMOOMMJJLLJJJJ

 	    databot
Bot | Nonereturnc                    | j                  |      }t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d      t
        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d	      t        |      |d	<   t        | 9  ||
      S ),See :meth:`telegram.TelegramObject.de_json`.r)   r*   r+   r,   r-   r.   r/   r0   r1   r>   r?   )_parse_datar   getr   r	   r
   r   r   r   r   r   r   r   r6   de_jsonclsr>   r?   r;   s      r<   rG   zPollMedia.de_json   s    t$,TXXk-BIsS[('):E3GW+DHHZ,@(CPZ-dhh|.DiQTU\+DHHZ,@(CPZ('):IsKW*488I+>MY('):E3GW('):E3GWwDc22r=   )	NNNNNNNNNN)__name__
__module____qualname____doc__	__slots__r   r	   r
   r   r   r   r   r   r   r   r   r7   classmethodrG   __classcell__r;   s   @r<   r(   r(   =   s    +Z
I '+"$('+$(,0"&""% '+%t#% t|% T/	%
 $% T/% 	"T)% 4% t|% t|% tO%N 38 3, 3+ 3 3r=   r(   c                        e Zd ZdZdZeddfdddedee   dee	   dz  dd	d
e
dz  f
 fdZedde
dddd f fd       Z xZS )InputPollOptiona(  
    This object contains information about one answer option in a poll to be sent.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`text` is equal.

    .. versionadded:: 21.2

    Args:
        text (:obj:`str`): Option text,
            :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
            characters.
        text_parse_mode (:obj:`str`, optional): |parse_mode|
            Currently, only custom emoji entities are allowed.
        text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities
            that appear in the option :paramref:`text`. It can be specified instead of
            :paramref:`text_parse_mode`.
            Currently, only custom emoji entities are allowed.
            This list is empty if the text does not contain entities.
        media (:class:`telegram.InputPollOptionMedia`, optional): Media added to the poll option.

            .. versionadded:: 22.8

    Attributes:
        text (:obj:`str`): Option text,
            :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
            characters.
        text_parse_mode (:obj:`str`): Optional. |parse_mode|
            Currently, only custom emoji entities are allowed.
        text_entities (Sequence[:class:`telegram.MessageEntity`]): Special entities
            that appear in the option :paramref:`text`. It can be specified instead of
            :paramref:`text_parse_mode`.
            Currently, only custom emoji entities are allowed.
            This list is empty if the text does not contain entities.
        media (:class:`telegram.InputPollOptionMedia`): Optional. Media added to the poll option.

            .. versionadded:: 22.8
    )mediatexttext_entitiestext_parse_modeNr2   rV   rX   rW   rU   zInputPollOptionMedia | Noner3   c                    t         |   |       || _        || _        t	        |      | _        || _        | j                  f| _        | j                          y r5   )	r6   r7   rV   rX   r   rW   rU   r8   r9   )r:   rV   rX   rW   rU   r3   r;   s         r<   r7   zInputPollOption.__init__   sN     	J/	.=8J=8Y27
))r=   r>   r?   r@   rA   c                     t        t        dd      d       | j                  |      }t        |j	                  d      t
        |      |d<   t        |   ||      S )zSee :meth:`telegram.TelegramObject.de_json`. The :paramref:`media` field will
        not be included for deserialization.

        .. deprecated:: 22.8
            This class is input only and will be removed in the next version.
        22.8z`InputPollOption.de_json` is deprecated. This class is input only and will be removed in the next version. The `media` field will not be included for deserialization.   
stacklevelrW   rD   )r"   r#   rE   r   rF   r   r6   rG   rH   s      r<   rG   zInputPollOption.de_json   sb     	!# 	
 t$ 0/1JM[^ __wDc22r=   rJ   )rK   rL   rM   rN   rO   r   strr    r   r   r   r7   rP   rG   rQ   rR   s   @r<   rT   rT      s    %N FI
 *68</3 '+ "#  .5	
 - tO( 38 3, 3BS 3 3r=   rT   c                   |    e Zd ZU dZdZ	 	 	 	 	 	 ddddededee   dz  de	dz  d	e
dz  d
ej                  dz  dedz  dedz  dedz  f fdZeddedddd f fd       ZdedefdZddee   dz  deeef   fdZej.                  j0                  Zee   ed<   	 ej.                  j8                  Zee   ed<    xZS )
PollOptiona  
    This object contains information about one answer option in a poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`text`, :attr:`voter_count` and :attr:`persistent_id`
    are equal.

    .. versionchanged:: 22.8
        Added attribute :attr:`persistent_id` to equality checks.


    Args:
        persistent_id (:obj:`str`): Unique identifier of the option, persistent on option addition
            and deletion.

            .. versionadded:: 22.8
        text (:obj:`str`): Option text,
            :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
            characters.
        voter_count (:obj:`int`): Number of users that voted for this option.
        text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities
            that appear in the option text. Currently, only custom emoji entities are allowed in
            poll option texts.

            .. versionadded:: 21.2
        media (:class:`telegram.PollMedia`, optional): Media added to the poll option.

            .. versionadded:: 22.8
        added_by_user (:class:`telegram.User`, optional): User who added the option;
            omitted if the option wasn't added by a user after poll creation.

            .. versionadded:: 22.8
        added_by_chat (:class:`telegram.Chat`, optional): Chat that added the option;
            omitted if the option wasn't added by a chat after poll creation.

            .. versionadded:: 22.8
        addition_date (:obj:`datetime.datetime`, optional): Point in time
            when the option was added; omitted if the option existed in the original poll.

            .. versionadded:: 22.8

    Attributes:
        persistent_id (:obj:`str`): Unique identifier of the option, persistent on option addition
            and deletion.

            .. versionadded:: 22.8
        text (:obj:`str`): Option text,
            :tg-const:`telegram.PollOption.MIN_LENGTH`-:tg-const:`telegram.PollOption.MAX_LENGTH`
            characters.
        voter_count (:obj:`int`): Number of users that voted for this option.
        text_entities (tuple[:class:`telegram.MessageEntity`]): Special entities
            that appear in the option text. Currently, only custom emoji entities are allowed in
            poll option texts.
            This list is empty if the question does not contain entities.

            .. versionadded:: 21.2
        media (:class:`telegram.PollMedia`): Optional. Media added to the poll option.

            .. versionadded:: 22.8
        added_by_user (:class:`telegram.User`): Optional. User who added the option;
            omitted if the option wasn't added by a user after poll creation.

            .. versionadded:: 22.8
        added_by_chat (:class:`telegram.Chat`): Optional. Chat that added the option;
            omitted if the option wasn't added by a chat after poll creation.

            .. versionadded:: 22.8
        addition_date (:obj:`datetime.datetime`): Optional. Point in time
            when the option was added; omitted if the option existed in the original poll.

            .. versionadded:: 22.8
    )added_by_chatadded_by_useraddition_daterU   persistent_idrV   rW   voter_countNr2   rV   rf   rW   rc   rb   rd   rU   re   r3   c	                2   |t        d      t        
| 	  |	       || _        || _        || _        || _        || _        || _        || _	        t        |      | _        | j                  | j                  | j                  f| _        | j                          y )Nz8`persistent_id` is a required argument since Bot API 9.6r2   )	TypeErrorr6   r7   rV   rf   rc   rb   rd   re   rU   r   rW   r8   r9   )r:   rV   rf   rW   rc   rb   rd   rU   re   r3   r;   s             r<   r7   zPollOption.__init__[  s      VWWJ/	 +*7*72?"/',
8J=8Y))T%5%5t7I7IJr=   r>   r?   r@   rA   c                    | j                  |      }t        |      }t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d      |      |d<   t        |j                  d      t        |      |d<   t        | -  ||      S )rC   rW   rc   rb   rd   tzinforU   rD   )rE   r   r   rF   r   r   r   r   r   r(   r6   rG   rI   r>   r?   
loc_tzinfor;   s       r<   rG   zPollOption.de_json|  s     t$ 2#6
 0/1JM[^ __ 0/1JDRU V_ 0/1JDRU V_ .txx/HQ[ \_('):IsKWwDc22r=   entityc                 .    t        | j                  |      S )a  Returns the text in :attr:`text`
        from a given :class:`telegram.MessageEntity` of :attr:`text_entities`.

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        .. versionadded:: 21.2

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`text_entities`.

        Returns:
            :obj:`str`: The text of the given entity.
        )r   rV   r:   rn   s     r<   parse_entityzPollOption.parse_entity  s    $ $DIIv66r=   typesc                 D    t        | j                  | j                  |      S )a(  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls question filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        Note:
            This method should always be used instead of the :attr:`text_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_entity` for more info.

        .. versionadded:: 21.2

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
            the text that belongs to them, calculated based on UTF-16 codepoints.
        )r   rV   rW   r:   rr   s     r<   parse_entitieszPollOption.parse_entities  s    , &dii1C1CUKKr=   
MIN_LENGTH
MAX_LENGTH)NNNNNNrJ   )rK   rL   rM   rN   rO   r_   intr   r   r   r   dtmdatetimer(   r   r7   rP   rG   rq   listdictru   r   	PollLimitMIN_OPTION_LENGTHrv   r   __annotations__MAX_OPTION_LENGTHrw   rQ   rR   s   @r<   ra   ra     s_   GR	I 9=%)%)-1"& %) '+   .5	
 d{ d{ ||d* 4 Tz tOB 38 3, 3, 3 37= 7S 7(LDI$4 L]TWEW@X L0 '00BBJc
B '00BBJc
Br=   ra   c                        e Zd ZdZdZ	 	 	 ddddedee   dedz  de	dz  d	ee   dz  d
e
dz  f fdZedde
dddd f fd       Z xZS )
PollAnsweraT
  
    This object represents an answer of a user in a non-anonymous poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`poll_id`, :attr:`user` and :attr:`option_ids` are equal.

    .. versionchanged:: 20.5
        The order of :paramref:`option_ids` and :paramref:`user` is changed in
        20.5 as the latter one became optional.

    .. versionchanged:: 20.6
       Backward compatiblity for changed order of :paramref:`option_ids` and :paramref:`user`
       was removed.

    Args:
        poll_id (:obj:`str`): Unique poll identifier.
        option_ids (Sequence[:obj:`int`]): Identifiers of answer options, chosen by the user. May
            be empty if the user retracted their vote.

            .. versionchanged:: 20.0
                |sequenceclassargs|
        option_persistent_ids (Sequence[:obj:`str`]): Persistent identifiers of the
            chosen answer options. May be empty if the vote was retracted.

            .. versionadded:: 22.8
        user (:class:`telegram.User`, optional): The user that changed the answer to the poll,
            if the voter isn't anonymous. If the voter is anonymous, this field will contain the
            user :tg-const:`telegram.constants.ChatID.FAKE_CHANNEL` for backwards compatibility.

            .. versionchanged:: 20.5
                :paramref:`user` became optional.
        voter_chat (:class:`telegram.Chat`, optional): The chat that changed the answer to the
            poll, if the voter is anonymous.

            .. versionadded:: 20.5

    Attributes:
        poll_id (:obj:`str`): Unique poll identifier.
        option_ids (tuple[:obj:`int`]): Identifiers of answer options, chosen by the user. May
            be empty if the user retracted their vote.

            .. versionchanged:: 20.0
                |tupleclassattrs|
        option_persistent_ids (tuple[:obj:`str`]): Persistent identifiers of the
            chosen answer options. May be empty if the vote was retracted.

            .. versionadded:: 22.8
        user (:class:`telegram.User`): Optional. The user, who changed the answer to the
            poll, if the voter isn't anonymous. If the voter is anonymous, this field will contain
            the user :tg-const:`telegram.constants.ChatID.FAKE_CHANNEL` for backwards compatibility

            .. versionchanged:: 20.5
                :paramref:`user` became optional.
        voter_chat (:class:`telegram.Chat`): Optional. The chat that changed the answer to the
            poll, if the voter is anonymous.

            .. versionadded:: 20.5
    )
option_idsoption_persistent_idspoll_iduser
voter_chatNr2   r   r   r   r   r   r3   c                0   |t        d      t        | 	  |       || _        || _        t        |      | _        || _        t        |      | _        | j                  | j                  | j                  | j                  f| _	        | j                          y )Nz@`option_persistent_ids` is a required argument since Bot API 9.6r2   )rh   r6   r7   r   r   r   r   r   r   r8   r9   )r:   r   r   r   r   r   r3   r;   s          r<   r7   zPollAnswer.__init__  s     !(^__J/#'1+=j+I!%	6HI^6_" LLOOIIOO	
 	r=   r>   r?   r@   rA   c                     | j                  |      }t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t
        |   ||      S )rC   r   r   rD   )rE   r   rF   r   r   r6   rG   rH   s      r<   rG   zPollAnswer.de_json!  s]     t$'(8$DV-dhh|.DdCP\wDc22r=   )NNNrJ   )rK   rL   rM   rN   rO   r_   r   rx   r   r   r   r7   rP   rG   rQ   rR   s   @r<   r   r     s    9v YI !"& 7; '+ SM Tk	
 4K  (}t3 tO> 38 3, 3, 3 3r=   r   c                        e Zd ZdZdZ	 	 ddddededdd	ee   dz  d
edz  f
 fdZ	e
ddedddd f fd       ZdedefdZ	 ddee   dz  deeef   fdZ xZS )PollOptionAddeda  
    Describes a service message about an option added to a poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`option_persistent_id`, and :attr:`option_text` are equal.

    .. versionadded:: 22.8

    Args:
        option_persistent_id (:obj:`str`): Unique identifier of the added option.
        option_text (:obj:`str`): Option text.
        poll_message (:class:`telegram.MaybeInaccessibleMessage`, optional): Message
            containing the poll to which the option was added, if known.
            Note that the Message object in this field will not contain the
            :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        option_text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
            entities that appear in the :paramref:`option_text`.

    Attributes:
        option_persistent_id (:obj:`str`): Unique identifier of the added option.
        option_text (:obj:`str`): Option text.
        poll_message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message
            containing the poll to which the option was added, if known.
            Note that the Message object in this field will not contain the
            :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        option_text_entities (tuple[:class:`telegram.MessageEntity`]): Optional. Special
            entities that appear in the :paramref:`option_text`.
    option_persistent_idoption_textoption_text_entitiespoll_messageNr2   r   r   r   MaybeInaccessibleMessage | Noner   r3   c                    t         |   |       || _        || _        || _        t        |      | _        | j                  | j                  f| _        | j                          y r5   	r6   r7   r   r   r   r   r   r8   r9   r:   r   r   r   r   r3   r;   s         r<   r7   zPollOptionAdded.__init__L  a     	J/)=! +=I?Q @
! 33T5E5EFr=   r>   r?   r@   rA   c                     ddl m} | j                  |      }t        |j	                  d      ||      |d<   t        |j	                  d      t        |      |d<   t        | !  ||      S rC   r   )r&   r   r   rD   	telegram._messager&   rE   r   rF   r   r   r6   rG   rI   r>   r?   r&   r;   s       r<   rG   zPollOptionAdded.de_jsonb  p    	
 t$/HH^$&> 
^ (8HH+,mS(
#$ wDc22r=   rn   c                 .    t        | j                  |      S a  Returns the text in :attr:`option_text`
        from a given :class:`telegram.MessageEntity` of :attr:`option_text_entities`.

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`option_text_entities`.

        Returns:
            :obj:`str`: The text of the given entity.
        r   r   rp   s     r<   parse_option_text_entityz(PollOptionAdded.parse_option_text_entityt        $D$4$4f==r=   rr   c                 D    t        | j                  | j                  |      S a  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls option text filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        Note:
            This method should always be used instead of the :attr:`option_text_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_entity` for more info.

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
            the text that belongs to them, calculated based on UTF-16 codepoints.
        r   r   r   rt   s     r<   parse_option_text_entitiesz*PollOptionAdded.parse_option_text_entities       , &d&6&68Q8QSXYYr=   NNrJ   rK   rL   rM   rN   rO   r_   r   r   r   r7   rP   rG   r   r{   r|   r   rQ   rR   s   @r<   r   r   ,  s    : `I ;??C '+!  8	
 '}5< tO, 38 3, 3BS 3 3">} > >& )-Z#Y%Z	mS 	!Zr=   r   c                        e Zd ZdZdZ	 	 ddddededdd	ee   dz  d
edz  f
 fdZ	e
ddedddd f fd       ZdedefdZ	 ddee   dz  deeef   fdZ xZS )PollOptionDeleteda  
    Describes a service message about an option deleted from a poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`option_persistent_id`, :attr:`option_text` are equal.

    .. versionadded:: 22.8

    Args:
        option_persistent_id (:obj:`str`): Unique identifier of the deleted option.
        option_text (:obj:`str`): Option text.
        poll_message (:class:`telegram.MaybeInaccessibleMessage`, optional): Message
            containing the poll to which the option was deleted, if known.
            Note that the Message object in this field will not contain the
            :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        option_text_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
            entities that appear in the option_text.

    Attributes:
        option_persistent_id (:obj:`str`): Unique identifier of the deleted option.
        option_text (:obj:`str`): Option text.
        poll_message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message
            containing the poll to which the option was deleted, if known.
            Note that the Message object in this field will not contain the
            :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply.
        option_text_entities (tuple[:class:`telegram.MessageEntity`]): Optional. Special
            entities that appear in the option_text.
    r   Nr2   r   r   r   r   r   r3   c                    t         |   |       || _        || _        || _        t        |      | _        | j                  | j                  f| _        | j                          y r5   r   r   s         r<   r7   zPollOptionDeleted.__init__  r   r=   r>   r?   r@   rA   c                     ddl m} | j                  |      }t        |j	                  d      ||      |d<   t        |j	                  d      t        |      |d<   t        | !  ||      S r   r   r   s       r<   rG   zPollOptionDeleted.de_json  r   r=   rn   c                 .    t        | j                  |      S r   r   rp   s     r<   r   z*PollOptionDeleted.parse_option_text_entity  r   r=   rr   c                 D    t        | j                  | j                  |      S r   r   rt   s     r<   r   z,PollOptionDeleted.parse_option_text_entities  r   r=   r   rJ   r   rR   s   @r<   r   r     s    : `I ;??C '+!  8	
 '}5< tO, 38 3, 3BU 3 3">} > >& )-Z#Y%Z	mS 	!Zr=   r   c            1           e Zd ZU dZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 d:dddededee   ded	e	d
e	dede	dedz  dedz  dee
   dz  dedz  dej                  dz  dee
   dz  de	dz  de	dz  dee   dz  dedz  dee
   dz  dee   dz  dedz  dedz  dedz  f. fdZedeej$                  z  dz  fd       Zed;ded d!dd f fd"       Zd#e
defd$Z	 d;d%ee   dz  dee
ef   fd&Zd#e
defd'Zd;d%ee   dz  dee
ef   fd(Zd#e
defd)Z	 d;d%ee   dz  dee
ef   fd*Zededz  fd+       Zej@                  jB                  Z!e"e   e#d,<   	 ej@                  jH                  Z$e"e   e#d-<   	 ejJ                  jL                  Z&e"e   e#d.<   	 ejJ                  jN                  Z'e"e   e#d/<   	 ejJ                  jP                  Z(e"e   e#d0<   	 ejJ                  jR                  Z)e"e   e#d1<   	 ejJ                  jT                  Z*e"e   e#d2<   	 ejJ                  jV                  Z+e"e   e#d3<   	 ejJ                  jX                  Z,e"e   e#d4<   	 ejJ                  jZ                  Z-e"e   e#d5<   	 ejJ                  j\                  Z.e"e   e#d6<   	 ejJ                  j^                  Z/e"e   e#d7<   	 ejJ                  j`                  Z0e"e   e#d8<   	 ejJ                  jb                  Z1e"e   e#d9<    xZ2S )<Polla#"  
    This object contains information about a poll.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`id` is equal.

    Examples:
        :any:`Poll Bot <examples.pollbot>`

    Args:
        id (:obj:`str`): Unique poll identifier.
        question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`-
            :tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.
        options (Sequence[:class:`~telegram.PollOption`]): List of poll options.

            .. versionchanged:: 20.0
                |sequenceclassargs|
        is_closed (:obj:`bool`): :obj:`True`, if the poll is closed.
        is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous.
        type (:obj:`str`): Poll type, currently can be :attr:`REGULAR` or :attr:`QUIZ`.
        allows_multiple_answers (:obj:`bool`): :obj:`True`, if the poll allows multiple answers.
        members_only (:obj:`bool`): :obj:`True`, if voting is limited to users who have been
            members of the chat where the poll was originally sent for more than
            :tg-const:`telegram.Poll.MIN_MEMBERSHIP_HOURS` hours.

            .. versionadded:: 22.8
        correct_option_id (:obj:`int`, optional): A zero based identifier of the correct answer
            option. Available only for closed polls in the quiz mode, which were sent
            (not forwarded), by the bot or to a private chat with the bot.

            .. deprecated:: 22.8
                Use :paramref:`correct_option_ids` instead.
        explanation (:obj:`str`, optional): Text that is shown when a user chooses an incorrect
            answer or taps on the lamp icon in a quiz-style poll,
            0-:tg-const:`telegram.Poll.MAX_EXPLANATION_LENGTH` characters.
        explanation_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
            entities like usernames, URLs, bot commands, etc. that appear in the
            :attr:`explanation`. This list is empty if the message does not contain explanation
            entities.

            .. versionchanged:: 20.0

               * This attribute is now always a (possibly empty) list and never :obj:`None`.
               * |sequenceclassargs|
        explanation_media (:class:`telegram.PollMedia`, optional): Media added to the quiz
            explanation.

            .. versionadded:: 22.8
        open_period (:obj:`int` | :class:`datetime.timedelta`, optional): Amount of time in seconds
            the poll will be active after creation.

            .. versionchanged:: v22.2
                |time-period-input|
        close_date (:obj:`datetime.datetime`, optional): Point in time (Unix timestamp) when the
            poll will be automatically closed. Converted to :obj:`datetime.datetime`.

            .. versionchanged:: 20.3
                |datetime_localization|
        question_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities
            that appear in the :attr:`question`. Currently, only custom emoji entities are allowed
            in poll questions.

            .. versionadded:: 21.2
        allows_revoting (:obj:`bool`, optional): :obj:`True`, if the poll allows to
            change the chosenanswer options.

            .. versionadded:: 22.8
        correct_option_ids (Sequence[:class:`int`], optional): Array of 0-based identifiers of
            the correct answer options. Available only for polls in quiz mode which are closed or
            were sent (not forwarded) by the bot or to the private chat with the bot.

            .. versionadded:: 22.8
        country_codes (Sequence[:obj:`str`], optional): A list of two-letter ``ISO 3166-1 alpha-2``
            country codes indicating the countries from which users can vote in the poll. The
            country code ``"FT"`` is used for users with anonymous numbers. If omitted, then users
            from any country can participate in the poll.

            .. versionadded:: 22.8
        description (:obj:`str`, optional): Description of the poll;
            for polls inside the :class:`~telegram.Message` object only.

            .. versionadded:: 22.8
        description_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
            entities like usernames, URLs, bot commands, etc. that appear in the description

            .. versionadded:: 22.8
        media (:class:`telegram.PollMedia`, optional): Media added to the poll description;
            for polls inside the :class:`~telegram.Message` object only.

            .. versionadded:: 22.8

    Attributes:
        id (:obj:`str`): Unique poll identifier.
        question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`-
            :tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.
        options (tuple[:class:`~telegram.PollOption`]): List of poll options.

            .. versionchanged:: 20.0
                |tupleclassattrs|
        total_voter_count (:obj:`int`): Total number of users that voted in the poll.
        is_closed (:obj:`bool`): :obj:`True`, if the poll is closed.
        is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous.
        type (:obj:`str`): Poll type, currently can be :attr:`REGULAR` or :attr:`QUIZ`.
        allows_multiple_answers (:obj:`bool`): :obj:`True`, if the poll allows multiple answers.
        members_only (:obj:`bool`): :obj:`True`, if voting is limited to users who have been
            members of the chat where the poll was originally sent for more than
            :tg-const:`telegram.Poll.MIN_MEMBERSHIP_HOURS` hours.

            .. versionadded:: 22.8
        explanation (:obj:`str`): Optional. Text that is shown when a user chooses an incorrect
            answer or taps on the lamp icon in a quiz-style poll,
            0-:tg-const:`telegram.Poll.MAX_EXPLANATION_LENGTH` characters.
        explanation_entities (tuple[:class:`telegram.MessageEntity`]): Special entities
            like usernames, URLs, bot commands, etc. that appear in the :attr:`explanation`.
            This list is empty if the message does not contain explanation entities.

            .. versionchanged:: 20.0
                |tupleclassattrs|

            .. versionchanged:: 20.0
               This attribute is now always a (possibly empty) list and never :obj:`None`.
        explanation_media (:class:`telegram.PollMedia`): Optional. Media added to the quiz
            explanation.

            .. versionadded:: 22.8
        open_period (:obj:`int` | :class:`datetime.timedelta`): Optional. Amount of time in seconds
            the poll will be active after creation.

            .. deprecated:: v22.2
                |time-period-int-deprecated|
        close_date (:obj:`datetime.datetime`): Optional. Point in time when the poll will be
            automatically closed.

            .. versionchanged:: 20.3
                |datetime_localization|
        question_entities (tuple[:class:`telegram.MessageEntity`]): Special entities
            that appear in the :attr:`question`. Currently, only custom emoji entities are allowed
            in poll questions.
            This list is empty if the question does not contain entities.

            .. versionadded:: 21.2
        allows_revoting (:obj:`bool`): :obj:`True`, if the poll
            allows to change the chosenanswer options

            .. versionadded:: 22.8
        correct_option_ids (tuple[:class:`int`]): Array of 0-based identifiers of the
            correct answer options. Available only for polls in quiz mode which are closed or were
            sent (not forwarded) by the bot or to the private chat with the bot.

            .. versionadded:: 22.8
        country_codes (tuple[:obj:`str`]): Optional. A list of two-letter ``ISO 3166-1 alpha-2``
            country codes indicating the countries from which users can vote in the poll. The
            country code ``"FT"`` is used for users with anonymous numbers. If omitted, then users
            from any country can participate in the poll.

            .. versionadded:: 22.8
        description (:obj:`str`): Optional. Description of the poll;
            for polls inside the Message object only

            .. versionadded:: 22.8
        description_entities (tuple[:class:`telegram.MessageEntity`]): Special
            entities like usernames, URLs, bot commands, etc. that appear in the description

            .. versionadded:: 22.8
        media (:class:`telegram.PollMedia`): Optional. Media added to the poll description;
            for polls inside the Message object only.

            .. versionadded:: 22.8

    )_open_periodallows_multiple_answersallows_revoting
close_datecorrect_option_idscountry_codesdescriptiondescription_entitiesexplanationexplanation_entitiesexplanation_mediaidis_anonymous	is_closedrU   members_onlyoptionsquestionquestion_entitiestotal_voter_counttypeNr2   r   r   r   r   r   r   r   r   correct_option_idr   r   open_periodr   r   r   r   r   r   r   r   rU   r   r3   c                   |t        d      |t        d      t        | 	  |       || _        || _        t        |      | _        || _        || _        || _	        t        j                  t        j                  ||      | _        || _        || _        || _        |	t%        t'        dd      d       ||	g}t        |      | _        || _        t        |      | _        |
| _        t        |      | _        t3        |      | _        || _        t        |      | _        t        |      | _        || _        || _        | j                  f| _         | jC                          y )Nz:`allows_revoting` is a required argument since Bot API 9.6z8`members_only` is a required argument since Bot API 10.0r2   r[   zRThe parameter `correct_option_id` is deprecated. Use `correct_option_ids` instead.r\   r]   )"rh   r6   r7   r   r   r   r   r   r   r   r   
get_memberr   PollTyper   r   r   r   r"   r#   r   r   r   r   r   r   r   r   r   r   rU   r   r8   r9   )r:   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rU   r   r3   r;   s                           r<   r7   zPoll.__init__  sk   B "XYYVWWJ/%/A'/J&7(".););T4H	-D$%4". (%8
  ")&7%8"3EFX3Y'2?Q @
! (3?Q @
! 3?{2K/9<NO`<a.@.O',
3D''r=   rA   c                 0    t        | j                  d      S )Nr   )	attribute)r   r   r:   s    r<   r   zPoll.open_period*  s    "4#4#4NNr=   r>   r?   r@   c                 @   | j                  |      }t        |      }t        |j                  d      t        |      |d<   t        |j                  d      t
        |      |d<   t        |j                  d      |      |d<   t        |j                  d      t
        |      |d<   t        |j                  d      t
        |      |d<   t        |j                  d      t        |      |d<   t        |j                  d      t        |      |d<   t        | )  ||	      S )
rC   r   r   r   rj   r   r   rU   r   rD   )rE   r   r   rF   ra   r   r   r   r(   r6   rG   rl   s       r<   rG   zPoll.de_json.  s    t$ 2#6
*488I+>
CPY'7HH+,mS(
#$ ,DHH\,B:V\$4HH()=#%
 ! (8HH+,mS(
#$ )'):IsKW$4TXX>Q5RT]_b$c !wDc22r=   rn   c                 \    | j                   st        d      t        | j                   |      S )a  Returns the text in :attr:`explanation` from a given :class:`telegram.MessageEntity` of
        :attr:`explanation_entities`.

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`explanation_entities`.

        Returns:
            :obj:`str`: The text of the given entity.

        Raises:
            RuntimeError: If the poll has no explanation.

        This Poll has no 'explanation'.)r   RuntimeErrorr   rp   s     r<   parse_explanation_entityzPoll.parse_explanation_entityF  s,    ( @AA#D$4$4f==r=   rr   c                 r    | j                   st        d      t        | j                   | j                  |      S )aj  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls explanation filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        Note:
            This method should always be used instead of the :attr:`explanation_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_explanation_entity` for more info.

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
            the text that belongs to them, calculated based on UTF-16 codepoints.

        Raises:
            RuntimeError: If the poll has no explanation.

        r   )r   r   r   r   rt   s     r<   parse_explanation_entitieszPoll.parse_explanation_entities_  s5    4 @AA%d&6&68Q8QSXYYr=   c                 .    t        | j                  |      S )a  Returns the text in :attr:`question` from a given :class:`telegram.MessageEntity` of
        :attr:`question_entities`.

        .. versionadded:: 21.2

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`question_entities`.

        Returns:
            :obj:`str`: The text of the given entity.
        )r   r   rp   s     r<   parse_question_entityzPoll.parse_question_entity~  s    $ $DMM6::r=   c                 D    t        | j                  | j                  |      S )a6  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls question filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        .. versionadded:: 21.2

        Note:
            This method should always be used instead of the :attr:`question_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_question_entity` for more info.

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
            the text that belongs to them, calculated based on UTF-16 codepoints.

        )r   r   r   rt   s     r<   parse_question_entitieszPoll.parse_question_entities  s    . &dmmT5K5KUSSr=   c                 \    | j                   st        d      t        | j                   |      S )a  Returns the text in :attr:`description` from a given :class:`telegram.MessageEntity` of
        :attr:`description_entities`.

        .. versionadded:: 22.8

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`description_entities`.

        Returns:
            :obj:`str`: The text of the given entity.

        Raises:
            RuntimeError: If the poll has no description.

        This Poll has no 'description'.)r   r   r   rp   s     r<   parse_description_entityzPoll.parse_description_entity  s,    , @AA#D$4$4f==r=   c                 r    | j                   st        d      t        | j                   | j                  |      S )a  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this polls description filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        .. versionadded:: 22.8

        Note:
            This method should always be used instead of the :attr:`description_entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_description_entity` for more info.

        Args:
            types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
                    ``type`` attribute of an entity is contained in this list, it will be returned.
                    Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.
        Returns:
            dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities
            mapped to the text that belongs to them, calculated based on UTF-16 codepoints.
        Raises:
            RuntimeError: If the poll has no description.
        r   )r   r   r   r   rt   s     r<   parse_description_entitieszPoll.parse_description_entities  s5    2 @AA%d&6&68Q8QSXYYr=   c                 j    t        t        dd      d       | j                  r| j                  d   S dS )a!  A zero based identifier of the correct answer
        option. Available only for closed polls in the quiz mode, which were sent
        (not forwarded), by the bot or to a private chat with the bot.

        .. deprecated:: 22.8
            Use :attr:`correct_option_ids` instead.
        r[   zRThe attribute `correct_option_id` is deprecated. Use `correct_option_ids` instead.r\   r]   r   N)r"   r#   r   r   s    r<   r   zPoll.correct_option_id  sA     	!4
 	
 .2-D-Dt&&q)N$Nr=   REGULARQUIZMAX_EXPLANATION_LENGTHMAX_EXPLANATION_LINE_FEEDSMIN_OPEN_PERIODMAX_OPEN_PERIODMIN_QUESTION_LENGTHMAX_QUESTION_LENGTHr~   r   MIN_OPTION_NUMBERMAX_OPTION_NUMBERMAX_DESCRIPTION_CHARACTERSMIN_MEMBERSHIP_HOURS)NNNNNNNNNNNNNNrJ   )3rK   rL   rM   rN   rO   r_   r   ra   rx   boolr   r!   ry   rz   r(   r   r7   property	timedeltar   rP   rG   r   r{   r|   r   r   r   r   r   r   r   r   r   r   r   r   r}   r   r   r   r   r   r   r~   r   r   r   r   r   rQ   rR   s   @r<   r   r     s   iVIH )-"&?C)-*.<@ (,$(37"&?C.2"&.2;R> '+?RR R *%	R
 R R R R "&R :R 4ZR '}5<R   $&!R" LL4'#R$ $M2T9%R* +R, Tk-R0 %SMD01R2 4Z3R4 '}5<5R6  }t+7R8 49R: %t+;R> tO?Rh OS3==047 O O 38 3, 3& 3 3.>} > >4 )-Z#Y%Z	mS 	!Z>;M ;c ;(TT#Y-= Tm]`N`Ia T2>} > >8 )-Z#Y%Z	mS 	!Z< O3: O O$ $,,44GU3Z46 ))..D%*.3)2)<)<)S)SE#JS .7-@-@-[-[c
[ #,"5"5"E"EOU3ZE #,"5"5"E"EOU3ZE '0&9&9&M&MsM '0&9&9&M&MsM %.$7$7$I$IuSzI %.$7$7$I$IuSzI %.$7$7$I$IuSzI %.$7$7$I$IuSzI .7-@-@-[-[c
[ (1':':'O'O%*Or=   r   )FrN   rz   ry   collections.abcr   typingr   r   telegramr   telegram._chatr   telegram._files.animationr   telegram._files.audior	   telegram._files.documentr
   telegram._files.livephotor   telegram._files.locationr   telegram._files.photosizer   telegram._files.stickerr   telegram._files.venuer   telegram._files.videor   telegram._messageentityr   telegram._telegramobjectr   telegram._userr   telegram._utilsr   telegram._utils.argumentparsingr   r   r   r   telegram._utils.datetimer   r   r   telegram._utils.defaultvaluer   telegram._utils.entitiesr   r   telegram._utils.typesr   r    r!   telegram._utils.warningsr"   telegram.warningsr#   r$   r%   r&   r(   rT   ra   r   r   r   r    r=   r<   <module>r     s   & F  $ '   / ' - / - / + ' ' 1 3     
 6 Q @ @ ) 3LLp3 p3fS3n S3l{ {|e3 e3PpZn pZfpZ pZfd> dr=   