
    ՟f7?                         d Z ddlZddlmZmZmZ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 e G d	 d
             Zy)z\This module contains the class Defaults, which allows passing default values to Application.    N)AnyDictNoReturnOptionalfinal)LinkPreviewOptions)UTC)ODVInput)warn)PTBDeprecationWarningc                      e Zd ZdZdZddddedddddf
dee   dee   dee   dee   d	e	j                  d
edee   dee   ded   dee   fdZdefdZdedefdZedeeef   fd       Zedee   fd       Zej*                  dedefd       Zedee   fd       Zej*                  dedefd       Zedee   fd       Zej*                  dedefd       Zedee   fd       Zej*                  dedefd       Zedee   fd       Zej*                  dedefd        Zedee   fd!       Zej*                  dedefd"       Zedee   fd#       Zej*                  dedefd$       Zedee   fd%       Zej*                  dedefd&       Zedee   fd'       Zej*                  dedefd(       Zede	j                  fd)       Z
e
j*                  dedefd*       Z
edefd+       Z e j*                  dedefd,       Z edee   fd-       Z!e!j*                  dedefd.       Z!eded   fd/       Z"edee   fd0       Z#y)1DefaultsaT  Convenience Class to gather all parameters with a (user defined) default value

    .. seealso:: :wiki:`Architecture Overview <Architecture>`,
        :wiki:`Adding Defaults to Your Bot <Adding-defaults-to-your-bot>`

    .. versionchanged:: 20.0
        Removed the argument and attribute ``timeout``. Specify default timeout behavior for the
        networking backend directly via :class:`telegram.ext.ApplicationBuilder` instead.

    Parameters:
        parse_mode (:obj:`str`, optional): |parse_mode|
        disable_notification (:obj:`bool`, optional): |disable_notification|
        disable_web_page_preview (:obj:`bool`, optional): Disables link previews for links in this
            message. Mutually exclusive with :paramref:`link_preview_options`.

            .. deprecated:: 20.8
                Use :paramref:`link_preview_options` instead. This parameter will be removed in
                future versions.

        allow_sending_without_reply (:obj:`bool`, optional): |allow_sending_without_reply|.
            Will be used for :attr:`telegram.ReplyParameters.allow_sending_without_reply`.
        quote (:obj:`bool`, optional): |reply_quote|

            .. deprecated:: 20.8
                Use :paramref:`do_quote` instead. This parameter will be removed in future
                versions.
        tzinfo (:class:`datetime.tzinfo`, optional): A timezone to be used for all date(time)
            inputs appearing throughout PTB, i.e. if a timezone naive date(time) object is passed
            somewhere, it will be assumed to be in :paramref:`tzinfo`. If the
            :class:`telegram.ext.JobQueue` is used, this must be a timezone provided
            by the ``pytz`` module. Defaults to ``pytz.utc``, if available, and
            :attr:`datetime.timezone.utc` otherwise.
        block (:obj:`bool`, optional): Default setting for the :paramref:`BaseHandler.block`
            parameter
            of handlers and error handlers registered through :meth:`Application.add_handler` and
            :meth:`Application.add_error_handler`. Defaults to :obj:`True`.
        protect_content (:obj:`bool`, optional): |protect_content|

            .. versionadded:: 20.0
        link_preview_options (:class:`telegram.LinkPreviewOptions`, optional):
            Link preview generation options for all outgoing messages. Mutually exclusive with
            :paramref:`disable_web_page_preview`.
            This object is used for the corresponding parameter of
            :meth:`telegram.Bot.send_message`, :meth:`telegram.Bot.edit_message_text`,
            and :class:`telegram.InputTextMessageContent` if not specified. If a value is specified
            for the corresponding parameter, only those parameters of
            :class:`telegram.LinkPreviewOptions` will be overridden that are not
            explicitly set.

            Example:

                .. code-block:: python

                    from telegram import LinkPreviewOptions
                    from telegram.ext import Defaults, ExtBot

                    defaults = Defaults(
                        link_preview_options=LinkPreviewOptions(show_above_text=True)
                    )
                    chat_id = 123

                    async def main():
                        async with ExtBot("Token", defaults=defaults) as bot:
                            # The link preview will be shown above the text.
                            await bot.send_message(chat_id, "https://python-telegram-bot.org")

                            # The link preview will be shown below the text.
                            await bot.send_message(
                                chat_id,
                                "https://python-telegram-bot.org",
                                link_preview_options=LinkPreviewOptions(show_above_text=False)
                            )

                            # The link preview will be shown above the text, but the preview will
                            # show Telegram.
                            await bot.send_message(
                                chat_id,
                                "https://python-telegram-bot.org",
                                link_preview_options=LinkPreviewOptions(url="https://telegram.org")
                            )

            .. versionadded:: 20.8
        do_quote(:obj:`bool`, optional): |reply_quote|

            .. versionadded:: 20.8
    )	_allow_sending_without_reply_api_defaults_block_disable_notification	_do_quote_link_preview_options_parse_mode_protect_content_tzinfoNT
