Ë
    jûàgÈ  ã                   ó`   — d dl Z d dlZd dlZd dlZd dlmZmZmZ  G d„ d«      Z G d„ d«      Z	y)é    N)ÚAnyÚDictÚUnionc                   óN   ‡ — e Zd ZdZd
d„Zd„ Zdededdfˆ fd„Zdeddfd	„Z	ˆ xZ
S )Ú_CVarzStorage utility for Local.ÚreturnNc                 ó8   — t        j                  d«      | _        y )Nzasgiref.local)ÚcontextvarsÚ
ContextVarÚ_data©Úselfs    úK/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/asgiref/local.pyÚ__init__z_CVar.__init__   s   € Ü?J×?UÑ?UØó@
ˆ�
ó    c                 ó~   — | j                   j                  i «      }	 ||   S # t        $ r t        | ›d|›�«      ‚w xY w©Nz object has no attribute )r   ÚgetÚKeyErrorÚAttributeError©r   ÚkeyÚstorage_objects      r   Ú__getattr__z_CVar.__getattr__   sM   € ØŸ™Ÿ™¨Ó+ˆð	NØ! #Ñ&Ð&øÜò 	NÜ  D 8Ð+DÀSÀGÐ!LÓMÐMð	Nús   �" ¢<r   Úvaluec                 ó¦   •— |dk(  rt         ‰| �  ||«      S | j                  j                  i «      }|||<   | j                  j	                  |«       y )Nr   )ÚsuperÚ__setattr__r   r   Úset)r   r   r   r   Ú	__class__s       €r   r   z_CVar.__setattr__   sH   ø€ Ø�'Š>Ü‘7Ñ& s¨EÓ2Ð2àŸ™Ÿ™¨Ó+ˆØ#ˆ�sÑØ�
‰
�‰�~Õ&r   c                 óž   — | j                   j                  i «      }||v r||= | j                   j                  |«       y t        | ›d|›�«      ‚r   )r   r   r   r   r   s      r   Ú__delattr__z_CVar.__delattr__   sK   € ØŸ™Ÿ™¨Ó+ˆØ�.Ñ Ø˜sÐ#Ø�J‰J�N‰N˜>Õ*ä  D 8Ð+DÀSÀGÐ!LÓMÐMr   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ústrr   r   r"   Ú__classcell__©r    s   @r   r   r      sA   ø„ Ù$ó
ò
Nð'˜sð '¨3ð '°4õ 'ðN˜sð N t÷ Nr   r   c                   ód   ‡ — e Zd ZdZd
deddfd„Zej                  d„ «       Zd„ Z	ˆ fd„Z
d	„ Zˆ xZS )ÚLocala  Local storage for async tasks.

    This is a namespace object (similar to `threading.local`) where data is
    also local to the current async task (if there is one).

    In async threads, local means in the same sense as the `contextvars`
    module - i.e. a value set in an async frame will be visible:

    - to other async code `await`-ed from this frame.
    - to tasks spawned using `asyncio` utilities (`create_task`, `wait_for`,
      `gather` and probably others).
    - to code scheduled in a sync thread using `sync_to_async`

    In "sync" threads (a thread with no async event loop running), the
    data is thread-local, but additionally shared with async code executed
    via the `async_to_sync` utility, which schedules async code in a new thread
    and copies context across to that thread.

    If `thread_critical` is True, then the local will only be visible per-thread,
    behaving exactly like `threading.local` if the thread is sync, and as
    `contextvars` if the thread is async. This allows genuinely thread-sensitive
    code (such as DB handles) to be kept stricly to their initial thread and
    disable the sharing across `sync_to_async` and `async_to_sync` wrapped calls.

    Unlike plain `contextvars` objects, this utility is threadsafe.
    Úthread_criticalr   Nc                 óž   — || _         t        j                  «       | _        |  |rt        j                  «       | _        y t        «       | _        y ©N)Ú_thread_criticalÚ	threadingÚRLockÚ_thread_lockÚlocalÚ_storager   )r   r,   s     r   r   zLocal.__init__D   s8   € Ø /ˆÔÜ%ŸO™OÓ-ˆÔááä%ŸO™OÓ-ˆD�Mô "›GˆD�Mr   c              #   óv  K  — | j                   r]	 t        j                  «        t        | j                  d«      st        «       | j                  _        | j                  j                  –— y | j                  5  | j                  –— d d d «       y # t        $ r | j                  –— Y y w xY w# 1 sw Y   y xY w­w)NÚcvar)	r/   ÚasyncioÚget_running_loopÚhasattrr4   r   r6   ÚRuntimeErrorr2   r   s    r   Ú_lock_storagezLocal._lock_storageQ   sŸ   è ø€ ð × Ò ð)ô ×(Ñ(Ô*ô ˜tŸ}™}¨fÔ5Ü).«�D—M‘MÔ&ð
 —m‘m×(Ñ(Ó(ð ×"Ñ"ñ $Ø—m‘mÒ#÷$ð $øô/  ò $ð
 —m‘mÔ#ð$ú÷.$ð $üs@   ‚B9�B ¤AB9Á8B-Â	B9ÂB*Â'B9Â)B*Â*B9Â-B6Â2B9c                 óf   — | j                  «       5 }t        ||«      cd d d «       S # 1 sw Y   y xY wr.   )r;   Úgetattr©r   r   Ústorages      r   r   zLocal.__getattr__t   s/   € Ø×ÑÓ!ð 	) WÜ˜7 CÓ(÷	)÷ 	)ò 	)ús   ‘'§0c                 ó’   •— |dv rt         ‰| �  ||«      S | j                  «       5 }t        |||«       d d d «       y # 1 sw Y   y xY w)N)Ú_localr4   r/   r2   )r   r   r;   Úsetattr)r   r   r   r?   r    s       €r   r   zLocal.__setattr__x   sM   ø€ ØÐLÑLÜ‘7Ñ& s¨EÓ2Ð2Ø×ÑÓ!ð 	) WÜ�G˜S %Ô(÷	)÷ 	)ñ 	)ús	   ¦=½Ac                 óf   — | j                  «       5 }t        ||«       d d d «       y # 1 sw Y   y xY wr.   )r;   Údelattrr>   s      r   r"   zLocal.__delattr__~   s/   € Ø×ÑÓ!ð 	" WÜ�G˜SÔ!÷	"÷ 	"ñ 	"ús   ‘'§0)F)r#   r$   r%   r&   Úboolr   Ú
contextlibÚcontextmanagerr;   r   r   r"   r(   r)   s   @r   r+   r+   (   sE   ø„ ññ6$¨ð $¸ó $ð ×Ññ $ó ð $òD)ô)ö"r   r+   )
r7   rF   r
   r0   Útypingr   r   r   r   r+   © r   r   ú<module>rJ      s0   ðÛ Û Û Û ß #Ñ #÷Nñ N÷@X"ò X"r   