<commit_before>import openpathsampling as paths
from openpathsampling.ensemble import EnsembleCache

def default_state_progress_report(n_steps, found_states, all_states,
                                  timestep=None):
    """
    Default progress reporter for VisitAllStatesEnsemble.

    Note that it is assumed that all states have been named.

    Parameters
    ----------
    n_steps : int
        number of MD frames generated so far
    found_states : iterable
        the set of states that have been found
    all_states : iterable
        the set of all states of interest
    timestep : float or quantity
        the timestep (optional). If given, the amount of time simulated will
        be reported along with the number of MD frames.

    Returns
    -------
    str :
        formatted string with information about progress so far
    """
    report_str = "Ran {n_steps} frames"
    if timestep is not None:
        report_str += " [{}]".format(str(n_steps * timestep))
    report_str += (". Found states [{found_states}]. "
                   "Looking for [{missing_states}].")
    found_states_str = ",".join([s.name for s in found_states])
    # list comprehension instead of sets (to preseve order)
    missing_states = [s for s in all_states if s not in found_states]
    missing_states_str = ",".join([s.name for s in missing_states])
    return report_str.format(n_steps=n_steps,
                             found_states=found_states_str,
                             missing_states=missing_states_str)


class VisitAllStatesEnsemble(paths.WrappedEnsemble):
    """
    Ensemble to create trajectories connected all states, giving progress.

    Parameters
    ----------
    states : list of :class:`.Volume`
        States this should visit
    progress : string or 2-tuple of callable
        How to report progress. This is used to define a method to create
        the report string and a method to emit the progress report.  Allowed
        string values are 'default', which uses
        :method:`.default_state_progress_report` to create the string and
        :method:`.refresh_output` to emit it, and 'silent', which will
        create the report as with the default, but not emit it.
        Using ``None`` will prevent the report from being created. You can
        also return a 2-tuple of callables, where the first formats the<commit_msg>Fix missing newline in the VisitAllStatesEnsemble<commit_after>import openpathsampling as paths
from openpathsampling.ensemble import EnsembleCache

def default_state_progress_report(n_steps, found_states, all_states,
                                  timestep=None):
    """
    Default progress reporter for VisitAllStatesEnsemble.

    Note that it is assumed that all states have been named.

    Parameters
    ----------
    n_steps : int
        number of MD frames generated so far
    found_states : iterable
        the set of states that have been found
    all_states : iterable
        the set of all states of interest
    timestep : float or quantity
        the timestep (optional). If given, the amount of time simulated will
        be reported along with the number of MD frames.

    Returns
    -------
    str :
        formatted string with information about progress so far
    """
    report_str = "Ran {n_steps} frames"
    if timestep is not None:
        report_str += " [{}]".format(str(n_steps * timestep))
    report_str += (". Found states [{found_states}]. "
                   "Looking for [{missing_states}].\n")
    found_states_str = ",".join([s.name for s in found_states])
    # list comprehension instead of sets (to preseve order)
    missing_states = [s for s in all_states if s not in found_states]
    missing_states_str = ",".join([s.name for s in missing_states])
    return report_str.format(n_steps=n_steps,
                             found_states=found_states_str,
                             missing_states=missing_states_str)


class VisitAllStatesEnsemble(paths.WrappedEnsemble):
    """
    Ensemble to create trajectories connected all states, giving progress.

    Parameters
    ----------
    states : list of :class:`.Volume`
        States this should visit
    progress : string or 2-tuple of callable
        How to report progress. This is used to define a method to create
        the report string and a method to emit the progress report.  Allowed
        string values are 'default', which uses
        :method:`.default_state_progress_report` to create the string and
        :method:`.refresh_output` to emit it, and 'silent', which will
        create the report as with the default, but not emit it.
        Using ``None`` will prevent the report from being created. You can
        also return a 2-tuple of callables, where the first formats the
{'fraction_non_alphanumeric': 0.07270833333333333, 'fraction_numerical': 0.0008333333333333334, 'mean_word_length': 2.5120702267739574, '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': '5316950', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1228, 'n_words': 504}