<commit_before>"""
download the list of locales
"""
import urllib2


class NoLocalesError(Exception):
    """
    I am really sorry but there are no locales for you
    """
    pass


def get_shipped_locales(locales_url):
    """ returns a tuple containing the list of shipped locales
        taken from locales_url
    """
    locales = []
    try:
        data = urllib2.urlopen(locales_url)
    except urllib2.HTTPError as e:
        msg = 'HTTPError = {0}\n'.format(str(e.code))
        msg = '{0}url: {1}'.format(locales_url)
        raise NoLocalesError(msg)
    except urllib2.URLError as e:
        msg = 'URLError = {0}'.format(e.reason)
        msg = '{0}url: {1}'.format(locales_url)
        raise NoLocalesError(msg)
    for line in data:
        locales.append(line.strip())
    # removing empty lines
    return tuple([locale for locale in locales if locale is not None])<commit_msg>pylint + pep8 fixes for lib/locales.py<commit_after>"""
download the list of locales
"""
import urllib2


class NoLocalesError(Exception):
    """
    I am really sorry but there are no locales for you
    """
    pass


def get_shipped_locales(locales_url):
    """ returns a tuple containing the list of shipped locales
        taken from locales_url
    """
    locales = []
    try:
        data = urllib2.urlopen(locales_url)
    except urllib2.HTTPError as error:
        msg = 'HTTPError = {0}\n'.format(str(error.code))
        msg = '{0}url: {1}'.format(locales_url)
        raise NoLocalesError(msg)
    except urllib2.URLError as error:
        msg = 'URLError = {0}'.format(error.reason)
        msg = '{0}url: {1}'.format(locales_url)
        raise NoLocalesError(msg)
    for line in data:
        line = line.strip()
        # removing empty lines and line = en-US
        if line and line != 'en-US':
            locales.append(line.strip())

    return tuple(locales)
{'fraction_non_alphanumeric': 0.11323763955342903, 'fraction_numerical': 0.011164274322169059, 'mean_word_length': 2.6614785992217898, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5646295', 'n_tokens_mistral': 625, 'n_tokens_neox': 623, 'n_words': 170}