<commit_before>from ultimate.utils.google_api import GoogleAppsApi


def add_to_group(group_id=None, group_email_address=None, email_address=None, file_path=None):

    api = GoogleAppsApi()
    success_count = 0

    if email_address:
        if api.add_group_member(email_address, group_id=group_id, group_email_address=group_email_address):
            success_count = success_count + 1

    elif file_path:
        try:
            f = open(file_path, 'r')
            email_list = f.read().splitlines()

            for email_address in email_list:
                if api.add_group_member(email_address, group_id=group_id, group_email_address=group_email_address):
                    success_count = success_count + 1

        finally:
            if f is not None:
                f.close()

    return success_count


def generate_email_list_address(league, team=None, suffix=None):
    group_address = '{}{}-{}-{}'.format(
        league.season.slug,
        league.league_start_date.strftime('%y'),
        league.league_start_date.strftime('%a'),
        league.level,
    )

    if team is not None:
        group_address += '-' + str(team.id)

    if suffix is not None:
        group_address += '-' + suffix

    return (group_address + '@lists.annarborultimate.org').lower()


def generate_email_list_name(league, team=None, suffix=None):
    group_name = '{} {} {} {}'.format(
        league.season.name,
        league.league_start_date.strftime('%Y'),
        league.league_start_date.strftime('%A'),
        league.display_level,
    )

    if team is not None:
        group_name += ' Team ' + str(team.id)

    if suffix is not None:
        group_name += ' ' + suffix

    return group_name<commit_msg>update name for event and tournament email lists<commit_after>from ultimate.utils.google_api import GoogleAppsApi


def add_to_group(group_id=None, group_email_address=None, email_address=None, file_path=None):

    api = GoogleAppsApi()
    success_count = 0

    if email_address:
        if api.add_group_member(email_address, group_id=group_id, group_email_address=group_email_address):
            success_count = success_count + 1

    elif file_path:
        try:
            f = open(file_path, 'r')
            email_list = f.read().splitlines()

            for email_address in email_list:
                if api.add_group_member(email_address, group_id=group_id, group_email_address=group_email_address):
                    success_count = success_count + 1

        finally:
            if f is not None:
                f.close()

    return success_count


def generate_email_list_address(league, team=None, suffix=None):
    if league.type == 'league':
        group_address = '{}{}-{}-{}'.format(
            league.season.slug,
            str(league.year)[-2:],
            league.league_start_date.strftime('%a'),
            league.level,
        )
    else:
        group_address = '{}{}-{}'.format(
            league.season.slug,
            str(league.year)[-2:],
            league.night_slug,
        )

    if team is not None:
        group_address += '-' + str(team.id)

    if suffix is not None:
        group_address += '-' + suffix

    return (group_address + '@lists.annarborultimate.org').lower()


def generate_email_list_name(league, team=None, suffix=None):
    if league.type == 'league':
        group_name = '{} {} {} {}'.format(
            league.season.name,
            league.year,
            league.league_start_date.strftime('%A'),
            league.display_level,
        )
    else:
        group_name = '{} {} {}'.format(
            league.season.name,
            league.year,
            league.night,
        )

    if team is not None:
        group_name += ' Team ' + str(team.id)

    if suffix is not None:
        group_name += ' ' + suffix

    return group_name
{'fraction_non_alphanumeric': 0.11240913811007269, 'fraction_numerical': 0.0020768431983385254, 'mean_word_length': 2.3072961373390557, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6700404', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1155, 'n_words': 232}