1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
from stone.backend import CodeBackend
class ExamplePythonBackend(CodeBackend):
def generate(self, api):
"""Generates a module for each namespace."""
for namespace in api.namespaces.values():
# One module per namespace is created. The module takes the name
# of the namespace.
with self.output_to_relative_path('{}.py'.format(namespace.name)):
self._generate_namespace_module(namespace)
def _generate_namespace_module(self, namespace): # pylint: disable=unused-argument
self.emit('def noop():')
with self.indent():
self.emit('pass')
|