parse_modedisable_notificationdisable_web_page_previewquotetzinfoblockallow_sending_without_replyprotect_contentlink_preview_optionsr   do_quotec                    || _         || _        || _        || _        || _        || _        ||	t        d      ||
t        d      |)t        t        dd      d       t        |      | _
        n|	| _
        |t        t        dd      d       || _        n|
| _        i | _        d	D ]   }t        | |      }||| j                  |<   " y )
NzM`disable_web_page_preview` and `link_preview_options` are mutually exclusive.z-`quote` and `do_quote` are mutually exclusivez20.8z_`Defaults.disable_web_page_preview` is deprecated. Use `Defaults.link_preview_options` instead.   )
stacklevel)is_disabledz@`Defaults.quote` is deprecated. Use `Defaults.do_quote` instead.)r   r   r!   explanation_parse_moder    r   r   question_parse_mode)r   r   r   r   r   r   
ValueErrorr   r   r   r   r   r   getattr)selfr   r   r   r   r   r   r   r   r    r!   kwargvalues                Q/var/www/cvtools/html/venv/lib/python3.12/site-packages/telegram/ext/_defaults.py__init__zDefaults.__init__   s    +55I"<W)(.!0?#/4H4T_  !5LMM#/%?
  HZ4HD& *>D&%^ 	 .3DN%DN	
 	2E D%(E ,1""5)	2    returnc           
          t        | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  f      S )zBuilds a hash value for this object such that the hash of two objects is equal if and
        only if the objects are equal in terms of :meth:`__eq__`.

        Returns:
            :obj:`int` The hash value of the object.
        )	hashr   r   r   r   r   r   r   r   r*   s    r-   __hash__zDefaults.__hash__   sX       **--11

%%	
 	
r/   otherc                 f     t        t              rt         fd j                  D              S y)a"  Defines equality condition for the :class:`Defaults` object.
        Two objects of this class are considered to be equal if all their parameters
        are identical.

        Returns:
            :obj:`True` if both objects have all parameters identical. :obj:`False` otherwise.
        c              3   P   K   | ]  }t        |      t        |      k(    y wN)r)   ).0attrr5   r*   s     r-   	<genexpr>z"Defaults.__eq__.<locals>.<genexpr>   s$     ^twtT*geT.BB^s   #&F)
isinstancer   all	__slots__)r*   r5   s   ``r-   __eq__zDefaults.__eq__   s'     eX&^t~~^^^r/   c                     | j                   S r8   )r   r3   s    r-   api_defaultszDefaults.api_defaults   s    !!!r/   c                     | j                   S )z:obj:`str`: Optional. Send Markdown or HTML, if you want Telegram apps to show
        bold, italic, fixed-width text or URLs in your bot's message.
        r   r3   s    r-   r   zDefaults.parse_mode       
 r/   _c                     t        d      )NzBYou can not assign a new value to parse_mode after initialization.AttributeErrorr*   rE   s     r-   r   zDefaults.parse_mode   s    abbr/   c                     | j                   S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.Bot.send_poll`.
        rC   r3   s    r-   r&   zDefaults.explanation_parse_mode   rD   r/   c                     t        d      )NzNYou can not assign a new value to explanation_parse_mode after initialization.rG   rI   s     r-   r&   zDefaults.explanation_parse_mode   s    \
 	
r/   c                     | j                   S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.ReplyParameters`.
        rC   r3   s    r-   quote_parse_modezDefaults.quote_parse_mode  rD   r/   c                     t        d      )NzHYou can not assign a new value to quote_parse_mode after initialization.rG   rI   s     r-   rM   zDefaults.quote_parse_mode	  s    V
 	
r/   c                     | j                   S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :class:`telegram.InputPollOption`.

        .. versionadded:: 21.2
        rC   r3   s    r-   text_parse_modezDefaults.text_parse_mode       r/   c                     t        d      )NzGYou can not assign a new value to text_parse_mode after initialization.rG   rI   s     r-   rP   zDefaults.text_parse_mode  s    U
 	
