security/genetic.py
def cull(regex, generation, number_of_survivors):
    """
    Culls the least desireable inputs
    Only keeps the [number_of_survivors] slowest in the generation 
    """
    dict = {}
    ordered_generation = []
    for input in generation:
        if input != "":
            dict[input] = match_time(regex, input)
    sorted_inputs = sorted(dict.items(), key=lambda kv: kv[1], reverse=True)
    for input in sorted_inputs:
        ordered_generation.append(input[0])
    # Keep slowest
    keepers = ordered_generation[:number_of_survivors]
    return keepers

    Culls the least desireable inputs
    Only keeps the [number_of_survivors] slowest in the generation 
    
Culls the least desireable inputs
Only keeps the [number_of_survivors] slowest in the generation
Culls the least desireable inputs Only keeps the [ number_of_survivors ] slowest in the generation
def cull(regex, generation, number_of_survivors):
    dict = {}
    ordered_generation = []
    for input in generation:
        if input != "":
            dict[input] = match_time(regex, input)
    sorted_inputs = sorted(dict.items(), key=lambda kv: kv[1], reverse=True)
    for input in sorted_inputs:
        ordered_generation.append(input[0])
    keepers = ordered_generation[:number_of_survivors]
    return keepers
def cull ( regex , generation , number_of_survivors ) : dict = { } ordered_generation = [ ] for input in generation : if input != "" : dict [ input ] = match_time ( regex , input ) sorted_inputs = sorted ( dict . items ( ) , key = lambda kv : kv [ 1 ] , reverse = True ) for input in sorted_inputs : ordered_generation . append ( input [ 0 ] ) keepers = ordered_generation [ : number_of_survivors ] return keepers
Culls the least desireable inputs
Only keeps the [number_of_survivors] slowest in the generation
Culls the least desireable inputs Only keeps the [ number_of_survivors ] slowest in the generation
"""
    Culls the least desireable inputs
    Only keeps the [number_of_survivors] slowest in the generation 
    """ # Keep slowest
regex
generation
number_of_survivors