Iterates through the given samples, generating schemas
    and merging them, returning the resulting merged schema.
326359
def generate_and_merge_schemas(samples):
    
    merged = generate_schema_for_sample(next(iter(samples)))

    for sample in samples:
        merged = merge_schema(merged, generate_schema_for_sample(sample))

    return merged
123807
def _createSchemaFiles(self, destPath, schemasPath):
        
        # Create the target directory hierarchy, if neccessary
        ga4ghPath = os.path.join(destPath, 'ga4gh')
        if not os.path.exists(ga4ghPath):
            os.mkdir(ga4ghPath)
        ga4ghSchemasPath = os.path.join(ga4ghPath, 'schemas')
        if not os.path.exists(ga4ghSchemasPath):
            os.mkdir(ga4ghSchemasPath)
        ga4ghSchemasGa4ghPath = os.path.join(ga4ghSchemasPath, 'ga4gh')
        if not os.path.exists(ga4ghSchemasGa4ghPath):
            os.mkdir(ga4ghSchemasGa4ghPath)
        ga4ghSchemasGooglePath = os.path.join(ga4ghSchemasPath, 'google')
        if not os.path.exists(ga4ghSchemasGooglePath):
            os.mkdir(ga4ghSchemasGooglePath)
        ga4ghSchemasGoogleApiPath = os.path.join(
            ga4ghSchemasGooglePath, 'api')
        if not os.path.exists(ga4ghSchemasGoogleApiPath):
            os.mkdir(ga4ghSchemasGoogleApiPath)

        # rewrite the proto files to the destination
        for root, dirs, files in os.walk(schemasPath):
            for protoFilePath in fnmatch.filter(files, '*.proto'):
                src = os.path.join(root, protoFilePath)
                dst = os.path.join(
                    ga4ghSchemasPath,
                    os.path.relpath(root, schemasPath), protoFilePath)
                self._copySchemaFile(src, dst)
286720
def prepare_bcbio_samples(sample):
    
    logger.info("Preparing %s files %s to merge into %s." % (sample['name'], sample['files'], sample['out_file']))
    if sample['fn'] == "fq_merge":
        out_file = fq_merge(sample['files'], sample['out_file'], sample['config'])
    elif sample['fn'] == "bam_merge":
        out_file = bam_merge(sample['files'], sample['out_file'], sample['config'])
    elif sample['fn'] == "query_gsm":
        out_file = query_gsm(sample['files'], sample['out_file'], sample['config'])
    elif sample['fn'] == "query_srr":
        out_file = query_srr(sample['files'], sample['out_file'], sample['config'])
    sample['out_file'] = out_file
    return [sample]
516199
public static <T> void mergeFrom(byte[] data, int offset, int len, T message,
            Schema<T> schema, XMLInputFactory inFactory)
    {
        final ByteArrayInputStream in = new ByteArrayInputStream(data, offset, len);
        try
        {
            mergeFrom(in, message, schema, inFactory);
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
    }
947675
def update_schemas(self, schemas):
        
        self.schemas.update((_lower(d), _lower(s)) for (d, s) in schemas)
1272591
def fromSchema(self, schema):
        ''' 
        '''  
        ns = schema.getTargetNamespace()
        assert self.targetNamespace is None or self.targetNamespace == ns,\
            'SchemaDescription instance represents %s, not %s'\
            %(self.targetNamespace, ns)

        if self.targetNamespace is None:
            self.targetNamespace = ns
 
        self.classHead.ns = self.classFoot.ns = ns
        for item in [t for t in schema.types if t.getAttributeName() not in self.__types]:
            self.__types.append(item.getAttributeName())
            self.items.append(TypeWriter(do_extended=self.do_extended, extPyClasses=self.extPyClasses))
            self.items[-1].fromSchemaItem(item)

        for item in [e for e in schema.elements if e.getAttributeName() not in self.__elements]:
            self.__elements.append(item.getAttributeName())
            self.items.append(ElementWriter(do_extended=self.do_extended))
            self.items[-1].fromSchemaItem(item)
386863
@Override
    public DataSet sample(int numSamples, org.nd4j.linalg.api.rng.Random rng, boolean withReplacement) {
        Set<Integer> added = new HashSet<>();
        List<DataSet> toMerge = new ArrayList<>();
        boolean terminate = false;
        for (int i = 0; i < numSamples && !terminate; i++) {
            int picked = rng.nextInt(numExamples());
            if (!withReplacement) {
                while (added.contains(picked)) {
                    picked = rng.nextInt(numExamples());
                    if(added.size() == numExamples()){
                        terminate = true;
                        break;
                    }
                }
            }
            added.add(picked);
            toMerge.add(get(picked));
        }
        return DataSet.merge(toMerge);
    }
362941
def generate(schema_file, all_options):
    ''''''
    schema = load_schema_file(open(schema_file, 'r'))
    config_parser = generate_config_parser(schema, include_all=all_options)
    config_parser.write(sys.stdout)
511953
def _fill_schemas_from_definitions(self, obj):
        
        if obj.get('definitions'):
            self.schemas.clear()
            all_of_stack = []
            for name, definition in obj['definitions'].items():
                if 'allOf' in definition:
                    all_of_stack.append((name, definition))
                else:
                    self.schemas.create_schema(
                        definition, name, SchemaTypes.DEFINITION, root=self)
            while all_of_stack:
                name, definition = all_of_stack.pop(0)
                self.schemas.create_schema(
                    definition, name, SchemaTypes.DEFINITION, root=self)
776397
private static void generateSchema(SQLiteDatabaseSchema schema) throws FileNotFoundException, IOException {
		// when we run in JUNIT of Kripton, we don't have to generate schemas
		// if (BindDataSourceSubProcessor.JUNIT_TEST_MODE)
		// return;
		if (!schema.generateSchema)
			return;

		// and now, write schema.create.v and schema.drop.v
		String schemaCreation = defineFileName(schema);

		String schemaLocation = KriptonOptions.getSchemaLocation();

		File schemaCreatePath = new File(schemaLocation).getAbsoluteFile();
		File schemaCreateFile = new File(schemaLocation, schemaCreation).getAbsoluteFile();
		schemaCreatePath.mkdirs();

		AnnotationProcessorUtilis.infoOnGeneratedFile(BindDataSource.class, schemaCreateFile);
		FileOutputStream fos = new FileOutputStream(schemaCreateFile);
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));

		bw.write("------------------------------------------------------------------------------------\n");
		bw.write("--\n");
		bw.write("-- Filename: " + schemaCreation + "\n");
		bw.write("--\n");
		bw.write(String.format("-- Date: %s", (new Date()).toString()) + "\n");
		bw.write("--\n");
		if (!BindDataSourceSubProcessor.JUNIT_TEST_MODE) {
			bw.write(String.format("-- This file was generated by Kripton Annotation Processor v. %s\n",
					Version.getVersion()));
			bw.write(String.format("--\n"));
		}
		bw.write("------------------------------------------------------------------------------------\n");
		bw.newLine();
		for (String sql : schema.sqlForCreate) {
			bw.write(sql);
			bw.newLine();
		}
		bw.close();
	}
