def impl(self, *args, **kwargs): if len(args) > 1: raise RuntimeError("Too many positional args: only one allowed, representing cell instance name") e = lookup(cpptype) c = self.__impl = e.construct() if len(args) == 1: self.__impl.name(args[0]) e.declare_params(self.__impl.params) # c.construct(args, kwargs) # print "c=", c self.inputs = c.inputs self.outputs = c.outputs self.params = c.params for k, v in kwargs.iteritems(): if k == "strand": self.__impl._set_strand(v) elif k == "connected_inputs_only": self.__impl._set_process_connected_inputs_only(v) elif isinstance(v, _cell_cpp): setattr(self.params, k, v.__impl) else: setattr(self.params, k, v) # print "now:", getattr(self.params, k) e.declare_io(self.params, self.inputs, self.outputs) try: self.__impl.verify_params() except ecto.EctoException as e: print >>sys.stderr, cpptype raise type(e)("\nCell Type: %s\nCell Name: %s\nWhat:\n%s" % (cpptype, self.__impl.name(), str(e)))
def impl(self, *args, **kwargs): if len(args) > 1: raise RuntimeError( "Too many positional args: only one allowed, representing cell instance name" ) e = lookup(cpptype) c = self.__impl = e.construct() if len(args) == 1: self.__impl.name(args[0]) e.declare_params(self.__impl.params) # c.construct(args, kwargs) #print "c=", c self.inputs = c.inputs self.outputs = c.outputs self.params = c.params for k, v in kwargs.iteritems(): if k == 'strand': self.__impl._set_strand(v) elif isinstance(v, _cell_cpp): setattr(self.params, k, v.__impl) else: setattr(self.params, k, v) # print "now:", getattr(self.params, k) e.declare_io(self.params, self.inputs, self.outputs) try: self.__impl.verify_params() except ecto.EctoException as e: print >> sys.stderr, cpptype raise type(e)('\nCell Type: %s\nCell Name: %s\nWhat:\n%s' % (cpptype, self.__impl.name(), str(e)))
def postregister(cellname, cpptypename, short_doc, inmodule): e = lookup(cpptypename) c = e.construct() c.declare_params() c.declare_io() thistype = type( cellname, (_cell_cpp,), dict( __doc__=cell_doc(short_doc, c), __module__=inmodule.__name__, inputs=c.inputs, outputs=c.outputs, params=c.params, type=c.typename, short_doc=short_doc, __init__=cellinit(cpptypename), __getitem__=cell_getitem, inspect=cell_inspect, process=cell_process, configure=cell_configure, activate=cell_activate, deactivate=cell_deactivate, name=cell_name, type_name=cell_typename, __factory=e.construct, __looks_like_a_cell__=True, ), ) inmodule.__dict__[cellname] = thistype
def postregister(cellname, cpptypename, short_doc, inmodule): e = lookup(cpptypename) c = e.construct() c.declare_params() c.declare_io() thistype = type( cellname, (_cell_cpp, ), dict(__doc__=cell_doc(short_doc, c), __module__=inmodule.__name__, inputs=c.inputs, outputs=c.outputs, params=c.params, type=c.typename, short_doc=short_doc, __init__=cellinit(cpptypename), __getitem__=cell_getitem, inspect=cell_inspect, process=cell_process, configure=cell_configure, activate=cell_activate, deactivate=cell_deactivate, name=cell_name, type_name=cell_typename, __factory=e.construct, __looks_like_a_cell__=True)) inmodule.__dict__[cellname] = thistype