def make(self, *args, **kwargs): """ Allocates the necessary containers using allocate() and uses build() to make an instance which will be returned. The initialize() method of the instance will be called with the arguments and the keyword arguments. If 'mode' is in the keyword arguments it will be passed to build(). """ mode = kwargs.pop('mode', get_mode.get_default_mode()) rval = self.make_no_init(mode) if hasattr(rval, 'initialize'): rval.initialize(*args, **kwargs) return rval
def make_no_init(self, mode=None): """ Allocates the necessary containers using allocate() and uses build() with the provided mode to make an instance which will be returned. The initialize() method of the instance will not be called. """ if mode is None: mode = get_mode.get_default_mode() memo = {} self.allocate(memo) rval = self.build(mode, memo) return rval