def __init__(self, doc, uri, ptr=None): ## The SWIGPython-libSBOLc object wrapped by this Collection self.ptr = None if not ptr: # create the C object if it doesn't exist already self.ptr = libsbol.createCollection(doc.ptr, uri) else: # wrap a C object if it already exists self.ptr = ptr if self.ptr == None: raise URIError("Duplicate URI '%s'" % uri) # register the Python proxy ## the Document to which this Collection object belongs self.doc = doc self.doc._collections.append(self) # finish the Python proxy fns = (libsbol.getDNAComponentURI, libsbol.addDNAComponentToCollection, libsbol.removeDNAComponentFromCollection, libsbol.getNumDNAComponentsIn, libsbol.getNthDNAComponentIn) ## An array of zero or more instances of type DNAComponent which are members # of this Collection representing DNA segments for engineering biological # systems. For example, standard biological parts, BioBricks, pBAD, B0015, # BioBrick Scar, Insertion Element, or any other DNA segment of interest as # a building block of biological systems. This property supports Python # list-like operations, slice indexing, as well as indexing by URI. self.components = ExtendableSBOLObjectArray(self, *fns)
def __init__(self, doc, uri): # create the C object self.ptr = libsbol.createCollection(doc.ptr, uri) if self.ptr == None: raise URIError("Duplicate URI '%s'" % uri) # register the Python proxy self.doc = doc self.doc._collections.append(self) # finish the Python proxy fns = (libsbol.addDNAComponentToCollection, libsbol.getNumDNAComponentsIn, libsbol.getNthDNAComponentIn) self.components = ExtendableSBOLObjectArray(self, *fns)