Verify that all typedefs and groupings are unique
    Called for every statement.
    Stores all typedefs in stmt.i_typedef, groupings in stmt.i_grouping
963926
def v_grammar_unique_defs(ctx, stmt):
    
    defs = [('typedef', 'TYPE_ALREADY_DEFINED', stmt.i_typedefs),
            ('grouping', 'GROUPING_ALREADY_DEFINED', stmt.i_groupings)]
    if stmt.parent is None:
        defs.extend(
            [('feature', 'FEATURE_ALREADY_DEFINED', stmt.i_features),
             ('identity', 'IDENTITY_ALREADY_DEFINED', stmt.i_identities),
             ('extension', 'EXTENSION_ALREADY_DEFINED', stmt.i_extensions)])
    for (keyword, errcode, dict) in defs:
        for definition in stmt.search(keyword):
            if definition.arg in dict:
                other = dict[definition.arg]
                err_add(ctx.errors, definition.pos,
                        errcode, (definition.arg, other.pos))
            else:
                dict[definition.arg] = definition
543760
def unique(flags_class):
    
    if not is_flags_class_final(flags_class):
        raise TypeError('unique check can be applied only to flags classes that have members')
    if not flags_class.__member_aliases__:
        return flags_class
    aliases = ', '.join('%s -> %s' % (alias, name) for alias, name in flags_class.__member_aliases__.items())
    raise ValueError('duplicate values found in %r: %s' % (flags_class, aliases))
1129811
def _Verify(self):
    

    # If the list of expected calls is not empty, raise an exception
    if self._expected_calls_queue:
      # The last MultipleTimesGroup is not popped from the queue.
      if (len(self._expected_calls_queue) == 1 and
          isinstance(self._expected_calls_queue[0], MultipleTimesGroup) and
          self._expected_calls_queue[0].IsSatisfied()):
        pass
      else:
        raise ExpectedMethodCallsError(self._expected_calls_queue)
211154
private void verify() {
        // Copy table defs to avoid ConcurrentModificationException if we add a table.
        List<TableDefinition> definedTables = new ArrayList<>(m_tableMap.values());
        for (TableDefinition tableDef : definedTables) {
            // Copy field defs for same reason
            List<FieldDefinition> definedFields = new ArrayList<>(tableDef.getFieldDefinitions());
            for (FieldDefinition fieldDef : definedFields) {
                if (fieldDef.isLinkType()) {
                    verifyLink(tableDef, fieldDef);
                }
            }
        }
    }
303476
function unique( arr, sorted ) {
	if ( !Array.isArray( arr ) ) {
		throw new TypeError( 'unique()::invalid input argument. First argument must be an array.' );
	}
	if ( arguments.length > 1 && typeof sorted !== 'boolean' ) {
		throw new TypeError( 'unique()::invalid input argument. Second argument must be an array.' );
	}
	var len = arr.length,
		i, j,
		val;

	if ( !len ) {
		return;
	}
	if ( !sorted ) {
		arr.sort( ascending );
	}
	// Loop through the array, only incrementing a pointer when successive values are different. When a succeeding value is different, move the pointer and set the next value. In the trivial case where all array elements are unique, we incur a slight penalty in resetting the element value for each unique value. In other cases, we simply move a unique value to a new position in the array. The end result is a sorted array with unique values.
	for ( i = 1, j = 0; i < len; i++ ) {
		val = arr[ i ];
		if ( arr[ j ] !== val ) {
			j++;
			arr[ j ] = val;
		}
	}
	// Truncate the array:
	arr.length = j+1;
}
772928
def _uses_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        if not sctx.schema_data.if_features(stmt, sctx.text_mid):
            return
        grp, gid = sctx.schema_data.get_definition(stmt, sctx)
        if stmt.find1("when"):
            sn = GroupNode()
            self._add_child(sn)
        else:
            sn = self
        sn._handle_substatements(grp, gid)
        for augst in stmt.find_all("augment"):
            sn._augment_stmt(augst, sctx)
        for refst in stmt.find_all("refine"):
            sn._refine_stmt(refst, sctx)
1246485
def TYPEDEF(self, _cursor_type):
        
        _decl = _cursor_type.get_declaration()
        name = self.get_unique_name(_decl)
        if self.is_registered(name):
            obj = self.get_registered(name)
        else:
            log.debug('Was in TYPEDEF but had to parse record declaration for %s', name)
            obj = self.parse_cursor(_decl)
        return obj
642728
def _verify_forward_declarations_used(self, forward_declarations,
                                          decl_uses, file_uses):
        """"""
        for cls in forward_declarations:
            if cls in file_uses:
                if not decl_uses[cls] & USES_DECLARATION:
                    node = forward_declarations[cls]
                    msg = ("'{}' forward declared, "
                           'but needs to be #included'.format(cls))
                    self._add_warning(msg, node)
            else:
                if decl_uses[cls] == UNUSED:
                    node = forward_declarations[cls]
                    msg = "'{}' not used".format(cls)
                    self._add_warning(msg, node)
571660
private Environment checkAssign(Stmt.Assign stmt, Environment environment, EnclosingScope scope)
			throws IOException {
		Tuple<LVal> lvals = stmt.getLeftHandSide();
		Type[] types = new Type[lvals.size()];
		for (int i = 0; i != lvals.size(); ++i) {
			types[i] = checkLVal(lvals.get(i), environment);
		}
		checkMultiExpressions(stmt.getRightHandSide(), environment, new Tuple<>(types));
		return environment;
	}
