Returns a StorableIndex instance which is unique or not.
16655
public StorableIndex<S> unique(boolean unique) {
        if (unique == mUnique) {
            return this;
        }
        return new StorableIndex<S>(mProperties, mDirections, unique, mClustered, false);
    }
884425
public boolean isUniqueWithExprs(Expression[] indexExprs2) {
        if (constType != UNIQUE || (indexExprs == null) || ! indexExprs.equals(indexExprs2)) {
            return false;
        }
        return true;
    }
1116602
def unique(self, token_list_x, token_list_y):
        '''
        
        '''
        x = set(list(token_list_x))
        y = set(list(token_list_y))
        return (x, y)
714491
def index(self, values=None, only_index=None):
        
        assert self.indexable, "Field not indexable"
        assert not only_index or self.has_index(only_index), "Invalid index"
        if only_index:
            only_index = only_index if isclass(only_index) else only_index.__class__

        if values is None:
            values = self.proxy_get()

        for value in values:
            if value is not None:
                needs_to_check_uniqueness = bool(self.unique)

                for index in self._indexes:
                    if only_index and not isinstance(index, only_index):
                        continue

                    index.add(value, check_uniqueness=needs_to_check_uniqueness and index.handle_uniqueness)

                    if needs_to_check_uniqueness and index.handle_uniqueness:
                        # uniqueness check is done for this value
                        needs_to_check_uniqueness = False
905970
def unique(iterable, key=None):
    
    ensure_iterable(iterable)
    key = hash if key is None else ensure_callable(key)

    def generator():
        seen = set()
        for elem in iterable:
            k = key(elem)
            if k not in seen:
                seen.add(k)
                yield elem

    return generator()
649141
public ColumnModel singleUnique(String uniqueName) {
		makeSureTableModelExist();
		DialectException.assureNotEmpty(uniqueName, "indexName can not be empty");
		this.tableModel.unique(uniqueName).columns(this.getColumnName());
		return this;
	}
475092
def check_uniqueness(self, *args):
        
        self.get_unique_index().check_uniqueness(*self.prepare_args(args, transform=False))
938526
function uniqueize(a) {
  return a.filter((elt, i) => a.indexOf(elt) === i);
}
1248096
def unique_list(input_, key=lambda x:x):
    """"""
    seen = set()
    output = []
    for x in input_:
        keyx = key(x)
        if keyx not in seen:
            seen.add(keyx)
            output.append(x)
    return output
1259126
function unique(arr) {
  var ret = [];

  for (var i = 0; i < arr.length; i++) {
    if (~ret.indexOf(arr[i])) continue;
    ret.push(arr[i]);
  }

  return ret;
}
433259
def unique(cls, iterable, key=None):
    

    if key is None:
      key = lambda x: x
    def generator():
      seen = set()
      seen_add = seen.add
      for item in iterable:
        key_val = key(item)
        if key_val not in seen:
          seen_add(key_val)
          yield item
    return cls(generator())
1329118
public UniqueModel unique(String uniqueName) {
		checkReadOnly();
		UniqueModel unique = new UniqueModel();
		unique.setName(uniqueName);
		unique.setTableModel(this);
		getUniqueConsts().add(unique);
		return unique;
	}
951372
def _get_unique_child(xtag, eltname):
    """"""
    try:
        results = xtag.findall(eltname)
        if len(results) > 1:
            raise Exception("Multiple elements found where 0/1 expected")
        elif len(results) == 1:
            return results[0]
        else:
            return None
    except Exception:
        return None
828681
function unique(list) {
  return Object.keys(list.reduce((obj, key) => {
    if (!hasProp.call(obj, key)) {
      obj[key] = true;
    }
    return obj;
  }, {}));
}
863365
def _unique_constrains(cls):
        """"""
        unique = [{c.name for c in u.columns} for u in cls.__table_args__
                  if isinstance(u, UniqueConstraint)]
        unique.extend({c.name} for c in cls.__table__.columns if c.unique)
        return unique
891263
static Frame uniqueValuesBy(Frame fr, int columnIndex) {
    Vec vec0 = fr.vec(columnIndex);
    Vec v;
    if (vec0.isCategorical()) {
      v = Vec.makeSeq(0, (long) vec0.domain().length, true);
      v.setDomain(vec0.domain());
      DKV.put(v);
    } else {
      UniqTask t = new UniqTask().doAll(vec0);
      int nUniq = t._uniq.size();
      final AstGroup.G[] uniq = t._uniq.keySet().toArray(new AstGroup.G[nUniq]);
      v = Vec.makeZero(nUniq, vec0.get_type());
      new MRTask() {
        @Override
        public void map(Chunk c) {
          int start = (int) c.start();
          for (int i = 0; i < c._len; ++i) c.set(i, uniq[i + start]._gs[0]);
        }
      }.doAll(v);
    }
    return new Frame(v);
  }
776301
public AtlasVertex getVertexForInstanceByUniqueAttribute(ClassType classType, IReferenceableInstance instance)
        throws AtlasException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Checking if there is an instance with the same unique attributes for instance {}", instance.toShortString());
        }

        AtlasVertex result = null;
        for (AttributeInfo attributeInfo : classType.fieldMapping().fields.values()) {
            if (attributeInfo.isUnique) {
                String propertyKey = getQualifiedFieldName(classType, attributeInfo.name);
                try {
                    result = findVertex(propertyKey, instance.get(attributeInfo.name),
                            Constants.ENTITY_TYPE_PROPERTY_KEY, classType.getName(),
                            Constants.STATE_PROPERTY_KEY, Id.EntityState.ACTIVE.name());
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Found vertex by unique attribute : {}={}", propertyKey, instance.get(attributeInfo.name));
                    }
                } catch (EntityNotFoundException e) {
                    //Its ok if there is no entity with the same unique value
                }
            }
        }

        return result;
    }