over/ag/ag.Module.pyx

20 lines
1 KiB
Cython

cdef class Module:
def __init__(self, name, provides=set(), requires=set(), common=set()):
"""
* Modules are identified by their name which has to be unique within the Aggregate's namespace.
* The provides sequence contains keywords which are copied into Aggregate's _provided list.
Two modules providing the same export can't be linked into the same Aggregate.
* The requires sequence contains keywords that have to be already present in the Aggregate's
_provided list before linking.
* All names in the Module's namespace that don't begin with an underscore will be exported
into the Aggregate's namespace.
* If you want to call one method on multiple modules, these modules must all export the method name
in their "common" set. Otherwise a name collision is raised. Their methods will be called in the
same order in which the modules were linked.
"""
self._top = None
self._name = name
self._provides = set(provides)
self._requires = set(requires)
self._common = set(common)