Group together realizations with the same unique identifier (uid)
    and yield the first representative of each group.
5616
def get_effective_rlzs(rlzs):
    
    effective = []
    for uid, group in groupby(rlzs, operator.attrgetter('uid')).items():
        rlz = group[0]
        if all(path == '@' for path in rlz.lt_uid):  # empty realization
            continue
        effective.append(
            Realization(rlz.value, sum(r.weight for r in group),
                        rlz.lt_path, rlz.ordinal, rlz.lt_uid))
    return effective
994697
def _init_groups(self):
        
        for group_id, conf in self.group_conf.items():
            self.parent_input_dict[group_id] = Queue(conf.get('input_max_size', 0))
            self.parent_output_dict[group_id] = Queue(conf.get('output_max_size', 0))
955328
def create_groups(self, *names, **kwargs):
        """"""
        return tuple(self.create_group(name, **kwargs) for name in names)
430186
def init_with_uid(self, uid):
        
        self._uid = uid
        self._brain = None
        self._catalog = None
        self._instance = None
368583
def unique(iterable):
    """"""
    seen = set()
    for item in iterable:
        if item not in seen:
            seen.add(item)
            yield item
953292
private void createInitialGroupEdges(final HashMap<AbstractJobVertex, ExecutionVertex> vertexMap)
			throws GraphConversionException {

		Iterator<Map.Entry<AbstractJobVertex, ExecutionVertex>> it = vertexMap.entrySet().iterator();

		while (it.hasNext()) {

			final Map.Entry<AbstractJobVertex, ExecutionVertex> entry = it.next();
			final AbstractJobVertex sjv = entry.getKey();
			final ExecutionVertex sev = entry.getValue();
			final ExecutionGroupVertex sgv = sev.getGroupVertex();

			// First compare number of output gates
			if (sjv.getNumberOfForwardConnections() != sgv.getEnvironment().getNumberOfOutputGates()) {
				throw new GraphConversionException("Job and execution vertex " + sjv.getName()
					+ " have different number of outputs");
			}

			if (sjv.getNumberOfBackwardConnections() != sgv.getEnvironment().getNumberOfInputGates()) {
				throw new GraphConversionException("Job and execution vertex " + sjv.getName()
					+ " have different number of inputs");
			}

			// First, build the group edges
			for (int i = 0; i < sjv.getNumberOfForwardConnections(); ++i) {
				final JobEdge edge = sjv.getForwardConnection(i);
				final AbstractJobVertex tjv = edge.getConnectedVertex();

				final ExecutionVertex tev = vertexMap.get(tjv);
				final ExecutionGroupVertex tgv = tev.getGroupVertex();
				// Use NETWORK as default channel type if nothing else is defined by the user
				ChannelType channelType = edge.getChannelType();
				boolean userDefinedChannelType = true;
				if (channelType == null) {
					userDefinedChannelType = false;
					channelType = ChannelType.NETWORK;
				}

				final DistributionPattern distributionPattern = edge.getDistributionPattern();

				// Connect the corresponding group vertices and copy the user settings from the job edge
				final ExecutionGroupEdge groupEdge = sgv.wireTo(tgv, edge.getIndexOfInputGate(), i, channelType,
					userDefinedChannelType,distributionPattern);

				final ExecutionGate outputGate = new ExecutionGate(new GateID(), sev, groupEdge, false);
				sev.insertOutputGate(i, outputGate);
				final ExecutionGate inputGate = new ExecutionGate(new GateID(), tev, groupEdge, true);
				tev.insertInputGate(edge.getIndexOfInputGate(), inputGate);
			}
		}
	}
821694
def unique(seq):
    """"""
    cleaned = []
    for each in seq:
        if each not in cleaned:
            cleaned.append(each)
    return cleaned
