deep.thread_local
Provide type to store data based on the calling thread.
ThreadLocal
Bases: Generic[T]
This type offers the ability to store a value based on the thread that accessed the value.
Source code in deep/thread_local.py
is_set
property
Check if the value is set for this thread.
:return: True if there is a value for this thread
value
property
writable
Get the value stored for the calling thread.
:return: the stored value, or the value from the default_provider
__init__(default_provider=lambda: None)
Create a new ThreadLocal value.
:param default_provider: a provider that will produce a default value
clear()
get()
Get the value stored for the calling thread.
:return: the stored value, or the value from the default_provider