API Reference for Sentaku¶
ImplementationContext¶
-
class
sentaku.
ImplementationContext
(implementations, implementation_chooser=NOTHING, strict_calls=False)¶ maintains a mapping of implementation-identification to implementations, as well as the list of currently availiable Implementations in the order of precedence.
Parameters: - implementations (collections.Mapping) –
the implementations availiable in the context
a mapping of implementation-identification to implementation
- default_choices (optional list) – the implementations that should be used by default in order of percedence
-
context
¶ alias for consistence with elements
-
classmethod
from_instances
(instances, **kw)¶ utility to create the context
by passing a ordered list of instances and turning them into implementations and the default choices
-
impl
¶ the currently active implementation
-
root
¶ alias for consistence with elements
-
use
(*args, **kwds)¶ contextmanager for controlling the currently active/usable implementations and their order of percedence
Parameters: - implementation_types (implementation-identification) – the implementations availiable within the context
- frozen (bool) – if True prevent further nesting
- implementations (collections.Mapping) –
Application Elements¶
Application elements are subclasses of sentaku.Element
.
They describe single Elements of Applications
Elements on a abstract perspective Refer to Collections, Entries and sets of actions.
Depending on implementation they can be listings, forms, rest collections/data entries, or file contents.
-
class
sentaku.
Element
(parent)¶ Base class for all application elements
Parameters: parent ( Element
orImplementationContext
) – controlling object of the element which is either a context or a surrounding element
Contextual Methods¶
-
class
sentaku.
ContextualMethod
¶ descriptor for implementing context sensitive methods and registration of their implementations
class Example(Element): action = ContextualMethod() @action.implemented_for("db") def action(self): pass @action.implemented_for("test") def action(self): pass