<commit_before>__author__ = 'jan-hendrikprinz'

import openpathsampling as paths
from openpathsampling.todict import ops_object

@ops_object
class PathMoveChange(object):
    '''
    PathMoveChange is essentially a list of samples, with a few conveniences.  It
    can be treated as a list of samples (using, e.g., .append), or as a
    dictionary of ensembles mapping to a list of samples, or as a dictionary
    of replica IDs to samples. Any type is allowed as a replica ID except
    Sample or Ensemble.

    The dictionaries ensemble_dict and replica_dict are conveniences which
    should be kept consistent by any method which modifies the container.
    They do not need to be stored.

    Notes
    -----
    Current implementation is as an unordered set. Therefore we don't
    have some of the convenient tools in Python sequences (e.g.,
    slices). On the other hand, I'm not sure whether that is meaningful
    here.

    Attributes
    ----------
    samples : list of Sample
        The samples included in this set.
    ensemble_dict : dict
        A dictionary with Ensemble objects as keys and lists of Samples as
        values.
    replica_dict : dict
        A dictionary with replica IDs as keys and lists of Samples as values
    '''

    @staticmethod
    def _indent(s):
        spl = s.split('\n')
        spl = [' |  ' + p if p[0] == ' ' else ' +- ' + p for p in spl]
        return '\n'.join(spl)

    def __init__(self, accepted=True, mover=None, details=None):
        self._accepted = accepted
        self._destination = None
        self._local_samples = []
        self._collapsed_samples = None
        self._samples = None
        self.mover = mover
        self.subchanges = list()
        self.details = details

    def to_dict(self):
        return {
            'accepted' : self.accepted,
            'mover' : self.mover,
            'details' : self.details
        }

    @property
    def subchange(self):
        if len(self.subchanges) == 1:
            return self.subchanges[0]
        else:
            return None

    @property
    def opened(self):
        """
        Return the full PathMoveChange object

        Notes
        -----
        The full Movepath can only be returned if it has been generated and<commit_msg>updated traverse<commit_after>__author__ = 'jan-hendrikprinz'

import openpathsampling as paths
from openpathsampling.todict import ops_object

@ops_object
class PathMoveChange(object):
    '''
    PathMoveChange is essentially a list of samples, with a few conveniences.  It
    can be treated as a list of samples (using, e.g., .append), or as a
    dictionary of ensembles mapping to a list of samples, or as a dictionary
    of replica IDs to samples. Any type is allowed as a replica ID except
    Sample or Ensemble.

    The dictionaries ensemble_dict and replica_dict are conveniences which
    should be kept consistent by any method which modifies the container.
    They do not need to be stored.

    Notes
    -----
    Current implementation is as an unordered set. Therefore we don't
    have some of the convenient tools in Python sequences (e.g.,
    slices). On the other hand, I'm not sure whether that is meaningful
    here.

    Attributes
    ----------
    samples : list of Sample
        The samples included in this set.
    ensemble_dict : dict
        A dictionary with Ensemble objects as keys and lists of Samples as
        values.
    replica_dict : dict
        A dictionary with replica IDs as keys and lists of Samples as values
    '''

    @staticmethod
    def _indent(s):
        spl = s.split('\n')
        spl = [' |  ' + p if p[0] == ' ' else ' +- ' + p for p in spl]
        return '\n'.join(spl)

    def __init__(self, accepted=True, mover=None, details=None):
        self._accepted = accepted
        self._destination = None
        self._local_samples = []
        self._collapsed_samples = None
        self._samples = None
        self._len = None
        self.mover = mover
        self.subchanges = list()
        self.details = details

    def to_dict(self):
        return {
            'accepted' : self.accepted,
            'mover' : self.mover,
            'details' : self.details
        }

    @property
    def subchange(self):
        if len(self.subchanges) == 1:
            return self.subchanges[0]
        else:
            return None

    @property
    def opened(self):
        """
        Return the full PathMoveChange object

        Notes
        -----
        The full Movepath can only be returned if it has been generated and
{'fraction_non_alphanumeric': 0.07591623036649214, 'fraction_numerical': 0.0013089005235602095, 'mean_word_length': 2.144718792866941, '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': '5376365', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1222, 'n_words': 500}