§
    •MºfÈ  ã                   ón   — 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	dS )é    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¦  «        | _        d S )Nzasgiref.local)ÚcontextvarsÚ
ContextVarÚ_data©Úselfs    úL/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/asgiref/local.pyÚ__init__z_CVar.__init__   s   € Ý?JÔ?UØñ@
ô @
ˆŒ
ˆ
ˆ
ó    c                 óŒ   — | 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__   sa   € ØœŸš¨Ñ+Ô+ˆð	NØ! #Ô&Ð&øÝð 	Nð 	Nð 	NÝ  DÐ!LÐ!LÀSÐ!LÐ!LÑMÔMÐMð	Nøøøs	   œ$ ¤Ar   Úvaluec                 óÊ   •— |dk    r"t          ¦   «                              ||¦  «        S | j                             i ¦  «        }|||<   | j                             |¦  «         d S )Nr   )ÚsuperÚ__setattr__r   r   Úset)r   r   r   r   Ú	__class__s       €r   r   z_CVar.__setattr__   s]   ø€ Ø�'Š>ˆ>Ý‘7”7×&Ò& s¨EÑ2Ô2Ð2àœŸš¨Ñ+Ô+ˆØ#ˆ�sÑØŒ
�Š�~Ñ&Ô&Ð&Ð&Ð&r   c                 ó¤   — | j                              i ¦  «        }||v r||= | j                              |¦  «         d S t          | ›d|›�¦  «        ‚r   )r   r   r   r   r   s      r   Ú__delattr__z_CVar.__delattr__   s^   € ØœŸš¨Ñ+Ô+ˆØ�.Ð Ð Ø˜sÐ#ØŒJ�NŠN˜>Ñ*Ô*Ð*Ð*Ð*å  DÐ!LÐ!LÀSÐ!LÐ!LÑMÔMÐMr   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ústrr   r   r"   Ú__classcell__©r    s   @r   r   r      sª   ø€ € € € € Ø$Ð$ð
ð 
ð 
ð 
ð
Nð Nð Nð'˜sð '¨3ð '°4ð 'ð 'ð 'ð 'ð 'ð 'ðN˜sð N tð Nð Nð Nð Nð Nð Nð Nð Nr   r   c                   ó`   ‡ — 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.
    FÚthread_criticalr   Nc                 ó¦   — || _         t          j        ¦   «         | _        |  |rt          j        ¦   «         | _        d S t          ¦   «         | _        d S ©N)Ú_thread_criticalÚ	threadingÚRLockÚ_thread_lockÚlocalÚ_storager   )r   r,   s     r   r   zLocal.__init__D   sL   € Ø /ˆÔÝ%œOÑ-Ô-ˆÔàÐ6àð 	$å%œOÑ-Ô-ˆDŒMˆMˆMõ "™GœGˆDŒMˆMˆMr   c              #   ó@  K  — | j         rk	 t          j        ¦   «          t          | j        d¦  «        st          ¦   «         | j        _        | j        j        V — d S # t          $ r | j        V — Y d S w xY w| j        5  | j        V — d d d ¦  «         d S # 1 swxY w Y   d S )NÚcvar)	r/   ÚasyncioÚget_running_loopÚhasattrr4   r   r6   ÚRuntimeErrorr2   r   s    r   Ú_lock_storagezLocal._lock_storageQ   s  è è € ð Ô ð 	$ð)õ Ô(Ñ*Ô*Ð*õ ˜tœ}¨fÑ5Ô5ð 1Ý).©¬�D”MÔ&ð
 ”mÔ(Ð(Ð(Ð(Ð(Ð(øõ'  ð $ð $ð $ð
 ”mÐ#Ð#Ð#Ð#Ð#Ð#ð$øøøð. Ô"ð $ð $Ø”mÐ#Ð#Ð#ð$ð $ð $ñ $ô $ð $ð $ð $ð $ð $ð $ð $øøøð $ð $ð $ð $ð $ð $s#   ‹A ÁA2Á1A2Á<
BÂBÂBc                 ó~   — |                       ¦   «         5 }t          ||¦  «        cd d d ¦  «         S # 1 swxY w Y   d S r.   )r;   Úgetattr©r   r   Ústorages      r   r   zLocal.__getattr__t   s‚   € Ø×ÒÑ!Ô!ð 	) WÝ˜7 CÑ(Ô(ð	)ð 	)ð 	)ð 	)ñ 	)ô 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)øøøð 	)ð 	)ð 	)ð 	)ð 	)ð 	)s   •2²6¹6c                 óÐ   •— |dv r"t          ¦   «                              ||¦  «        S |                      ¦   «         5 }t          |||¦  «         d d d ¦  «         d S # 1 swxY w Y   d S )N)Ú_localr4   r/   r2   )r   r   r;   Úsetattr)r   r   r   r?   r    s       €r   r   zLocal.__setattr__x   s®   ø€ ØÐLÐLÐLÝ‘7”7×&Ò& s¨EÑ2Ô2Ð2Ø×ÒÑ!Ô!ð 	) WÝ�G˜S %Ñ(Ô(Ð(ð	)ð 	)ð 	)ñ 	)ô 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)øøøð 	)ð 	)ð 	)ð 	)ð 	)ð 	)s   ¼AÁAÁ"Ac                 ó€   — |                       ¦   «         5 }t          ||¦  «         d d d ¦  «         d S # 1 swxY w Y   d S r.   )r;   Údelattrr>   s      r   r"   zLocal.__delattr__~   s…   € Ø×ÒÑ!Ô!ð 	" WÝ�G˜SÑ!Ô!Ð!ð	"ð 	"ð 	"ñ 	"ô 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"øøøð 	"ð 	"ð 	"ð 	"ð 	"ð 	"s   •3³7º7)F)r#   r$   r%   r&   Úboolr   Ú
contextlibÚcontextmanagerr;   r   r   r"   r(   r)   s   @r   r+   r+   (   s§   ø€ € € € € ðð ð6$ð $¨ð $¸ð $ð $ð $ð $ð Ôð $ð  $ñ Ôð $ðD)ð )ð )ð)ð )ð )ð )ð )ð"ð "ð "ð "ð "ð "ð "r   r+   )
r7   rF   r
   r0   Útypingr   r   r   r   r+   © r   r   ú<module>rJ      s½   ðØ €€€Ø Ð Ð Ð Ø Ð Ð Ð Ø Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ð #ðNð Nð Nð Nð Nñ Nô Nð Nð@X"ð X"ð X"ð X"ð X"ñ X"ô X"ð X"ð X"ð X"r   