r/   c                     | j                   S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.Bot.send_poll`.

        .. versionadded:: 21.2
        rC   r3   s    r-   r'   zDefaults.question_parse_mode  rQ   r/   c                     t        d      )NzKYou can not assign a new value to question_parse_mode after initialization.rG   rI   s     r-   r'   zDefaults.question_parse_mode'  s    Y
 	
r/   c                     | j                   S )zt:obj:`bool`: Optional. Sends the message silently. Users will
        receive a notification with no sound.
        )r   r3   s    r-   r   zDefaults.disable_notification-  s    
 )))r/   c                     t        d      )NzLYou can not assign a new value to disable_notification after initialization.rG   rI   s     r-   r   zDefaults.disable_notification4  s    Z
 	
r/   c                 J    | j                   r| j                   j                  S dS )z:obj:`bool`: Optional. Disables link previews for links in all outgoing
        messages.

        .. deprecated:: 20.8
            Use :attr:`link_preview_options` instead. This attribute will be removed in future
            versions.
        N)r   r%   r3   s    r-   r   z!Defaults.disable_web_page_preview:  s$     :>9S9St))55]Y]]r/   c                     t        d      )NzPYou can not assign a new value to disable_web_page_preview after initialization.rG   rI   s     r-   r   z!Defaults.disable_web_page_previewE  s    ^
 	
r/   c                     | j                   S )z:obj:`bool`: Optional. Pass :obj:`True`, if the message
        should be sent even if the specified replied-to message is not found.
        )r   r3   s    r-   r   z$Defaults.allow_sending_without_replyK  s    
 000r/   c                     t        d      )NzSYou can not assign a new value to allow_sending_without_reply after initialization.rG   rI   s     r-   r   z$Defaults.allow_sending_without_replyR  s    a
 	
r/   c                 6    | j                   | j                   S dS )z:obj:`bool`: Optional. |reply_quote|

        .. deprecated:: 20.8
            Use :attr:`do_quote` instead. This attribute will be removed in future
            versions.
        Nr   r3   s    r-   r   zDefaults.quoteX  s     "&!;t~~EEr/   c                     t        d      )Nz=You can not assign a new value to quote after initialization.rG   rI   s     r-   r   zDefaults.quoteb      \]]r/   c                     | j                   S )zj:obj:`tzinfo`: A timezone to be used for all date(time) objects appearing
        throughout PTB.
        )r   r3   s    r-   r   zDefaults.tzinfof  s    
 ||r/   c                     t        d      )Nz>You can not assign a new value to tzinfo after initialization.rG   rI   s     r-   r   zDefaults.tzinfom  s    ]^^r/   c                     | j                   S )z:obj:`bool`: Optional. Default setting for the :paramref:`BaseHandler.block` parameter
        of handlers and error handlers registered through :meth:`Application.add_handler` and
        :meth:`Application.add_error_handler`.
        )r   r3   s    r-   r   zDefaults.blockq  s     {{r/   c                     t        d      )Nz=You can not assign a new value to block after initialization.rG   rI   s     r-   r   zDefaults.blocky  r^   r/   c                     | j                   S )z:obj:`bool`: Optional. Protects the contents of the sent message from forwarding and
        saving.

        .. versionadded:: 20.0
        )r   r3   s    r-   r   zDefaults.protect_content}  s     $$$r/   c                     t        d      )NzEYou can't assign a new value to protect_content after initialization.rG   rI   s     r-   r   zDefaults.protect_content  s    S
 	
r/   c                     | j                   S )z:class:`telegram.LinkPreviewOptions`: Optional. Link preview generation options for all
        outgoing messages.

        .. versionadded:: 20.8
        )r   r3   s    r-   r    zDefaults.link_preview_options  s     )))r/   c                     | j                   S )zM:obj:`bool`: Optional. |reply_quote|

        .. versionadded:: 20.8
        r\   r3   s    r-   r!   zDefaults.do_quote  s     ~~r/   )$__name__
__module____qualname____doc__r>   r	   r   strbooldatetimer   r.   intr4   objectr?   propertyr   r   rA   r   setterr   r&   rM   rP   r'   r   r
   r   r   r   r   r   r    r!    r/   r-   r   r      s   Un
I %)/337 $"%6:*.?C#'A2SMA2 'tnA2 #+4.	A2
 ~A2 A2 A2 &.d^A2 "$A2 '';<A2 4.A2F
# 
(
F 
t 
 "d38n " "  HSM     cF cx c c       ""
 
8 
 #

  (3-     
& 
X 
 

  #     
 
H 
 

  Xc]     
V 
 
  

 *htn * *   
f 
 
 !

 ^(4. ^ ^ $$
& 
X 
 %

 1Xd^ 1 1 !''
V 
 
 (

 Fx~ F F \\^v ^( ^ ^    ]]_ _8 _ _ t   \\^v ^( ^ ^ %$ % % 
 
H 
 

 *h/C&D * * (4.  r/   r   )rj   rm   typingr   r   r   r   r   telegramr   telegram._utils.datetimer	   telegram._utils.typesr
   telegram._utils.warningsr   telegram.warningsr   r   rr   r/   r-   <module>ry      s?   & c  7 7 ' ( * ) 3 | | |r/   