o
    ZzjÅ  ã                   @   sÌ   U d Z ddlmZmZmZ eded�Zeded�ZG d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                   @   s–   e Zd ZdZdZdefdd„Zdefdd„Zde	fd	d
„Z
de	fdd„Zeedddefdd„ƒƒZeededefdd„ƒƒZedddefd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                 C   s
   || _ d S ©Nr	   )Úselfr
   © r   úW/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/_utils/defaultvalue.pyÚ__init__V   ó   
zDefaultValue.__init__Úreturnc                 C   ó
   t | jƒS r   )Úboolr
   ©r   r   r   r   Ú__bool__Y   r   zDefaultValue.__bool__c                 C   s   d| j › d�S )NzDefaultValue(ú)r	   r   r   r   r   Ú__str__]   s   zDefaultValue.__str__c                 C   r   r   )Úreprr
   r   r   r   r   Ú__repr__a   r   zDefaultValue.__repr__ÚobjzDefaultValue[OT]c                 C   ó   d S r   r   ©r   r   r   r   Ú	get_valued   ó   zDefaultValue.get_valuec                 C   r   r   r   r   r   r   r   r   h   r   zOT | DefaultValue[OT]c                 C   s   t | tƒr| jS | S )züShortcut 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   r   r   r   r   l   s   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r   Ústrr   r   r   Ústaticmethodr   r   r   r   r   r   r   %   s    .r   NÚDEFAULT_NONEFÚDEFAULT_FALSETÚDEFAULT_TRUEé   Ú
DEFAULT_20z	127.0.0.1Ú
DEFAULT_IPéP   Ú
DEFAULT_80)r#   Útypingr   r   r   Úobjectr   r   r   r'   Ú__annotations__r(   r   r)   r+   Úintr,   r%   r.   r   r   r   r   Ú<module>   s"   V