Return a new schema with uniq attributes

 @return [Schema]

 @api public
769279
def uniq(&block)
      if block
        new(attributes.uniq(&block))
      else
        new(attributes.uniq(&:name))
      end
    end
424730
function _uniq(a) {
        var ret = [];
        var len = a.length;
        while (len--) {
          var itm = a[len];
          if (ret.indexOf(itm) === -1) {
            ret.unshift(itm);
          }
        }
        return ret;
      }
56489
def to_input_hash
      HASH_SCHEMA.schema(
        map { |attr| [attr.name, attr.to_write_type] }.to_h
      )
    end
482544
def to_schema(self):
        
        types = set()
        generated_schemas = []
        for schema_generator in self._schema_generators:
            generated_schema = schema_generator.to_schema()
            if len(generated_schema) == 1 and 'type' in generated_schema:
                types.add(generated_schema['type'])
            else:
                generated_schemas.append(generated_schema)

        if types:
            if len(types) == 1:
                (types,) = types
            else:
                types = sorted(types)
            generated_schemas = [{'type': types}] + generated_schemas
        if len(generated_schemas) == 1:
            (result_schema,) = generated_schemas
        elif generated_schemas:
            result_schema = {'anyOf': generated_schemas}
        else:
            result_schema = {}

        return result_schema
29183
def from_hash(hash:, klass:, use_alias: false)
      validate_class_kit(klass)

      return hash.map { |i| from_hash(hash: i, klass: klass, use_alias: use_alias) } if hash.is_a?(Array)

      @hash_helper.indifferent!(hash)
      entity = klass.new
      attributes = @attribute_helper.get_attributes(klass)
      attributes.each do |attribute|
        key = use_alias ? (attribute[:alias] || attribute[:name]) : attribute[:name]
        type = attribute[:type]

        # if the hash value is nil skip it
        next if hash[key].nil?

        value = if is_class_kit?(type)
                  from_hash(hash: hash[key], klass: type, use_alias: use_alias)
                elsif type == Array
                  hash[key].map do |array_element|
                    if attribute[:collection_type].nil?
                      array_element
                    else
                      if is_class_kit?(attribute[:collection_type])
                        from_hash(hash: array_element, klass: attribute[:collection_type], use_alias: use_alias)
                      else
                        @value_helper.parse(type: attribute[:collection_type], value: array_element)
                      end
                    end
                  end
                else
                  hash[key]
                end

        entity.public_send(:"#{attribute[:name]}=", value)
      end

      entity
    end
165456
def merge(attrs)
      # deep clone of attrs
      h = to_hash

      # merge in-place
      h.deep_merge!(attrs.to_hash, overwrite_arrays: true, merge_nil_values: true)

      self.class.new(h)
    end
469381
function SchemaTypeWrapper(type) {
  var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];


  return new SchemaType(type, options);
}
249644
def make_uniq_for_step(ctx, ukeys, step, stage, full_data, clean_missing_after_seconds, to_uniq):
    """"""

    # TODO:
    # this still seems to work ok for Storage types json/bubble,
    # for DS we need to reload de dumped step to uniqify

    if not ukeys:
        return to_uniq
    else:
        uniq_data = bubble_lod_load(ctx, step, stage)
        ctx.say('Creating uniq identifiers for [' + step + '] information', 0)

        ctx.gbc.say('uniq_data:', stuff=uniq_data, verbosity=1000)

        # TODO:make: data->keyed.items
        uniq_step_res = make_uniq(ctx=ctx,
                                  ldict=to_uniq,
                                  keyed=uniq_data,
                                  uniqstr=ukeys,
                                  tag=step,
                                  full_data=full_data,
                                  remove_missing_after_seconds=clean_missing_after_seconds)

        ctx.gbc.say('uniq_step_res:', stuff=uniq_step_res, verbosity=1000)

        to_uniq_newest = get_newest_uniq(ctx.gbc, uniq_step_res)

        # TODO: selected pulled only from slice of uniq
        # PROBLEM: slice of pull is not equal to slice of newest uniq,
        # can only select keys from newest, from slice of pulled
        # need a uid list from to_transform
        # to_transform = get_gen_slice(gbc, to_transform_newest, amount, index)
        # for now not a big problem, as with 'pump' there should be no problem
        to_uniq = to_uniq_newest
        # todo make keyed.items->data
        uniq_res_list = get_uniq_list(ctx.gbc, uniq_step_res)
        reset = True
        pfr = bubble_lod_dump(ctx=ctx,
                              step=step,
                              stage=stage,
                              full_data=full_data,
                              reset=reset,
                              data_gen=uniq_res_list)

        ctx.gbc.say('saved uniq ' + step + ' data res:',
                    stuff=pfr, verbosity=700)
        return to_uniq
351040
def schema(self):
        
        attrs = self.attrs.copy()
        parts = ["CREATE", "TABLE", self.name, "(%s," % self.hash_key.schema]
        del attrs[self.hash_key.name]
        if self.range_key:
            parts.append(self.range_key.schema + ",")
            del attrs[self.range_key.name]
        if attrs:
            attr_def = ", ".join([attr.schema for attr in itervalues(attrs)])
            parts.append(attr_def + ",")

        parts.append(
            "THROUGHPUT (%d, %d))" % (self.read_throughput, self.write_throughput)
        )
        parts.extend([g.schema for g in itervalues(self.global_indexes)])
        return " ".join(parts) + ";"
552856
def schema
      OpenGraph::TYPES.each_pair do |schema, types| 
        return schema if types.include?(self.type)
      end
      nil
    end
367637
def schema
      Embedify::TYPES.each_pair do |schema, types|
        return schema if types.include?(self.type)
      end
      nil
    end
1075001
def override_attributes!(attrs={})
      @column_keys = attrs.keys
      @attrs = HashWithIndifferentAccess.new(Hash[attrs.map { |k, v| [ to_key(k), v ] }])
      @attrs.map { |k, v| define_accessor(k) }
    end
976814
def create_attributes(klass, attributes, previous_object=None):
        

        result = super(ContentType, klass).create_attributes(attributes, previous_object)

        if 'fields' not in result:
            result['fields'] = []
        return result
257115
def create
      attributes_values = arel_attributes_values(!id.nil?)

      new_id = self.class.unscoped.insert attributes_values

      self.id ||= new_id if self.class.primary_key

      IdentityMap.add(self) if IdentityMap.enabled?
      @new_record = false
      id
    end
785600
public function createSchema()
    {
        $namespaces = [];

        if ($this->_platform->supportsSchemas()) {
            $namespaces = $this->listNamespaceNames();
        }

        $sequences = [];

        if ($this->_platform->supportsSequences()) {
            $sequences = $this->listSequences();
        }

        $tables = $this->listTables();

        return new Schema($tables, $sequences, $this->createSchemaConfig(), $namespaces);
    }
935655
def hbs_attributes
      s = self.class.class_variable_get(:@@serialize)
      if s[:merge]
        attrs = s[:attrs] + self.attributes.keys
      else
        attrs = s[:attrs]
      end
      attrs.collect{|attr| attr.to_sym}.uniq
    end
1366131
def attributes
      fields.each_with_object(HashWithIndifferentAccess.new) do |field, acc|
        acc[field.alias] = field.value
      end
    end