
    QiZA                         d Z ddlZddl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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DefaultsaM  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`. Defaults to
            :attr:`datetime.timezone.utc` otherwise.

            .. deprecated:: 21.10
                Support for ``pytz`` timezones is deprecated and will be removed in future
                versions.

        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                    || _         || _        || _        || _        || _        || _        dt        | j                  j                        v rt        t        dd      d       ||	t        d      ||
t        d      |)t        t        d	d
      d       t        |      | _        n|	| _        |t        t        d	d      d       || _        n|
| _        i | _        dD ]   }t        | |      }||| j                  |<   " y )Npytzz21.10zPSupport for pytz timezones is deprecated and will be removed in future versions.)versionmessage   )r$   
stacklevelzM`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.)r&   )is_disabledz@`Defaults.quote` is deprecated. Use `Defaults.do_quote` instead.)	r   r   r    explanation_parse_moder   r   text_parse_moder   question_parse_mode)r   r   r   r   r   r   str	__class__r
   r   
ValueErrorr   r   r   r   getattr)selfr   r   r   r   r   r   r   r   r   r    kwargvalues                A/app/.venv/lib/python3.12/site-packages/telegram/ext/_defaults.py__init__zDefaults.__init__   sH    +55I"<W)#)!0?S//00-#+ 	 $/4H4T_  !5LMM#/%?
  HZ4HD& *>D&%^ 	 .3DN%DN

E D%(E ,1""5)

    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    r2   __hash__zDefaults.__hash__   sX       **--11

%%	
 	
r4   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attrr:   r/   s     r2   	<genexpr>z"Defaults.__eq__.<locals>.<genexpr>   s%     ^~twtT*geT.BB~s   #&F)
isinstancer   all	__slots__)r/   r:   s   ``r2   __eq__zDefaults.__eq__   s'     eX&^t~~^^^r4   c                     | j                   S r=   )r   r8   s    r2   api_defaultszDefaults.api_defaults   s    !!!r4   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   r8   s    r2   r   zDefaults.parse_mode       
 r4   _c                     t        d      )NzBYou can not assign a new value to parse_mode after initialization.AttributeErrorr/   rJ   s     r2   r   zDefaults.parse_mode  s    abbr4   c                     | j                   S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.Bot.send_poll`.
        rH   r8   s    r2   r(   zDefaults.explanation_parse_mode  rI   r4   c                     t        d      )NzNYou can not assign a new value to explanation_parse_mode after initialization.rL   rN   s     r2   r(   zDefaults.explanation_parse_mode  s    \
 	
r4   c                     | j                   S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.ReplyParameters`.
        rH   r8   s    r2   quote_parse_modezDefaults.quote_parse_mode  rI   r4   c                     t        d      )NzHYou can not assign a new value to quote_parse_mode after initialization.rL   rN   s     r2   rR   zDefaults.quote_parse_mode  s    V
 	
r4   c                     | j                   S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :class:`telegram.InputPollOption` and
        :meth:`telegram.Bot.send_gift`.

        .. versionadded:: 21.2
        rH   r8   s    r2   r)   zDefaults.text_parse_mode   s     r4   c                     t        d      )NzGYou can not assign a new value to text_parse_mode after initialization.rL   rN   s     r2   r)   zDefaults.text_parse_mode*  s    U
 	
r4   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
        rH   r8   s    r2   r*   zDefaults.question_parse_mode0  s     r4   c                     t        d      )NzKYou can not assign a new value to question_parse_mode after initialization.rL   rN   s     r2   r*   zDefaults.question_parse_mode9  s    Y
 	
r4   c                     | j                   S )zt:obj:`bool`: Optional. Sends the message silently. Users will
        receive a notification with no sound.
        )r   r8   s    r2   r   zDefaults.disable_notification?  s    
 )))r4   c                     t        d      )NzLYou can not assign a new value to disable_notification after initialization.rL   rN   s     r2   r   zDefaults.disable_notificationF  s    Z
 	
r4   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'   r8   s    r2   r   z!Defaults.disable_web_page_previewL  s$     :>9S9St))55]Y]]r4   c                     t        d      )NzPYou can not assign a new value to disable_web_page_preview after initialization.rL   rN   s     r2   r   z!Defaults.disable_web_page_previewW  s    ^
 	
r4   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   r8   s    r2   r   z$Defaults.allow_sending_without_reply]  s    
 000r4   c                     t        d      )NzSYou can not assign a new value to allow_sending_without_reply after initialization.rL   rN   s     r2   r   z$Defaults.allow_sending_without_replyd  s    a
 	
r4   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   r8   s    r2   r   zDefaults.quotej  s     "&!;t~~EEr4   c                     t        d      )Nz=You can not assign a new value to quote after initialization.rL   rN   s     r2   r   zDefaults.quotet      \]]r4   c                     | j                   S )zj:obj:`tzinfo`: A timezone to be used for all date(time) objects appearing
        throughout PTB.
        )r   r8   s    r2   r   zDefaults.tzinfox  s    
 ||r4   c                     t        d      )Nz>You can not assign a new value to tzinfo after initialization.rL   rN   s     r2   r   zDefaults.tzinfo  s    ]^^r4   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   r8   s    r2   r   zDefaults.block  s     {{r4   c                     t        d      )Nz=You can not assign a new value to block after initialization.rL   rN   s     r2   r   zDefaults.block  ra   r4   c                     | j                   S )z:obj:`bool`: Optional. Protects the contents of the sent message from forwarding and
        saving.

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

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

        .. versionadded:: 20.8
        r_   r8   s    r2   r    zDefaults.do_quote  s     ~~r4   )$__name__
__module____qualname____doc__rC   r   r   r+   booldtmr   r3   intr9   objectrD   propertydictr   rF   r   setterr   r(   rR   r)   r*   r   r	   r   r   r   r   r   r   r     r4   r2   r   r      s   Xt
I %)/337 $ 6:*.?C#'O2SMO2 'tnO2 #+4.	O2
 ~O2 

O2 O2 &.d^O2 "$O2 '';<O2 4.O2b
# 
(
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.  r4   r   )rm   datetimero   typingr   r   r   r   telegramr   telegram._utils.datetimer   telegram._utils.typesr	   telegram._utils.warningsr
   telegram.warningsr   r   ru   r4   r2   <module>r}      s?   & c  1 1 ' ( * ) 3 N N Nr4   