<commit_before>from gi.repository import Gtk
from core import dir_core

class Tree:
    def __init__(self, directory=None):
        self.dir_tree = dir_core.Directory(directory).childs
        self.treestore = Gtk.TreeStore(str)
        self.parse_tree(self.dir_tree)

    def parse_tree(self, dir_tree, parent=None):
        """
            parses the nested dictionary and builds the treestore model
        """

        for key, value in dir_tree.items():
            if isinstance(value, dict):                         #is a directory
                print('found parent')
                parent = self.treestore.append(parent,[key])    #append directory to tree and store back treeiter
                self.parse_tree(value, parent)                  #hence recurese into that directory
            else:                                               #is a file
                print('found child')
                if parent == None:                              #file on root level<commit_msg>added docstring into Tree<commit_after>from gi.repository import Gtk
from core import dir_core

class Tree:
    """
        creates the TreeView to be attached into the gui
    """
    def __init__(self, directory=None):
        self.dir_tree = dir_core.Directory(directory).childs
        self.treestore = Gtk.TreeStore(str)
        self.parse_tree(self.dir_tree)

    def parse_tree(self, dir_tree, parent=None):
        """
            parses the nested dictionary and builds the treestore model
        """

        for key, value in dir_tree.items():
            if isinstance(value, dict):                         #is a directory
                print('found parent')
                parent = self.treestore.append(parent,[key])    #append directory to tree and store back treeiter
                self.parse_tree(value, parent)                  #hence recurese into that directory
            else:                                               #is a file
                print('found child')
                if parent == None:                              #file on root level
{'fraction_non_alphanumeric': 0.07496395963479097, 'fraction_numerical': 0.0, 'mean_word_length': 1.599250936329588, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3681000', 'n_tokens_mistral': 516, 'n_tokens_neox': 494, 'n_words': 159}