<commit_before>__author__ = 'jan-hendrikprinz'

class TreeMixin(object):
    """
    A mixin that provides basic tree handling.

    A tree is basically a node with children of the same type. The mixin
    requires to implement
    """
    
    @property
    def subnodes(self):
        return []

    @property
    def subnode(self):
        """
        Return the single/only sub-pathmovechange if there is only one.

        Returns
        -------
        PathMoveChange
        """
        if len(self.subnodes) == 1:
            return self.subnodes[0]
        else:
            # TODO: might raise exception
            return None

    @property
    def subchange(self):
        """
        Return the single/only sub-pathmovechange if there is only one.

        Returns
        -------
        PathMoveChange
        """
        if len(self.subnodes) == 1:
            return self.subnodes[0]
        else:
            # TODO: might raise exception
            return None

    def __iter__(self):
        yield self
        for subchange in self.subnodes:
            for change in subchange:
                yield change

    def __getitem__(self, item):
        """
        Return the n-th subchange

        Returns
        -------
        PathMoveChange<commit_msg>treelogic<commit_after>__author__ = 'jan-hendrikprinz'

class TreeMixin(object):
    """
    A mixin that provides basic tree handling.

    A tree is basically a node with children of the same type. The mixin
    requires to implement
    """
    
    @property
    def subnodes(self):
        return []

    @property
    def subnode(self):
        """
        Return the single/only sub-pathmovechange if there is only one.

        Returns
        -------
        PathMoveChange
        """
        if len(self.subnodes) == 1:
            return self.subnodes[0]
        else:
            # TODO: might raise exception
            return None

    def __iter__(self):
        yield self
        for subchange in self.subnodes:
            for change in subchange:
                yield change

    def __getitem__(self, item):
        """
        Return the n-th subchange

        Returns
        -------
        PathMoveChange
{'fraction_non_alphanumeric': 0.08408679927667269, 'fraction_numerical': 0.0027124773960217, 'mean_word_length': 1.5147727272727274, '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': '4486312', 'n_tokens_mistral': 593, 'n_tokens_neox': 573, 'n_words': 187}