
    iF6                         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 erddlmZ e G d d	                      ZdS )
z\This module contains the class Defaults, which allows passing default values to Application.    N)TYPE_CHECKINGAnyNoReturnfinal)UTC)warn)PTBDeprecationWarning)LinkPreviewOptionsc                      e Zd ZdZdZddedddddfdedz  dedz  dej	        ded	edz  d
edz  dddedz  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dz  fd            Zej        dedefd            Zededz  fd            Zej        dedefd            Zededz  fd            Zej        dedefd            Zededz  fd            Zej        dedefd            Zededz  fd            Zej        dedefd            Zededz  fd            Zej        dedefd             Zededz  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dz  fd'            Zej        dedefd(            Zed+d)            Zededz  fd*            ZdS ),Defaultsa  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.

    .. versionchanged:: 22.0
        Removed deprecated arguments and properties ``disable_web_page_preview`` and ``quote``.
        Use :paramref:`link_preview_options` and :paramref:`do_quote` instead.

    Parameters:
        parse_mode (:obj:`str`, optional): |parse_mode|
        disable_notification (:obj:`bool`, optional): |disable_notification|
        allow_sending_without_reply (:obj:`bool`, optional): |allow_sending_without_reply|.
            Will be used for :attr:`telegram.ReplyParameters.allow_sending_without_reply`.
        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tzinfoblockallow_sending_without_replyprotect_contentlink_preview_optionsLinkPreviewOptions | Nonedo_quotec	                 <   || _         || _        || _        || _        || _        || _        dt          | j        j                  v r t          t          dd          d           || _
        || _        i | _        dD ]}	t          | |	          }
|

