class documentation

Create a namespace of context-local data. This wraps a :class:`ContextVar` containing a :class:`dict` value. This may incur a performance penalty compared to using individual context vars, as it has to copy data to avoid mutating the dict between nested contexts. :param context_var: The :class:`~contextvars.ContextVar` to use as storage for this local. If not given, one will be created. Context vars not created at the global scope may interfere with garbage collection. .. versionchanged:: 2.0 Uses ``ContextVar`` instead of a custom storage implementation.

Method __call__ Create a :class:`LocalProxy` that access an attribute on this local namespace.
Method __delattr__ Undocumented
Method __getattr__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Method __release_local__ Undocumented
Method __setattr__ Undocumented
Class Variable __slots__ Undocumented
def __call__(self, name: str, *, unbound_message: t.Optional[str] = None) -> LocalProxy: (source)

Create a :class:`LocalProxy` that access an attribute on this local namespace. :param name: Proxy this attribute. :param unbound_message: The error message that the proxy will show if the attribute isn't set.

def __delattr__(self, name: str): (source)

Undocumented

def __getattr__(self, name: str) -> t.Any: (source)

Undocumented

def __init__(self, context_var: t.Optional[ContextVar[t.Dict[str, t.Any]]] = None): (source)

Undocumented

def __iter__(self) -> t.Iterator[t.Tuple[str, t.Any]]: (source)

Undocumented

def __release_local__(self): (source)

Undocumented

def __setattr__(self, name: str, value: t.Any): (source)

Undocumented

__slots__: tuple[str, ...] = (source)

Undocumented