#!/usr/bin/env python3
from . import model
from .meta import meta_view
class BareMeta(type):
"""
A metaclass that allows a class to be instantiated either in the usual way,
or without calling the constructor. The latter is useful if the object
will be initialized in another way, e.g. `byoc.param()` parameters that
read from the command line.
"""
class App(metaclass=BareMeta):
meta = meta_view()
[docs] def __bareinit__(self):
pass
[docs] @classmethod
def entry_point(cls):
app = cls.from_bare()
app.main()
[docs] def main(self):
raise NotImplementedError
[docs] def load(self, config_cls=None):
model.load(self, config_cls)
[docs] def reload(self, config_cls=None):
model.reload(self, config_cls)