149462
def _flatten_schema(schema):
    
    def _flatten(schema, parent_path, result):
        
        for path, value in schema.items():
            # for supporting schemas like Product.user: {...},
            # we transform, say, Product.user to 'user' string
            if isinstance(path, InstrumentedAttribute):
                path = path.key

            if isinstance(value, tuple):
                join_method, inner_schema = value[0], value[1]
            elif isinstance(value, dict):
                join_method, inner_schema = JOINED, value
            else:
                join_method, inner_schema = value, None

            full_path = parent_path + '.' + path if parent_path else path
            result[full_path] = join_method

            if inner_schema:
                _flatten(inner_schema, full_path, result)

    result = {}
    _flatten(schema, '', result)
    return result
1102412
private static Map<String, Type> flatten(Schema schema) throws SchemaConversionException {
    Map<String, Type> flattened = new LinkedHashMap<>();
    Schema recordSchema = determineType(schema);

    Preconditions.checkArgument(Type.RECORD.equals(recordSchema.getType()), "%s is expected. Schema: %s",
        Type.RECORD, recordSchema);

    for (Field f : recordSchema.getFields()) {
      produceFlattenedHelper(f, flattened);
    }
    return flattened;
  }
1094822
def partition_schema(self):
        
        schema = self.schema()
        name_to_type = dict(zip(schema.names, schema.types))

        result = self.partitions()

        partition_fields = []
        for x in result.columns:
            if x not in name_to_type:
                break
            partition_fields.append((x, name_to_type[x]))

        pnames, ptypes = zip(*partition_fields)
        return sch.Schema(pnames, ptypes)
880618
public final static Sample append(List<Sample> samples) {
        if (samples.size() == 0) {
            return buildSample(0, new double[0]);
        }

        int sampleCount = 0;

        // append voices to each other
        double[] first = samples.get(0).getInterleavedSamples();
        sampleCount += samples.get(0).getSampleCount();

        double[][] samples_ary = new double[samples.size() - 1][];
        for (int i = 0; i < samples_ary.length; i++) {
            samples_ary[i] = samples.get(i + 1).getInterleavedSamples();
            sampleCount += samples.get(i + 1).getSampleCount();
        }

        double[] appended = concatAll(first, samples_ary);

        return buildSample(sampleCount, appended);
    }
1275019
public void deploySchema(String generatedProtobufName, RemoteCache<String, String> protobufCache, SchemaCapture schemaCapture, SchemaOverride schemaOverrideService,
			URL schemaOverrideResource) {
		// user defined schema
		if ( schemaOverrideService != null || schemaOverrideResource != null ) {
			cachedSchema = new SchemaValidator( this, schemaOverrideService, schemaOverrideResource, generatedProtobufName ).provideSchema();
		}

		// or generate them
		generateProtoschema();

		try {
			protobufCache.put( generatedProtobufName, cachedSchema );
			String errors = protobufCache.get( generatedProtobufName + ".errors" );
			if ( errors != null ) {
				throw LOG.errorAtSchemaDeploy( generatedProtobufName, errors );
			}
			LOG.successfulSchemaDeploy( generatedProtobufName );
		}
		catch (HotRodClientException hrce) {
			throw LOG.errorAtSchemaDeploy( generatedProtobufName, hrce );
		}
		if ( schemaCapture != null ) {
			schemaCapture.put( generatedProtobufName, cachedSchema );
		}
	}
562622
function generate(schema) {
  const ret = [];
  if (!validate(schema)) {
    return ret;
  }

  const fullSample = jsf(schema);
  if (!fullSample) {
    return ret;
  }

  ret.push({
    valid: true,
    data: fullSample,
    message: 'should work with all required properties'
  });

  ret.push(...generateFromRequired(schema));
  ret.push(...generateFromRequired(schema, false));
  ret.push(...generateForTypes(schema));

  return ret;
}
1013185
def create(self, iterations: int = 1) -> List[JSON]:
        
        return [self.schema() for _ in range(iterations)]