<commit_before>"""Binary Search Tree"""


class BinarySearchTree(object):
    def __init__(self, value=None):
        self.value = value
        self.left = None
        self.right = None

    def insert(self, val):
        leaf = BinarySearchTree(val)
        if self.value is None:
            self.value = val

        if val < self.value:
            if self.left is None:
                self.left = leaf
            else:
                self.left.insert(val)
        elif val > self.value:
            if self.right is None:
                self.right = leaf
            else:
                self.right.insert(val)

    def contains(self, val):
        print self.value, val
        if self.value is None:
            return False
        elif val == self.value:
            return True
        elif val < self.value:
            if self.left is None:
                return False
            else:
                return self.left.contains(val)
        elif val > self.value:
            if self.right is None:
                return False
            else:
                return self.right.contains(val)
        else:
            return False

    def size(self):
        count = 0
        # count current value
        if self.value:
            count += 1
        # count left side
        if self.left:
            count += self.left.size()
        # count right side
        if self.right:
            count += self.right.size()

        return count
<commit_msg>more pythonic<commit_after>"""Binary Search Tree"""


class BinarySearchTree(object):
    def __init__(self, value=None):
        self.value = value
        self.left = None
        self.right = None

    def insert(self, val):
        leaf = BinarySearchTree(val)
        if not self.value:
            self.value = val

        if val < self.value:
            if not self.left:
                self.left = leaf
            else:
                self.left.insert(val)
        elif val > self.value:
            if not self.right:
                self.right = leaf
            else:
                self.right.insert(val)

    def contains(self, val):
        if not self.value:
            return False
        elif val == self.value:
            return True
        elif val < self.value:
            if not self.left:
                return False
            else:
                return self.left.contains(val)
        elif val > self.value:
            if not self.right:
                return False
            else:
                return self.right.contains(val)
        else:
            return False

    def size(self):
        count = 0
        # count current value
        if self.value:
            count += 1
        # count left side
        if self.left:
            count += self.left.size()
        # count right side
        if self.right:
            count += self.right.size()

        return count

{'fraction_non_alphanumeric': 0.08063404548587182, 'fraction_numerical': 0.0013783597518952446, 'mean_word_length': 1.1959152798789712, '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': '1096598', 'n_tokens_mistral': 773, 'n_tokens_neox': 737, 'n_words': 228}