def change_fill_color_all_regions_based_on_my_count(soup):
    max_my_count = get_max_my_count_for_all_regions()
    for region in Region.create_all():
        change_fill_color_of_path(
            soup, region.name, get_region_count_fraction_color(
                region.my_count / max_my_count))
    prepare_legend(soup)
def change_fill_color_of_all_regions_based_on_presence_of_mysec(soup):
    all_regions_with_active_mysec = get_all_regions_with_active_mysec()
    for region in Region.create_all():
        change_fill_color_of_path(
            soup, region.name, get_region_mysec_presence_color(
                region in all_regions_with_active_mysec))
def change_fill_color_of_all_regions_based_on_looking_state(soup):
    print_current_looking_state_of_regions()
    toggle_looking_states_in_db(prompt_region_ids_for_looking_state_change())
    for region in Region.create_all():
        change_fill_color_of_path(
            soup, region.name, get_region_looking_color(region.looking_state))
def get_max_my_frequency_for_all_regions():
    all_regions = Region.create_all()
    region_with_max_my_frequency = functools.reduce(
        lambda a, b: a if a.my_frequency > b.my_frequency else b, all_regions)
    return region_with_max_my_frequency.my_frequency
def get_max_my_count_for_all_regions():
    all_regions = Region.create_all()
    region_with_max_my_count = functools.reduce(
        lambda a, b: a if a.my_count > b.my_count else b, all_regions)
    return region_with_max_my_count.my_count
def print_current_looking_state_of_regions():
    for region in Region.create_all():
        print(f"{region.id}\t{region.looking_state}\t{region.name}")