Returns a single ArchiveCoordinateModel with given G:A:V. Creates it if it does not already exist.
960871
public ArchiveCoordinateModel getSingleOrCreate(String groupId, String artifactId, String version)
    {
        ArchiveCoordinateModel archive = findSingle(groupId, artifactId, version);
        if (archive != null)
            return archive;
        else
            return create().setGroupId(groupId).setArtifactId(artifactId).setVersion(version);
    }
712607
public static Archiver createArchiver(ArchiveFormat archiveFormat, CompressionType compression) {
        CommonsArchiver archiver = new CommonsArchiver(archiveFormat);
        CommonsCompressor compressor = new CommonsCompressor(compression);

        return new ArchiverCompressorDecorator(archiver, compressor);
    }
24326
@SuppressWarnings("unchecked")
	public static <K> IModel<K> model(K o)
    {
    	if(o instanceof ODocument) return (IModel<K>)new ODocumentModel((ODocument)o);
    	else if(o instanceof ODocumentWrapper) return (IModel<K>)new ODocumentWrapperModel<ODocumentWrapper>((ODocumentWrapper)o);
    	else if(o instanceof Serializable) return (IModel<K>)Model.of((Serializable)o);
    	else throw new WicketRuntimeException(ModelUtils.class.getSimpleName()+" can't work with non serializable objects: "+o);
    }
984951
async def variant(self, elem=None, elem_type=None, params=None, wrapped=None):
        
        elem_type = elem_type if elem_type else elem.__class__
        if hasattr(elem_type, "serialize_archive"):
            elem = elem_type() if elem is None else elem
            return await elem.serialize_archive(
                self, elem=elem, elem_type=elem_type, params=params
            )

        if self.writing:
            return await self._dump_variant(
                self.iobj,
                elem=elem,
                elem_type=elem_type if elem_type else elem.__class__,
                params=params,
            )
        else:
            return await self._load_variant(
                self.iobj,
                elem_type=elem_type if elem_type else elem.__class__,
                params=params,
                elem=elem,
                wrapped=wrapped,
            )
425821
def _createGaVariant(self):
        
        ret = protocol.Variant()
        if self._creationTime:
            ret.created = self._creationTime
        if self._updatedTime:
            ret.updated = self._updatedTime
        ret.variant_set_id = self.getId()
        return ret
910658
public static OGCGeometry createFromEsriCursor(GeometryCursor gc,
			SpatialReference sr) {
		return createFromEsriCursor(gc, sr, false);
	}
852485
def _create(opener,
            format_code,
            files,
            filter_code=None,
            block_size=16384):
    """"""

    a = _archive_write_new()
    _set_write_context(a, format_code, filter_code)

    _LOGGER.debug("Opening archive (create).")
    opener(a)

# Use the standard uid/gid lookup mechanisms.
# This was set on an instance of *disk* that wasn't used. Do we still need it?
#_archive_read_disk_set_standard_lookup(disk)

    # We used to yield this, but that necessitated users always flattening the
    # response. This means we don't have to, but we still have to return an
    # enumerable in order to maintain compatibility.
    added = []

    for filepath in files:
        filepath = filepath.encode('utf-8')

        disk = libarchive.calls.archive_read.c_archive_read_disk_new()
        libarchive.calls.archive_read.c_archive_read_disk_open(
            disk,
            filepath)

        while 1:
            entry = libarchive.calls.archive_entry.c_archive_entry_new()
            r = libarchive.calls.archive_read.c_archive_read_next_header2(
                    disk,
                    entry)

            if r == libarchive.constants.archive.ARCHIVE_EOF:
                break
            elif r != libarchive.constants.archive.ARCHIVE_OK:
                message = c_archive_error_string(disk)
                raise libarchive.exception.ArchiveError(
                        "Could not build header from physical source file "
                        "during create: (%d) [%s]" %
                        (r, message))

            ae = libarchive.adapters.archive_entry.ArchiveEntry(
                        disk,
                        entry)

            # print("WRITING: [{}] {}".format(ae, ae.filetype))

            # Strip leading slash so it stores as a relative path.
            if os.path.isabs(ae.pathname) is True:
                ae.pathname = ae.pathname[1:]

            added.append(ae)

            libarchive.calls.archive_read.c_archive_read_disk_descend(disk)

            # NOTE: There's a `archive_entry_set_size()` on the underlying
            # entry type, but it doesn't appear to be necessary. The sizes
            # report perfectly fine with the [probably automatic] counting that
            # occurs just with `_archive_write_data()`.

            r = _archive_write_header(a, entry)

            if ae.filetype.IFLNK is True and os.path.islink(ae.sourcepath) is True:
                target_path = os.readlink(ae.sourcepath)
                ae.symlink_targetpath = target_path
            else:
                with open(ae.sourcepath, 'rb') as f:
                    while 1:
                        data = f.read(block_size)
                        if not data:
                            break

                        _archive_write_data(a, data)

            libarchive.calls.archive_entry.c_archive_entry_free(entry)

        libarchive.calls.archive_read.c_archive_read_close(disk)
        libarchive.calls.archive_read.c_archive_read_free(disk)

    _LOGGER.debug("Closing archive (create).")

    _archive_write_close(a)
    _archive_write_free(a)

    return added
