Files
old-saburly-wagtail-web/env/lib/python3.10/site-packages/asgiref/__pycache__/local.cpython-310.pyc

49 lines
4.1 KiB
Plaintext
Raw Normal View History

2024-08-27 20:33:44 +02:00
o
<00><><EFBFBD>f<EFBFBD><00>@sTddlZddlZddlZddlZddlmZmZmZGdd<04>d<04>ZGdd<06>d<06>Z dS)<07>N)<03>Any<6E>Dict<63>UnioncsReZdZdZddd<05>Zdd<07>Zded eddf<06>fd
d <0B> Zdeddfd d <0A>Z <09>Z
S)<0F>_CVarzStorage utility for Local.<2E>returnNcCst<00>d<01>|_dS)Nz asgiref.local)<03> contextvars<72>
ContextVar<EFBFBD>_data<74><01>self<6C>r <00>O/home/amir/Desktop/saburlyweb/env/lib/python3.10/site-packages/asgiref/local.py<70>__init__ s
<EFBFBD>z_CVar.__init__cCs8|j<00>i<00>}z||WStyt|<00>d|<01><02><03><01>w<00>Nz object has no attribute )r <00>get<65>KeyError<6F>AttributeError<6F>r <00>key<65>storage_objectr r r <00> __getattr__s 
 <02>z_CVar.__getattr__r<00>valuecs:|dkr t<00><00>||<02>S|j<02>i<00>}|||<|j<02>|<03>dS)Nr )<05>super<65> __setattr__r r<00>set)r rrr<00><01> __class__r r rs
 z_CVar.__setattr__cCs<|j<00>i<00>}||vr||=|j<00>|<02>dSt|<00>d|<01><02><03><01>r)r rrrrr r r <00> __delattr__s
z_CVar.__delattr__)rN) <0B>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rr<00>strrrr<00> __classcell__r r rr rs 
rcsReZdZdZddeddfdd<07>Zejdd <09><00>Zd
d <0B>Z <09>fd d <0A>Z
dd<0F>Z <0B>Z S)<11>LocalaLocal 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_criticalrNcCs2||_t<01><02>|_||rt<01><04>|_dSt<06>|_dS<00>N)<07>_thread_critical<61> threading<6E>RLock<63> _thread_lock<63>local<61>_storager)r r%r r r rDs 
 zLocal.__init__ccs<><00>|jr+zt<01><02>Wnty|jVYdSwt|jd<01>s$t<06>|j_|jjVdS|j<08> |jVWd<00>dS1s>wYdS)N<>cvar) r'<00>asyncio<69>get_running_loop<6F> RuntimeErrorr,<00>hasattrrr-r*r
r r r <00> _lock_storageQs<02>  <02>

"<22>zLocal._lock_storagecCs6|<00><00><00> }t||<01>Wd<00>S1swYdSr&)r2<00>getattr<74>r r<00>storager r r rts
$<24>zLocal.__getattr__csP|dvr t<00><00>||<02>S|<00><02><00>}t|||<02>Wd<00>dS1s!wYdS)N)<04>_localr,r'r*)rrr2<00>setattr)r rrr5rr r rxs

"<22>zLocal.__setattr__cCs8|<00><00><00>}t||<01>Wd<00>dS1swYdSr&)r2<00>delattrr4r r r r~s
 "<22>zLocal.__delattr__)F) rrr r!<00>boolr<00>
contextlib<EFBFBD>contextmanagerr2rrrr#r r rr r$(s
" r$)
r.r:rr(<00>typingrrrrr$r r r r <00><module>s