local

Proxy/PromiseProxy implementation.

This module contains critical utilities that needs to be loaded as soon as possible, and that shall not load any third party modules.

Parts of this module is Copyright by Werkzeug Team.

Module Contents

Classes

Proxy(self,local,args=None,kwargs=None,name=None,__doc__=None) Proxy to another object.
PromiseProxy() Proxy that evaluates object once.
class_property(self,getter=None,setter=None)
LazyModule()

Functions

_default_cls_attr(name,type_,cls_value)
try_import(module,default=None) Try to import and return module.
maybe_evaluate(obj) Attempt to evaluate promise, even if obj is not a promise.
fun_of_method(method)
fun_of_method(method)
getappattr(path) Get attribute from current_app recursively.
_compat_periodic_task_decorator(*args,**kwargs)
reclassmethod(method)
create_module(name,attrs,cls_attrs=None,pkg=None,base=LazyModule,prepare_attr=None)
recreate_module(name,compat_modules=tuple,by_module=dict,direct=dict,base=LazyModule,**attrs)
get_compat_module(pkg,name)
get_origins(defs)
_default_cls_attr(name, type_, cls_value)
try_import(module, default=None)

Try to import and return module.

Returns None if the module does not exist.

class Proxy(local, args=None, kwargs=None, name=None, __doc__=None)

Proxy to another object.

__init__(local, args=None, kwargs=None, name=None, __doc__=None)
__name__()
__qualname__()
__module__()
__doc__()
_get_class()
__class__()
_get_current_object()

Get current object.

This is useful if you want the real object behind the proxy at a time for performance reasons or because you want to pass the object into a different context.

__dict__()
__repr__()
__bool__()
__dir__()
__getattr__(name)
__setitem__(key, value)
__delitem__(key)
__setslice__(i, j, seq)
__delslice__(i, j)
__setattr__(name, value)
__delattr__(name)
__str__()
__lt__(other)
__le__(other)
__eq__(other)
__ne__(other)
__gt__(other)
__ge__(other)
__hash__()
__call__(*a, **kw)
__len__()
__getitem__(i)
__iter__()
__contains__(i)
__getslice__(i, j)
__add__(other)
__sub__(other)
__mul__(other)
__floordiv__(other)
__mod__(other)
__divmod__(other)
__pow__(other)
__lshift__(other)
__rshift__(other)
__and__(other)
__xor__(other)
__or__(other)
__div__(other)
__truediv__(other)
__neg__()
__pos__()
__abs__()
__invert__()
__complex__()
__int__()
__float__()
__oct__()
__hex__()
__index__()
__coerce__(other)
__enter__()
__exit__(*a, **kw)
__reduce__()
__cmp__(other)
__long__()
__unicode__()
class PromiseProxy

Proxy that evaluates object once.

Proxy will evaluate the object each time, while the promise will only evaluate it once.

_get_current_object()
__then__(fun, *args, **kwargs)
__evaluated__()
__maybe_evaluate__()
__evaluate__(_clean=tuple)
maybe_evaluate(obj)

Attempt to evaluate promise, even if obj is not a promise.

fun_of_method(method)
fun_of_method(method)
getappattr(path)

Get attribute from current_app recursively.

Example: getappattr('amqp.get_task_consumer').

_compat_periodic_task_decorator(*args, **kwargs)
class class_property(getter=None, setter=None)
__init__(getter=None, setter=None)
__get__(obj, type=None)
__set__(obj, value)
setter(setter)
reclassmethod(method)
class LazyModule
__getattr__(name)
__dir__()
__reduce__()
create_module(name, attrs, cls_attrs=None, pkg=None, base=LazyModule, prepare_attr=None)
recreate_module(name, compat_modules=tuple, by_module=dict, direct=dict, base=LazyModule, **attrs)
get_compat_module(pkg, name)
get_origins(defs)