310805
def uniqueify_all(init_reqs, *other_reqs):
    """"""
    union = set(init_reqs)
    for reqs in other_reqs:
        union.update(reqs)
    return list(union)
281880
function it_should_be_unique(){
        $ids = [];
        $iterations = 100;

        for($i=0; $i < $iterations; $i++){
            $ids[] = $this->getWrappedObject()->generate();
        }

        return (count(array_values($ids)) === $iterations);
    }
95280
def p_Typedef(p):
  
  p[0] = model.Typedef(type_extended_attributes=p[2], type=p[3], name=p[4])
1036911
private List<StatementGroup> copyStatementGroups(List<StatementGroup> statementGroups) {
		if (filter.excludeAllProperties()) {
			return Collections.emptyList();
		}

		List<StatementGroup> result = new ArrayList<>(statementGroups.size());
		for (StatementGroup statementGroup : statementGroups) {
			if (filter.includePropertyId(statementGroup.getProperty())) {
				result.add(copy(statementGroup));
			}
		}
		return result;
	}
553964
public boolean retainAll(CompactIntSet ints) {
        int oldSize = size();
        bitSet.and(ints.bitSet);
        return oldSize != size();
    }
1284037
def unique_field_data_types(self):
        
        data_type_names = set()
        for field in self.fields:
            if not is_void_type(field.data_type):
                if field.data_type.name in data_type_names:
                    return False
                else:
                    data_type_names.add(field.data_type.name)
        else:
            return True
1344980
def unique(seq, preserve_order=True):
    
    if preserve_order:
        # f8 by Dave Kirby
        # Order preserving
        seen = set()
        seen_add = seen.add  # lookup method only once
        return [x for x in seq if x not in seen and not seen_add(x)]
    # f9
    # Not order preserving
    return list({}.fromkeys(seq).keys())
259034
def _generate_id_maps(self, unique_stmts, poolsize=None,
                          size_cutoff=100, split_idx=None):
        """"""
        # Check arguments relating to multiprocessing
        if poolsize is None:
            logger.debug('combine_related: poolsize not set, '
                         'not using multiprocessing.')
            use_mp = False
        elif sys.version_info[0] >= 3 and sys.version_info[1] >= 4:
            use_mp = True
            logger.info('combine_related: Python >= 3.4 detected, '
                        'using multiprocessing with poolsize %d, '
                        'size_cutoff %d' % (poolsize, size_cutoff))
        else:
            use_mp = False
            logger.info('combine_related: Python < 3.4 detected, '
                        'not using multiprocessing.')
        eh = self.hierarchies['entity']
        # Make a list of Statement types
        stmts_by_type = collections.defaultdict(lambda: [])
        for idx, stmt in enumerate(unique_stmts):
            stmts_by_type[indra_stmt_type(stmt)].append((idx, stmt))

        child_proc_groups = []
        parent_proc_groups = []
        skipped_groups = 0
        # Each Statement type can be preassembled independently
        for stmt_type, stmts_this_type in stmts_by_type.items():
            logger.info('Grouping %s (%s)' %
                        (stmt_type.__name__, len(stmts_this_type)))
            stmt_by_group = self._get_stmt_by_group(stmt_type, stmts_this_type,
                                                    eh)

            # Divide statements by group size
            # If we're not using multiprocessing, then all groups are local
            for g_name, g in stmt_by_group.items():
                if len(g) < 2:
                    skipped_groups += 1
                    continue
                if use_mp and len(g) >= size_cutoff:
                    child_proc_groups.append(g)
                else:
                    parent_proc_groups.append(g)

        # Now run preassembly!
        logger.debug("Groups: %d parent, %d worker, %d skipped." %
                     (len(parent_proc_groups), len(child_proc_groups),
                      skipped_groups))

        supports_func = functools.partial(_set_supports_stmt_pairs,
                                          hierarchies=self.hierarchies,
                                          split_idx=split_idx,
                                          check_entities_match=False)

        # Check if we are running any groups in child processes; note that if
        # use_mp is False, child_proc_groups will be empty
        if child_proc_groups:
            # Get a multiprocessing context
            ctx = mp.get_context('spawn')
            pool = ctx.Pool(poolsize)
            # Run the large groups remotely
            logger.debug("Running %d groups in child processes" %
                         len(child_proc_groups))
            res = pool.map_async(supports_func, child_proc_groups)
            workers_ready = False
        else:
            workers_ready = True

        # Run the small groups locally
        logger.debug("Running %d groups in parent process" %
                     len(parent_proc_groups))
        stmt_ix_map = [supports_func(stmt_tuples)
                       for stmt_tuples in parent_proc_groups]
        logger.debug("Done running parent process groups")

        while not workers_ready:
            logger.debug("Checking child processes")
            if res.ready():
                workers_ready = True
                logger.debug('Child process group comparisons successful? %s' %
                             res.successful())
                if not res.successful():
                    raise Exception("Sorry, there was a problem with "
                                    "preassembly in the child processes.")
                else:
                    stmt_ix_map += res.get()
                logger.debug("Closing pool...")
                pool.close()
                logger.debug("Joining pool...")
                pool.join()
                logger.debug("Pool closed and joined.")
            time.sleep(1)
        logger.debug("Done.")
        # Combine all redundant map edges
        stmt_ix_map_set = set([])
        for group_ix_map in stmt_ix_map:
            for ix_pair in group_ix_map:
                stmt_ix_map_set.add(ix_pair)
        return stmt_ix_map_set