<commit_before>__all__ = []


import sys
import importlib
import warnings
import inspect

from bmi_bridge import bmi_factory
from topoflow.utils.BMI_base import BMI_component


TOPOFLOW_COMPONENTS = [
    ('channels_diffusive_wave', 'channels_component'),
    ('channels_dynamic_wave', 'channels_component'),
    ('channels_kinematic_wave', 'channels_component'),
    ('d8_global', 'd8_component'),
    ('d8_local', 'd8_component'),
    ('diversions_fraction_method', 'diversions_component'),
    ('erode_d8_global', 'erosion_component'),
    ('erode_d8_local', 'erosion_component'),
    ('evap_energy_balance', 'evap_component'),
    ('evap_priestley_taylor', 'evap_component'),
    ('evap_read_file', 'evap_component'),
    ('infil_beven', 'infil_beven'),
    ('infil_green_ampt', 'infil_component'),
    ('infil_richards_1D', 'infil_component'),
    ('infil_smith_parlange', 'infil_component'),
    ('met_base', 'met_component'),
    ('satzone_darcy_layers', 'satzone_component'),
    ('snow_degree_day', 'snow_component'),
    ('snow_energy_balance', 'snow_component'),
]


def import_topoflow_component(mod_name, cls_name):
    try:
        topoflow_module = importlib.import_module(
            '.'.join(['topoflow', 'components', mod_name]))
    except ImportError:
        warnings.warn('unable to import {mod}'.format(mod=mod_name))
    else:
        obj = topoflow_module.__dict__[cls_name]
        bmi_obj = bmi_factory(obj, name=mod_name)
        setattr(sys.modules[__name__], bmi_obj.__name__, bmi_obj)
        __all__.append(bmi_obj.__name__)


for name in TOPOFLOW_COMPONENTS:
    import_topoflow_component(*name)
<commit_msg>Changed function to return new class name.<commit_after>import sys
import importlib
import warnings
import inspect

from bmi_bridge import bmi_factory
from topoflow.utils.BMI_base import BMI_component


TOPOFLOW_COMPONENTS = [
    ('channels_diffusive_wave', 'channels_component'),
    ('channels_dynamic_wave', 'channels_component'),
    ('channels_kinematic_wave', 'channels_component'),
    ('d8_global', 'd8_component'),
    ('d8_local', 'd8_component'),
    ('diversions_fraction_method', 'diversions_component'),
    ('erode_d8_global', 'erosion_component'),
    ('erode_d8_local', 'erosion_component'),
    ('evap_energy_balance', 'evap_component'),
    ('evap_priestley_taylor', 'evap_component'),
    ('evap_read_file', 'evap_component'),
    ('infil_beven', 'infil_beven'),
    ('infil_green_ampt', 'infil_component'),
    ('infil_richards_1D', 'infil_component'),
    ('infil_smith_parlange', 'infil_component'),
    ('met_base', 'met_component'),
    ('satzone_darcy_layers', 'satzone_component'),
    ('snow_degree_day', 'snow_component'),
    ('snow_energy_balance', 'snow_component'),
]


def import_topoflow_component(mod_name, cls_name):
    try:
        topoflow_module = importlib.import_module(
            '.'.join(['topoflow', 'components', mod_name]))
    except ImportError:
        warnings.warn('unable to import {mod}'.format(mod=mod_name))
        return None
    else:
        obj = topoflow_module.__dict__[cls_name]
        bmi_obj = bmi_factory(obj, name=mod_name)
        setattr(sys.modules[__name__], bmi_obj.__name__, bmi_obj)
        return bmi_obj.__name__


__all__ = []
for name in TOPOFLOW_COMPONENTS:
    topoflow_cls_name = import_topoflow_component(*name)
    if topoflow_cls_name is not None:
        __all__.append(topoflow_cls_name)

{'fraction_non_alphanumeric': 0.13179427235534774, 'fraction_numerical': 0.004091174751607247, 'mean_word_length': 4.994746059544658, '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': '1659342', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1174, 'n_words': 188}