<commit_before>from django.conf import settings

# Add to this list anything country-specific you want to be available
# through an import from pombola.country.

imports_and_defaults = (
    ('significant_positions_filter', lambda qs: qs),
)

# Note that one could do this without the dynamic import and use of
# globals() by switching on country names and importing * from each
# country specific module, as MapIt does. [1] I slightly prefer the
# version here since you can explicitly list the names to be imported,
# and provide a default value.
#
# [1] https://github.com/mysociety/mapit/blob/master/mapit/countries/__init__.py

for name_to_import, default_value in imports_and_defaults:
    if settings.COUNTRY_APP:
        try:
            globals()[name_to_import] = \
                getattr(__import__('pombola.' + settings.COUNTRY_APP + '.lib',
                           fromlist=[name_to_import]),
                        name_to_import)
        except ImportError, AttributeError:
            globals()[name_to_import] = default_value
    else:
        globals()[name_to_import] = default_value<commit_msg>Fix the syntax for catching multiple exceptions<commit_after>from django.conf import settings

# Add to this list anything country-specific you want to be available
# through an import from pombola.country.

imports_and_defaults = (
    ('significant_positions_filter', lambda qs: qs),
)

# Note that one could do this without the dynamic import and use of
# globals() by switching on country names and importing * from each
# country specific module, as MapIt does. [1] I slightly prefer the
# version here since you can explicitly list the names to be imported,
# and provide a default value.
#
# [1] https://github.com/mysociety/mapit/blob/master/mapit/countries/__init__.py

for name_to_import, default_value in imports_and_defaults:
    if settings.COUNTRY_APP:
        try:
            globals()[name_to_import] = \
                getattr(__import__('pombola.' + settings.COUNTRY_APP + '.lib',
                           fromlist=[name_to_import]),
                        name_to_import)
        except (ImportError, AttributeError):
            globals()[name_to_import] = default_value
    else:
        globals()[name_to_import] = default_value
{'fraction_non_alphanumeric': 0.08091468777484609, 'fraction_numerical': 0.001759014951627089, 'mean_word_length': 3.143897996357013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4524662', 'n_tokens_mistral': 642, 'n_tokens_neox': 625, 'n_words': 205}