
    F\h                     n    S r SSKJr  SSKJr  S/r " S S5      r\S 5       r " S S5      rSS	K	J
r
Jr  g
)zThread-local objects.

(Note that this module provides a Python version of the threading.local
 class.  Depending on the version of Python you're using, there may be a
 faster one available.  You should always import the `local` class from
 `threading`.)
    )ref)contextmanagerlocalc                   .    \ rS rSrSrSrS rS rS rSr	g)	
_localimpl   z#A class managing thread-local dicts)keydicts	localargs	locallock__weakref__c                 J    S[        [        U 5      5      -   U l        0 U l        g )Nz_threading_local._localimpl.)stridr	   r
   )selfs    '/usr/lib/python3.13/_threading_local.py__init___localimpl.__init__   s     2C4MA
    c                 L    [        5       nU R                  [        U5         S   $ )zHReturn the dict for the current thread. Raises KeyError if none
defined.   )current_threadr
   r   )r   threads     r   get_dict_localimpl.get_dict$   s$      !zz"V*%a((r   c                    ^^ 0 nU R                   n[        5       n[        U5      nU4U4S jjnU4U4S jjn[        X5      m[        X65      mTUR                  U'   TU4U R
                  U'   U$ )z8Create a new dict for the current thread, and return it.c                 6   > T" 5       nUb  UR                   U	 g g N)__dict__)_r	   r   wrthreads      r   local_deleted-_localimpl.create_dict.<locals>.local_deleted0   s!    ZF!OOC( "r   c                 R   > T" 5       nUb  UR                   R                  U5      ng g r   )r
   pop)r    idtr   dctwrlocals       r   thread_deleted._localimpl.create_dict.<locals>.thread_deleted5   s)    
 IE kkooc* !r   )r	   r   r   r   r   r
   )	r   	localdictr	   r   r&   r"   r)   r(   r!   s	          @@r   create_dict_localimpl.create_dict*   sp    	hh!j!$ 	)
 #& 	+ d*v.&"I-

3r   )r
   r	   N)
__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r,   __static_attributes__ r   r   r   r      s    -GI)r   r   c              #   \  #    [         R                  U S5      n UR                  5       nUR                     [         R                  U SU5        S v   S S S 5        g ! [         a3    UR	                  5       nUR
                  u  p4U R                  " U0 UD6   Nmf = f! , (       d  f       g = f7f)N_local__implr   )	object__getattribute__r   KeyErrorr,   r   r   r   __setattr__)r   implr'   argskws        r   _patchr?   D   s     ""48D#mmo
 
4S1 
	  # >>t"r"# 
s>   B,A B,B	B,:BB,BB,
B)%B,c                   0    \ rS rSrSrS rS rS rS rSr	g)	r   R   )r7   r   c                ,   U(       d  U(       a(  U R                   [        R                   L a  [        S5      e[        R                  U 5      n[	        5       nX4Ul        [        5       Ul        [        R                  USU5        UR                  5         U$ )Nz*Initialization arguments are not supportedr7   )
r   r8   	TypeError__new__r   r   RLockr   r;   r,   )clsr=   r>   r   r<   s        r   rD   local.__new__U   sn    BS\\V__<HII~~c"|46 	r   c                 x    [        U 5         [        R                  X5      sS S S 5        $ ! , (       d  f       g = fr   )r?   r8   r9   r   names     r   r9   local.__getattribute__c   s!    D\**46 \\s   +
9c                     US:X  a"  [        SU R                  R                  -  5      e[        U 5         [        R                  XU5      sS S S 5        $ ! , (       d  f       g = fNr   z+%r object attribute '__dict__' is read-only)AttributeError	__class__r.   r?   r8   r;   )r   rJ   values      r   r;   local.__setattr__g   sO    : =..))*+ + D\%%d%8 \\s   A
A"c                     US:X  a"  [        SU R                  R                  -  5      e[        U 5         [        R                  X5      sS S S 5        $ ! , (       d  f       g = frM   )rN   rO   r.   r?   r8   __delattr__rI   s     r   rS   local.__delattr__o   sM    : =..))*+ + D\%%d1 \\s   A
A!r5   N)
r.   r/   r0   r1   r3   rD   r9   r;   rS   r4   r5   r   r   r   r   R   s    *I792r   )r   rE   N)r2   weakrefr   
contextlibr   __all__r   r?   r   	threadingr   rE   r5   r   r   <module>rY      sK     %)) )X 
 
#2 #2L , +r   