
    i                         d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
mZmZ ddlmZmZ  ed          Z ed          Z ed          Z G d d	eeeef                   Zd
S )aO  This module contains a mutable mapping that keeps track of the keys that where accessed.

.. versionadded:: 20.0

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.
    )UserDict)	FinalGenericListMappingOptionalSetTupleTypeVarUnion)DEFAULT_NONEDefaultValue_VT_KT_Tc            	       `    e Zd ZU dZ e            Zeed<   	 dZd fdZ	de
deddf fd	Zde
ddf fd
Zdee
ee
         f         ddfdZdee
         fdZdeee
ef                  fdZde
ddfdZdee
ef         ddfdZefde
dedef fdZd fdZdddde
dee         defdZ xZS )TrackingDicta'  Mutable mapping that keeps track of which keys where accessed with write access.
    Read-access is not tracked.

    Note:
        * ``setdefault()`` and ``pop`` are considered writing only depending on whether the
            key is present
        * deleting values is considered writing
    DELETED)_write_access_keysreturnNc                 n    t                                                       t                      | _        d S N)super__init__setr   self	__class__s    f/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/telegram/ext/_utils/trackingdict.pyr   zTrackingDict.__init__5   s+    ,/EE    keyvaluec                 v    |                      |           t                                          ||           d S r   )_TrackingDict__track_writer   __setitem__)r   r!   r"   r   s      r   r%   zTrackingDict.__setitem__9   s7    3C'''''r    c                 t    |                      |           t                                          |           d S r   )r$   r   __delitem__)r   r!   r   s     r   r'   zTrackingDict.__delitem__=   s5    3C     r    c                     t          |t                    r| xj        |z  c_        d S | j                            |           d S r   )
isinstancer   r   addr   r!   s     r   __track_writezTrackingDict.__track_writeA   sK    c3 	-##s*#####'',,,,,r    c                 :    | j         }t                      | _         |S )zUReturns all keys that were write-accessed since the last time this method was called.)r   r   )r   outs     r   pop_accessed_keyszTrackingDict.pop_accessed_keysG   s    %"%%%
r    c                 H                                       } fd|D             S )z
        Returns all keys & corresponding values as set of tuples that were write-accessed since
        the last time this method was called. If a key was deleted, the value will be
        :attr:`DELETED`.
        c                 J    g | ]}|                     |j                  f S  )getr   ).0r!   r   s     r   
<listcomp>z9TrackingDict.pop_accessed_write_items.<locals>.<listcomp>T   s.    CCCsdhhsDL112CCCr    )r/   )r   keyss   ` r   pop_accessed_write_itemsz%TrackingDict.pop_accessed_write_itemsM   s0     %%''CCCCdCCCCr    c                 :    | j                             |           dS )zUse this method have the key returned again in the next call to
        :meth:`pop_accessed_write_items` or :meth:`pop_accessed_keys`
        N)r   r*   r+   s     r   mark_as_accessedzTrackingDict.mark_as_accessedV   s!     	##C(((((r    mappingc                 N    |                                 D ]\  }}|| j        |<   dS )z8Like ``update``, but doesn't count towards write access.N)itemsdata)r   r:   r!   r"   s       r   update_no_trackzTrackingDict.update_no_track^   s4    !--// 	# 	#JC"DIcNN	# 	#r    defaultc                     || v r|                      |           t          |t                    r!t                                          |          S t                                          ||          S )N)r?   )r$   r)   r   r   pop)r   r!   r?   r   s      r   rA   zTrackingDict.pope   sd    
 $;;s###g|,, 	$77;;s###ww{{3{000r    c                     |                      t          t                                                                           t                                                       d S r   )r$   r   r   r6   clearr   s    r   rC   zTrackingDict.clearp   s@    3uww||~~..///r    r   zTrackingDict[_KT, _T]c                 R    || v r| |         S |                      |           || |<   |S r   )r$   )r   r!   r?   s      r   
setdefaultzTrackingDict.setdefaultv   s7    $;;93S	r    )r   Nr   )__name__
__module____qualname____doc__objectr   r   __annotations__	__slots__r   r   r   r%   r'   r   r	   r$   r/   r   r
   r7   r9   r   r>   r   rA   rC   r   r   rE   __classcell__)r   s   @r   r   r   &   s-          VXXGU>'I2 2 2 2 2 2(s (3 (4 ( ( ( ( ( (!s !t ! ! ! ! ! !-sCH}!5 -$ - - - -3s8    D$uS#X*? D D D D)C )D ) ) ) )#wsCx'8 #T # # # # $	1 	1	1 	1 
		1 	1 	1 	1 	1 	1      0 s Xb\ ]_        r    r   N)rI   collectionsr   typingr   r   r   r   r   r	   r
   r   r   telegram._utils.defaultvaluer   r   r   r   r   r   r2   r    r   <module>rQ      s   &  !           V V V V V V V V V V V V V V V V V V V V V V C C C C C C C CgenngennWT]]V V V V V8WS#X. V V V V Vr    