1236194
def archive(cls):
    """"""
    req = datastore.BeginTransactionRequest()
    resp = datastore.begin_transaction(req)
    tx = resp.transaction
    req = datastore.RunQueryRequest()
    req.read_options.transaction = tx
    q = req.query
    set_kind(q, kind='Todo')
    add_projection(q, '__key__')
    set_composite_filter(q.filter,
                         datastore.CompositeFilter.AND,
                         set_property_filter(
                             datastore.Filter(),
                             'done', datastore.PropertyFilter.EQUAL, True),
                         set_property_filter(
                             datastore.Filter(),
                             '__key__', datastore.PropertyFilter.HAS_ANCESTOR,
                             default_todo_list.key))
    resp = datastore.run_query(req)
    req = datastore.CommitRequest()
    req.transaction = tx
    for result in resp.batch.entity_results:
      req.mutations.add().delete.CopyFrom(result.entity.key)
    resp = datastore.commit(req)
    return ''
878033
def create_archive(path, remove_path=True):
    
    root_path = os.path.dirname(path)
    relative_path = os.path.basename(path)
    archive_path = path + ".tar.gz"

    cmd = [["tar", "-C", root_path, "-czf", archive_path, relative_path]]
    call(cmd, env=SAFE_ENV)
    if remove_path:
        fs.remove(path)
    return archive_path
892206
@Programmatic
    public Clob downloadMetaModel() {

        final Collection<ObjectSpecification> specifications = specificationLoader.allSpecifications();

        final List<MetaModelRow> rows = Lists.newArrayList();
        for (final ObjectSpecification spec : specifications) {
            if (exclude(spec)) {
                continue;
            }
            final List<ObjectAssociation> properties = spec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.PROPERTIES);
            for (final ObjectAssociation property : properties) {
                final OneToOneAssociation otoa = (OneToOneAssociation) property;
                if (exclude(otoa)) {
                    continue;
                }
                rows.add(new MetaModelRow(spec, otoa));
            }
            final List<ObjectAssociation> associations = spec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.COLLECTIONS);
            for (final ObjectAssociation collection : associations) {
                final OneToManyAssociation otma = (OneToManyAssociation) collection;
                if (exclude(otma)) {
                    continue;
                }
                rows.add(new MetaModelRow(spec, otma));
            }
            final List<ObjectAction> actions = spec.getObjectActions(Contributed.INCLUDED);
            for (final ObjectAction action : actions) {
                if (exclude(action)) {
                    continue;
                }
                rows.add(new MetaModelRow(spec, action));
            }
        }

        Collections.sort(rows);

        final StringBuilder buf = new StringBuilder();
        buf.append(MetaModelRow.header()).append("\n");
        for (final MetaModelRow row : rows) {
            buf.append(row.asTextCsv()).append("\n");
        }
        return new Clob("metamodel.csv", mimeTypeTextCsv, buf.toString().toCharArray());
    }
903894
public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, DeploymentModelEnum deploymentModel, List<TransportEnum> transports) {
		return doCreateNewModel(groupId, artifactId, version, service, muleVersion, deploymentModel, transports, null, null, TransformerEnum.JAVA, null, null);
	}
593652
def create_archive_dir(self):
        
        archive_dir = os.path.join(self.tmp_dir, self.archive_name)
        os.makedirs(archive_dir, 0o700)
        return archive_dir
918883
def get_model(sender, model_name, model_inst, model_info, model_config):
    
    MC = get_mc()
    if MC:
        model = MC.get((MC.c.model_name==model_name) & (MC.c.uuid!=''))
        if model:
            cached_inst = __cache__.get(model_name)
            if not cached_inst or (cached_inst and cached_inst[1]!=model.uuid):
                model_inst = model.get_instance()
                M = orm.create_model(model_name, fields=eval(model_inst.fields or '[]'),
                                     indexes=eval(model_inst.indexes or '[]'),
                                     basemodel=model_inst.basemodel,
                                     __replace__=True)
                __cache__[model_name] = (M, model.uuid)

                #process extension model
                if model_inst.has_extension:
                    ext_model_name = model_name + '_extension'
                    fields = eval(model_inst.extension_fields or '[]')
                    fields.insert(0, {'name':'_parent', 'type':'OneToOne', 'reference_class':model_name, 'collection_name':'ext'})
                    ME = orm.create_model(ext_model_name, fields=fields,
                                          indexes=eval(model_inst.extension_indexes or '[]'),
                                          basemodel=model_inst.extension_model,
                                          __replace__=True)

            else:
                M = cached_inst[0]

            return M
1336524
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
		List<URL> urls = new ArrayList<>(archives.size());
		for (Archive archive : archives) {
			urls.add(archive.getUrl());
		}
		return createClassLoader(urls.toArray(new URL[0]));
	}
1180297
def create(model_config, model, vec_env, storage, takes, videoname, fps=30, sample_args=None):
    
    return RecordMovieCommand(
        model_config=model_config,
        model_factory=model,
        env_factory=vec_env,
        storage=storage,
        videoname=videoname,
        takes=takes,
        fps=fps,
        sample_args=sample_args
    )
816426
public <T> T createModel(Class<T> clazz, boolean withPolicies) throws CreateModelException {
        Erector erector = erectors.get(clazz);

        if (erector == null) {
            throw new CreateModelException("Unregistered class: " + clazz);
        }

        return createModel(erector, null, withPolicies);
    }
1101976
def _createGaVariantAnnotation(self):
        
        ret = protocol.VariantAnnotation()
        ret.created = self._creationTime
        ret.variant_annotation_set_id = self.getId()
        return ret