898894
private void refine(PermutationGroup group, Partition coarser) {
        int vertexCount = getVertexCount();

        Partition finer = equitableRefiner.refine(coarser);

        int firstNonDiscreteCell = finer.getIndexOfFirstNonDiscreteCell();
        if (firstNonDiscreteCell == -1) {
            firstNonDiscreteCell = vertexCount;
        }

        Permutation pi1 = new Permutation(firstNonDiscreteCell);

        Result result = Result.BETTER;
        if (bestExist) {
            pi1 = finer.setAsPermutation(firstNonDiscreteCell);
            result = compareRowwise(pi1);
        }

        // partition is discrete
        if (finer.size() == vertexCount) {
            if (!bestExist) {
                best = finer.toPermutation();
                first = finer.toPermutation();
                bestExist = true;
            } else {
                if (result == Result.BETTER) {
                    best = new Permutation(pi1);
                } else if (result == Result.EQUAL) {
                    group.enter(pi1.multiply(best.invert()));
                }
            }
        } else {
            if (result != Result.WORSE) {
                Set<Integer> blockCopy = finer.copyBlock(firstNonDiscreteCell);
                for (int vertexInBlock = 0; vertexInBlock < vertexCount; vertexInBlock++) {
                    if (blockCopy.contains(vertexInBlock)) {
                        Partition nextPartition = finer.splitBefore(firstNonDiscreteCell, vertexInBlock);

                        this.refine(group, nextPartition);

                        int[] permF = new int[vertexCount];
                        int[] invF = new int[vertexCount];
                        for (int i = 0; i < vertexCount; i++) {
                            permF[i] = i;
                            invF[i] = i;
                        }

                        for (int j = 0; j <= firstNonDiscreteCell; j++) {
                            int x = nextPartition.getFirstInCell(j);
                            int i = invF[x];
                            int h = permF[j];
                            permF[j] = x;
                            permF[i] = h;
                            invF[h] = i;
                            invF[x] = j;
                        }
                        Permutation pPermF = new Permutation(permF);
                        group.changeBase(pPermF);
                        for (int j = 0; j < vertexCount; j++) {
                            Permutation g = group.get(firstNonDiscreteCell, j);
                            if (g != null) {
                                blockCopy.remove(g.get(vertexInBlock));
                            }
                        }
                    }
                }
            }
        }
    }
825836
def _group_same_samples(ldetails):
    
    sample_groups = collections.defaultdict(list)
    for ldetail in ldetails:
        sample_groups[ldetail["name"]].append(ldetail)
    return sorted(sample_groups.values(), key=lambda xs: xs[0]["name"])
1068123
private Node createGroupIdLayout(Node rootNode, ArtifactDescriptor artifact) throws RepositoryException
   {
      FolderDescriptor groupId = artifact.getGroupId();
      List<String> struct_groupId = new ArrayList<String>();

      String[] items = groupId.getAsPath().split("/");

      for (String subString : items)
      {
         struct_groupId.add(subString);
      }
      Node groupIdTail = rootNode;

      for (Iterator<String> iterator = struct_groupId.iterator(); iterator.hasNext();)
      {
         String name = iterator.next();
         Node levelNode;
         // Node do not has such child nodes
         if (!groupIdTail.hasNode(name))
         {
            levelNode = groupIdTail.addNode(name, "nt:folder");
            levelNode.addMixin("exo:groupId");
         }
         else
         {
            levelNode = groupIdTail.getNode(name);
         }
         groupIdTail = levelNode;
      }

      return groupIdTail;
   }
700805
public void createUniqueData()
    {
        LoginGenerator.LoginRecord unique_login;
        unique_login = random_login_generator.createUniqueLogin("voltdb", true);
        doLogin(unique_login);
        unique_login = random_login_generator.createUniqueLogin("voltdb2", false);
        doLogin(unique_login);
    }
715989
public void renumberUniqueIDs()
   {
      int uid = firstUniqueID();
      for (T entity : this)
      {
         entity.setUniqueID(Integer.valueOf(uid++));
      }
   }
503395
def _gen_uid(self):
        '''
        
        '''
        cur_uid = self.kind + tools.get_uu4d()
        while MPost.get_by_uid(cur_uid):
            cur_uid = self.kind + tools.get_uu4d()
        return cur_uid
137078
def unique(iterable):
    

    yielded = set()
    for i in iterable:
        if i in yielded:
            continue
        yield i
        yielded.add(i)
1065082
def build_groups(self, tokens):
        """"""
        groups = {}
        for token in tokens:
            match_type = MatchType.start if token.group_end else MatchType.single
            groups[token.group_start] = (token, match_type)
            if token.group_end:
                groups[token.group_end] = (token, MatchType.end)
        return groups
645874
def add_unique_id(self):
        
        
        uid = 0
        for feature in self._data["features"]:
            if feature["properties"].get("id"):
                raise Exception("one of the features already had an id field")
            feature["properties"]["id"] = uid
            uid += 1
609199
def do_group(self):
        
        group_id = self.config.group
        systems = {'machine_id': generate_machine_id()}
        self.group_systems(group_id, systems)