mediapills.dependency_injection

Submodules

Package Contents

Classes

Container

Container DI implementation.

class Container(*args, **kw)[source]

Bases: dict

Container DI implementation.

_freeze(self) None[source]

Warm up all offsets.

__getitem__(self, key: Any) Any[source]

Return the value at specified offset.

__setitem__(self, key: Any, val: Any) None[source]

Assign a value to the specified offset.

__delitem__(self, key: Any) None[source]

Unset an offset.

clear(self) None[source]

Remove all offsets.

values(self) Any[source]

Return a new view of the dictionary’s values.

items(self) Any[source]

Return a new view of the dictionary’s items.

copy(self) Any[source]

Return a shallow copy of the dictionary.

update(self, others: Union[dict, MutableMapping]) None[source]

Update the dictionary with the key/value pairs from other, overwriting existing keys.

raw(self, key: Any) Any[source]

Get a parameter or the closure defining an object.

template(self, key: str, template: str) None[source]

Format the specified value(s) and insert them inside the string’s placeholder.

static _cp_func(func: Any) Any[source]

Make deepcopy of a function. Based on http://stackoverflow.com/a/6528148/190597 (Glenn Maynard)

service(self, key: str, mode: int = SERVICE_MODE_COMMON) Callable[source]

Assign a callable value to the specified offset.