<commit_before>'''
Created on 6 mai 2014

@author: <NAME>
'''
from PyQt4 import QtGui, QtCore
from threading import Thread
import time
from nxdrive.gui.resources import find_icon
from nxdrive.logging_config import get_logger

log = get_logger(__name__)


class FileInfo(object):
    def __init__(self, parent=None, checkstate=None):
        self.parent = parent
        self.children = []
        if parent:
            parent.add_child(self)
        if checkstate is None and parent is not None:
            checkstate = parent.get_checkstate()
        elif checkstate is None:
            checkstate = QtCore.Qt.Checked
        self.oldvalue = self.checkstate = checkstate

    def __repr__(self):
        return ("FileInfo<checkstate=%r, id=%r, "
                "label=%r, parent=%r>") % (
                    self.get_checkstate(),
                    self.get_id(),
                    self.get_label(), self.get_path())

    def add_child(self, child):
        self.children.append(child)

    def get_children(self):
        return self.children

    def is_dirty(self):
        return self.oldvalue != self.checkstate
<commit_msg>NXDRIVE-38: Take the parent checkstate if the parent is dirty<commit_after>'''
Created on 6 mai 2014

@author: <NAME>
'''
from PyQt4 import QtGui, QtCore
from threading import Thread
import time
from nxdrive.gui.resources import find_icon
from nxdrive.logging_config import get_logger

log = get_logger(__name__)


class FileInfo(object):
    def __init__(self, parent=None, checkstate=None):
        self.parent = parent
        self.children = []
        if parent:
            parent.add_child(self)
        if checkstate is None and parent is not None:
            checkstate = parent.get_checkstate()
        elif (parent is not None and parent.is_dirty()):
            self.checkstate = parent.get_checkstate()
            self.oldvalue = checkstate
            return
        elif checkstate is None:
            checkstate = QtCore.Qt.Checked
        self.oldvalue = self.checkstate = checkstate

    def __repr__(self):
        return ("FileInfo<checkstate=%r, id=%r, "
                "label=%r, parent=%r>") % (
                    self.get_checkstate(),
                    self.get_id(),
                    self.get_label(), self.get_path())

    def add_child(self, child):
        self.children.append(child)

    def get_children(self):
        return self.children

    def is_dirty(self):
        return self.oldvalue != self.checkstate

{'fraction_non_alphanumeric': 0.09579158316633267, 'fraction_numerical': 0.0056112224448897794, 'mean_word_length': 2.3324432576769025, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3625857', 'n_tokens_mistral': 730, 'n_tokens_neox': 702, 'n_words': 191}