flexget.utils.lazy_dict module#
- class flexget.utils.lazy_dict.LazyCallee(func, keys, args, kwargs)[source]#
Bases:
NamedTuple- Parameters:
func (Callable)
keys (Sequence)
args (Sequence)
kwargs (Mapping)
- classmethod _make(iterable)#
Make a new LazyCallee object from a sequence or iterable
- _asdict()#
Return a new dict which maps field names to their values.
- _replace(**kwds)#
Return a new LazyCallee object replacing specified fields with new values
- _field_defaults = {}#
- _fields = ('func', 'keys', 'args', 'kwargs')#
- args: Sequence#
Alias for field number 2
- func: Callable#
Alias for field number 0
- keys: Sequence#
Alias for field number 1
- kwargs: Mapping#
Alias for field number 3
- class flexget.utils.lazy_dict.LazyDict(*args, **kwargs)[source]#
Bases:
MutableMapping- copy()#
- get(key, default=None, eval_lazy=True)[source]#
Add the eval_lazy keyword argument to the normal
dict.get()method.
- is_lazy(key)[source]#
Return True if value for key is lazy loading.
- Parameters:
key – Key to check
- Return type:
- register_lazy_func(func, keys, args, kwargs)[source]#
Register a list of fields to be lazily loaded by callback func.
- Parameters:
func (Callable[[Mapping], None]) – Callback function which is called when lazy key needs to be evaluated. Function call will get this LazyDict instance as a parameter. See
LazyLookupclass for more details.keys (Iterable) – List of key names that func can provide.
args (Sequence) – Arguments which will be passed to func when called.
kwargs (Mapping) – Keyword arguments which will be passed to func when called.
- _abc_impl = <_abc._abc_data object>#
- property _lazy_lookup: LazyLookup#
Return the LazyLookup instance for this LazyDict.
If one is already stored in this LazyDict, it is returned, otherwise a new one is instantiated.
- class flexget.utils.lazy_dict.LazyLookup(store)[source]#
Bases:
objectStore the information to do a lazy lookup for a LazyDict.
An instance is stored as a placeholder value for any key that can be lazily looked up. There should be one instance of this class per LazyDict.
- Parameters:
store (LazyDict)
- add_func(func, keys, args, kwargs)[source]#
- Parameters:
func (Callable)
keys (Sequence)
args (Sequence)
kwargs (Mapping)
- Return type:
None
- callee_list: list[LazyCallee]#