pymatgen_diffusion/neb/full_path_mapper.py
def generic_groupby(list_in: list, comp: Callable = operator.eq):
    """
    Group a list of unsortable objects

    Args:
        list_in: A list of generic objects
        comp: (Default value = operator.eq) The comparator

    Returns:
        [int] list of labels for the input list

    """
    list_out = [None] * len(list_in)
    label_num = 0
    for i1, ls1 in enumerate(list_out):
        if ls1 is not None:
            continue
        list_out[i1] = label_num
        for i2, ls2 in list(enumerate(list_out))[i1 + 1 :]:
            if comp(list_in[i1], list_in[i2]):
                if list_out[i2] is None:
                    list_out[i2] = list_out[i1]
                else:
                    list_out[i1] = list_out[i2]
                    label_num -= 1
        label_num += 1
    return list_out

    Group a list of unsortable objects

    Args:
        list_in: A list of generic objects
        comp: (Default value = operator.eq) The comparator

    Returns:
        [int] list of labels for the input list

    
Group a list of unsortable objects
Group a list of unsortable objects
def generic_groupby(list_in: list, comp: Callable = operator.eq):
    list_out = [None] * len(list_in)
    label_num = 0
    for i1, ls1 in enumerate(list_out):
        if ls1 is not None:
            continue
        list_out[i1] = label_num
        for i2, ls2 in list(enumerate(list_out))[i1 + 1 :]:
            if comp(list_in[i1], list_in[i2]):
                if list_out[i2] is None:
                    list_out[i2] = list_out[i1]
                else:
                    list_out[i1] = list_out[i2]
                    label_num -= 1
        label_num += 1
    return list_out
def generic_groupby ( list_in : list , comp : Callable = operator . eq ) : list_out = [ None ] * len ( list_in ) label_num = 0 for i1 , ls1 in enumerate ( list_out ) : if ls1 is not None : continue list_out [ i1 ] = label_num for i2 , ls2 in list ( enumerate ( list_out ) ) [ i1 + 1 : ] : if comp ( list_in [ i1 ] , list_in [ i2 ] ) : if list_out [ i2 ] is None : list_out [ i2 ] = list_out [ i1 ] else : list_out [ i1 ] = list_out [ i2 ] label_num -= 1 label_num += 1 return list_out
Group a list of unsortable objects
Group a list of unsortable objects
"""
    Group a list of unsortable objects

    Args:
        list_in: A list of generic objects
        comp: (Default value = operator.eq) The comparator

    Returns:
        [int] list of labels for the input list

    """
[int] list of labels for the input list
[ int ] list of labels for the input list
list_in
list
A list of generic objects
A list of generic objects
comp
Callable
(Default value = operator.eq) The comparator
( Default value = operator . eq ) The comparator