|
| j        |	<   d S )Npytzz21.10zPSupport for pytz timezones is deprecated and will be removed in future versions.)versionmessage   )r"   
stacklevel)	r   r   r   explanation_parse_moder   r   text_parse_moder   question_parse_mode)r   r   r   r   r   r   str	__class__r   r	   r   r   r   getattr)selfr   r   r   r   r   r   r   r   kwargvalues              V/Users/shanyulin/my-agent/.venv/lib/python3.11/site-packages/telegram/ext/_defaults.py__init__zDefaults.__init__   s     (22F"9T)#)!-<S/0000-#+   	 	 	 	 &:"!  

 	2 	2E D%((E ,1"5)	2 	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__   sH      **1%	
 
 	
r0   otherc                 v     t          t                    r!t           fd j        D                       S dS )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   \   K   | ]&}t          |          t          |          k    V  'd S N)r*   ).0attrr6   r+   s     r.   	<genexpr>z"Defaults.__eq__.<locals>.<genexpr>   s<      ^^twtT**geT.B.BB^^^^^^r0   F)
isinstancer   all	__slots__)r+   r6   s   ``r.   __eq__zDefaults.__eq__   sF     eX&& 	_^^^^^t~^^^^^^ur0   c                     | j         S r9   )r   r4   s    r.   api_defaultszDefaults.api_defaults   s    !!r0   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   r4   s    r.   r   zDefaults.parse_mode       
 r0   _c                      t          d          )NzBYou can not assign a new value to parse_mode after initialization.AttributeErrorr+   rF   s     r.   r   zDefaults.parse_mode   s    abbbr0   c                     | j         S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.Bot.send_poll`.
        rD   r4   s    r.   r%   zDefaults.explanation_parse_mode   rE   r0   c                      t          d          )NzNYou can not assign a new value to explanation_parse_mode after initialization.rH   rJ   s     r.   r%   zDefaults.explanation_parse_mode   s    \
 
 	
r0   c                     | j         S )z:obj:`str`: Optional. Alias for :attr:`parse_mode`, used for
        the corresponding parameter of :meth:`telegram.ReplyParameters`.
        rD   r4   s    r.   quote_parse_modezDefaults.quote_parse_mode   rE   r0   c                      t          d          )NzHYou can not assign a new value to quote_parse_mode after initialization.rH   rJ   s     r.   rN   zDefaults.quote_parse_mode   s    V
 
 	
r0   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
        rD   r4   s    r.   r&   zDefaults.text_parse_mode   s     r0   c                      t          d          )NzGYou can not assign a new value to text_parse_mode after initialization.rH   rJ   s     r.   r&   zDefaults.text_parse_mode  s    U
 
 	
r0   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
        rD   r4   s    r.   r'   zDefaults.question_parse_mode  s     r0   c                      t          d          )NzKYou can not assign a new value to question_parse_mode after initialization.rH   rJ   s     r.   r'   zDefaults.question_parse_mode  s    Y
 
 	
r0   c                     | j         S )zt:obj:`bool`: Optional. Sends the message silently. Users will
        receive a notification with no sound.
        )r   r4   s    r.   r   zDefaults.disable_notification  s    
 ))r0   c                      t          d          )NzLYou can not assign a new value to disable_notification after initialization.rH   rJ   s     r.   r   zDefaults.disable_notification"  s    Z
 
 	
r0   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   r4   s    r.   r   z$Defaults.allow_sending_without_reply(  s    
 00r0   c                      t          d          )NzSYou can not assign a new value to allow_sending_without_reply after initialization.rH   rJ   s     r.   r   z$Defaults.allow_sending_without_reply/  s    a
 
 	
r0   c                     | j         S )zj:obj:`tzinfo`: A timezone to be used for all date(time) objects appearing
        throughout PTB.
        )r   r4   s    r.   r   zDefaults.tzinfo5  s    
 |r0   c                      t          d          )Nz>You can not assign a new value to tzinfo after initialization.rH   rJ   s     r.   r   zDefaults.tzinfo<  s    ]^^^r0   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   r4   s    r.   r   zDefaults.block@  s     {r0   c                      t          d          )Nz=You can not assign a new value to block after initialization.rH   rJ   s     r.   r   zDefaults.blockH  s    \]]]r0   c                     | j         S )z:obj:`bool`: Optional. Protects the contents of the sent message from forwarding and
        saving.

        .. versionadded:: 20.0
        )r   r4   s    r.   r   zDefaults.protect_contentL  s     $$r0   c                      t          d          )NzEYou can't assign a new value to protect_content after initialization.rH   rJ   s     r.   r   zDefaults.protect_contentU  s    S
 
 	
r0   c                     | j         S )z:class:`telegram.LinkPreviewOptions`: Optional. Link preview generation options for all
        outgoing messages.

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

        .. versionadded:: 20.8
        )r   r4   s    r.   r   zDefaults.do_quoted  s     ~r0   )r1   r   ) __name__
__module____qualname____doc__r?   r   r(   booldtmr   r/   intr5   objectr@   propertydictr   rB   r   setterr   r%   rN   r&   r'   r   r   r   r   r   r    r0   r.   r   r       s!       P Pd
I "&,0 37'+<@ $12 12$J12 #Tk12 
	12
 12 &*D[12 12 :12 +12 12 12 12f
# 
 
 
 
(
F 
t 
 
 
 
 "d38n " " " X"  C$J       X  cF cx c c c c  d
       X  "
 
8 
 
 
 #"

  #*       X  
& 
X 
 
 
 

  t       X  
 
H 
 
 
 

  S4Z       X  
V 
 
 
 
  

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

 1TD[ 1 1 1 X1 !'
V 
 
 
 
 ('

 
    X ]_ _8 _ _ _ ]_ t    X \^v ^( ^ ^ ^ \^ % % % % X% 
 
H 
 
 
 

 * * * X* $+    X  r0   r   )rc   datetimere   typingr   r   r   r   telegram._utils.datetimer   telegram._utils.warningsr   telegram.warningsr	   telegramr
   r   rk   r0   r.   <module>rr      s   & c b     6 6 6 6 6 6 6 6 6 6 6 6 ( ( ( ( ( ( ) ) ) ) ) ) 3 3 3 3 3 3 ,++++++ I I I I I I I I I Ir0   