
    i                        U d Z ddlmZmZmZ  ede          Z ede          Z G d dee                   Z ed          Z	ed         e
d	<   	  ed
          Zee         e
d<   	  ed          Zee         e
d<   	  ed          Zee         e
d<   	  ed          Zee         e
d<   	  ed          Zee         e
d<   dS )a  This module contains the DefaultValue class.

.. versionchanged:: 20.0
   Previously, the contents of this module were available through the (no longer existing)
   module ``telegram._utils.helpers``.

Warning:
    Contents of this module are intended to be used internally by the library and *not* by the
    user. Changes to this module are not considered breaking changes and may not be documented in
    the changelog.
    )GenericTypeVaroverloadDVType)boundOTc                       e Zd ZdZdZdefdZdefdZde	fdZ
de	fdZeed	d
defd                        Zeed	edefd                        Zed	ddefd            ZdS )DefaultValueau  Wrapper for immutable default arguments that allows to check, if the default value was set
    explicitly. Usage::

        default_one = DefaultValue(1)
        def f(arg=default_one):
            if arg is default_one:
                print('`arg` is the default')
                arg = arg.value
            else:
                print('`arg` was set explicitly')
            print(f'`arg` = {str(arg)}')

    This yields::

        >>> f()
        `arg` is the default
        `arg` = 1
        >>> f(1)
        `arg` was set explicitly
        `arg` = 1
        >>> f(2)
        `arg` was set explicitly
        `arg` = 2

    Also allows to evaluate truthiness::

        default = DefaultValue(value)
        if default:
            ...

    is equivalent to::

        default = DefaultValue(value)
        if value:
            ...

    ``repr(DefaultValue(value))`` returns ``repr(value)`` and ``str(DefaultValue(value))`` returns
    ``f'DefaultValue({value})'``.

    Args:
        value (:class:`object`): The value of the default argument
    Attributes:
        value (:class:`object`): The value of the default argument

    valuer   c                     || _         d S Nr   )selfr   s     \/Users/shanyulin/my-agent/.venv/lib/python3.11/site-packages/telegram/_utils/defaultvalue.py__init__zDefaultValue.__init__V   s    "


    returnc                 *    t          | j                  S r   )boolr   r   s    r   __bool__zDefaultValue.__bool__Y       DJr   c                     d| j          dS )NzDefaultValue()r   r   s    r   __str__zDefaultValue.__str__]   s    ,tz,,,,r   c                 *    t          | j                  S r   )reprr   r   s    r   __repr__zDefaultValue.__repr__a   r   r   objzDefaultValue[OT]c                     d S r    r   s    r   	get_valuezDefaultValue.get_valued   s    25#r   c                     d S r   r!   r"   s    r   r#   zDefaultValue.get_valueh   s    "%#r   zOT | DefaultValue[OT]c                 >    t          | t                    r| j        n| S )zShortcut for::

            return obj.value if isinstance(obj, DefaultValue) else obj

        Args:
            obj (:obj:`object`): The object to process

        Returns:
            Same type as input, or the value of the input: The value
        )
isinstancer
   r   r"   s    r   r#   zDefaultValue.get_valuel   s     'sL99BsyysBr   N)__name__
__module____qualname____doc__	__slots__r   r   r   r   strr   r   r   staticmethodr   r#   r!   r   r   r
   r
   %   s       , ,\ I#f # # # # $        - - - - - #         5)5b555 \ X5%r%b%%% \ X%C. C2 C C C \C C Cr   r
   NDEFAULT_NONEFDEFAULT_FALSETDEFAULT_TRUE   
DEFAULT_20z	127.0.0.1
DEFAULT_IPP   
DEFAULT_80)r*   typingr   r   r   objectr   r   r
   r.   __annotations__r/   r   r0   r2   intr3   r,   r5   r!   r   r   <module>r:      sx  &
 
 
 . - - - - - - - - -		(	(	(WT   SC SC SC SC SC76? SC SC SCl $0<#5#5l4  5 5 5 0$0L$7$7|D! 7 7 7 1#/<#5#5l4  5 5 5 !-R 0 0
L 0 0 0 . ,[ 9 9
L 9 9 9
 !-R 0 0
L 0 0 0 r   