o
    "h                     @   s.   d Z ddlZddlmZ G dd dejZdS )aD  This module contains helper functions related to the std-lib asyncio module.

.. versionadded:: 21.11

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.
    N)Literalc                       sf   e Zd ZdZdZddeddf fddZedefd	d
Zde	d f fddZ
d fddZ  ZS )TrackedBoundedSemaphorezSimple subclass of :class:`asyncio.BoundedSemaphore` that tracks the current value of the
    semaphore. While there is an attribute ``_value`` in the superclass, it's private and we
    don't want to rely on it.
    _current_value   valuereturnNc                    s   t  | || _d S N)super__init__r   )selfr   	__class__ N/var/www/html/venv/lib/python3.10/site-packages/telegram/ext/_utils/asyncio.pyr   (   s   
z TrackedBoundedSemaphore.__init__c                 C   s   | j S r	   r   r   r   r   r   current_value,   s   z%TrackedBoundedSemaphore.current_valueTc                    s$   t   I d H  |  jd8  _dS )Nr   T)r
   acquirer   r   r   r   r   r   0   s   zTrackedBoundedSemaphore.acquirec                    s   t    |  jd7  _d S )Nr   )r
   releaser   r   r   r   r   r   5   s   
zTrackedBoundedSemaphore.release)r   )r   N)__name__
__module____qualname____doc__	__slots__intr   propertyr   r   r   r   __classcell__r   r   r   r   r       s    r   )r   asynciotypingr   BoundedSemaphorer   r   r   r   r   <module>   s   	