Return an iterator over pairs of evidence values and their corresponding edge iterators.
195391
def group_evidence_edges(edges: Iterable[EdgeTuple]) -> Iterable[Tuple[str, Iterable[EdgeTuple]]]:
    """"""
    return itt.groupby(edges, key=_evidence_sort_key)
1257405
def group_citation_edges(edges: Iterable[EdgeTuple]) -> Iterable[Tuple[str, Iterable[EdgeTuple]]]:
    """"""
    return itt.groupby(edges, key=_citation_sort_key)
918770
def iter_disjunctions(self):
        """"""
        for i in range(1, len(self.endpoints), 2):
            yield [i, self.get_disjoint(i)]
1147924
def getBothEdges(self, label=None):
        """"""
        if label:
            for edge in self.neoelement.relationships.all(types=[label]):
                yield Edge(edge)
        else:
            for edge in self.neoelement.relationships.all():
                yield Edge(edge)
120477
def iter_children(graph, node: BaseEntity) -> Iterable[BaseEntity]:
    """"""
    return (
        node
        for node, _, d in graph.in_edges(node, data=True)
        if d[RELATION] == IS_A
    )
544133
def iter_rows(self):
        
        fileobj = self._fileobj
        cls_row = self.cls_row
        fields = self.fields

        for idx in range(self.prolog.records_count):
            data = fileobj.read(1)

            marker = struct.unpack('<1s', data)[0]
            is_deleted = marker == b'*'

            if is_deleted:
                continue

            row_values = []
            for field in fields:
                val = field.cast(fileobj.read(field.len))
                row_values.append(val)

            yield cls_row(*row_values)
719051
def _rm_gos_edges_rel(self, rm_goids, edges_rel):
        """"""
        edges_ret = {}
        for rname, edges_cur in edges_rel.items():
            edges_new = self._rm_gos_edges(rm_goids, edges_cur)
            if edges_new:
                edges_ret[rname] = edges_new
        return edges_ret
154850
def iter_data(self):
        
        for y, row in enumerate(self.data):
            for x, gid in enumerate(row):
                yield x, y, gid
1021533
def select_edges(docgraph, conditions, data):
    """"""
    for (src_id, target_id, edge_attribs) in docgraph.edges(data=True):
        # if all conditions are fulfilled
        # we need to add edge_attribs to the namespace eval is working in
        if all((eval(cond, {'edge_attribs': edge_attribs})
                for cond in conditions)):
            if data:
                yield (src_id, target_id, edge_attribs)
            else:
                yield (src_id, target_id)
18056
def _rm_gos_edges(rm_goids, edges_all):
        """"""
        edges_reduced = []
        for goid_child, goid_parent in sorted(edges_all, key=lambda t: t[1]):
            if goid_child not in rm_goids and goid_parent not in rm_goids:
                edges_reduced.append((goid_child, goid_parent))
        return edges_reduced
945482
def pairwise(iterable):
    
    iterable = iter(iterable)
    left = next(iterable)
    for right in iterable:
        yield left, right
        left = right
501731
def edges(self, sites, permutation=None, input='sites'):
        
        if input == 'sites':
            coords = [site.coords for site in sites]
        elif input == 'coords':
            coords = sites
        # if permutation is None:
        #     coords = [site.coords for site in sites]
        # else:
        #     coords = [sites[ii].coords for ii in permutation]
        if permutation is not None:
            coords = [coords[ii] for ii in permutation]
        return [[coords[ii] for ii in e] for e in self._edges]
310822
def and_edge_predicates(edge_predicates: EdgePredicates) -> EdgePredicate:
    """"""
    # If something that isn't a list or tuple is given, assume it's a function and return it
    if not isinstance(edge_predicates, Iterable):
        return edge_predicates

    edge_predicates = tuple(edge_predicates)

    # If only one predicate is given, don't bother wrapping it
    if 1 == len(edge_predicates):
        return edge_predicates[0]

    def concatenated_edge_predicate(graph: BELGraph, u: BaseEntity, v: BaseEntity, k: str) -> bool:
        """Pass only for an edge that pass all enclosed predicates.

        :return: If the edge passes all enclosed predicates
        """
        return all(
            edge_predicate(graph, u, v, k)
            for edge_predicate in edge_predicates
        )

    return concatenated_edge_predicate
811556
def vert_opposites_per_edge(self):
        """"""
        result = {}
        for f in self.f:
            for i in range(3):
                key = [f[i], f[(i+1)%3]]
                key.sort()
                key = tuple(key)
                val = f[(i+2)%3]

                if key in result:
                    result[key].append(val)
                else:
                    result[key] = [val]
        return result
218089
def iteritems(self):
        """"""
        if self.type in ['blob']:
            raise StopIteration

        for path, mode, sha in self.tree.iteritems():
            item = Item(self, sha, path, mode)
            yield item
            for i in item.iteritems():
                yield i
916930
def iterintervals(self, n=2):
        
        # tee the original iterator into n identical iterators
        streams = tee(iter(self), n)

        # advance the "cursor" on each iterator by an increasing
        # offset, e.g. if n=3:
        #
        #                   [a, b, c, d, e, f, ..., w, x, y, z]
        #  first cursor -->  *
        # second cursor -->     *
        #  third cursor -->        *
        for stream_index, stream in enumerate(streams):
            for i in range(stream_index):
                next(stream)

        # now, zip the offset streams back together to yield tuples,
        # in the n=3 example it would yield:
        # (a, b, c), (b, c, d), ..., (w, x, y), (x, y, z)
        for intervals in zip(*streams):
            yield intervals
482641
def iteritems(self):
        
        keys_yielded = set()
        for k, v in self._pairs:
            if k not in keys_yielded:
                keys_yielded.add(k)
                yield k, v