API: jadi¶
-
jadi.interface(cls)[source]¶ Marks the decorated class as an abstract interface.
Injects following classmethods:
-
.all(context)¶ Returns a list of instances of each component in the
contextimplementing this@interfaceParameters: context ( Context) – context to look inReturns: list( cls)
-
.any(context)¶ Returns the first suitable instance implementing this
@interfaceor raisesNoImplementationErrorif none is available.Parameters: context ( Context) – context to look inReturns: cls
-
.classes()¶ Returns a list of classes implementing this
@interfaceReturns: list(class)
-
-
jadi.component(iface)[source]¶ Marks the decorated class as a component implementing the given
ifaceParameters: iface ( interface()) – the interface to implement
-
jadi.service(cls)[source]¶ Marks the decorated class as a singleton
service.Injects following classmethods:
-
class
jadi.Context(parent=None)[source]¶ An IoC container for
interface()s,service()s andcomponent()sParameters: parent ( Context) – a parent context