<commit_before>#
# Jasy - Web Tooling Framework
# Copyright 2013 <NAME>
#

import jasy.style.Util as Util
import jasy.style.parse.Node as Node


class OperationError(Exception):
    def __init__(self, message, node):
        Exception.__init__(self, "Variable Error: %s for node type=%s in %s at line %s!" % (message, node.type, node.getFileName(), node.line))


def compute(first, second, parent, operator):

    # Support for default set operator "?=" when variable was not defined before<commit_msg>Made arguments optional<commit_after>#
# Jasy - Web Tooling Framework
# Copyright 2013 <NAME>
#

import jasy.style.Util as Util
import jasy.style.parse.Node as Node


class OperationError(Exception):
    def __init__(self, message, node):
        Exception.__init__(self, "Variable Error: %s for node type=%s in %s at line %s!" % (message, node.type, node.getFileName(), node.line))


def compute(first, second, parent=None, operator=None):

    # Fill gaps in empty arguments
    if parent is None and first.parent is second.parent:
        parent = first.parent

    if parent and operator is None:
        operator = parent.type

    if parent is None or operator is None:
        raise OperationError("Missing arguments for compute()", first)

    # Support for default set operator "?=" when variable was not defined before
{'fraction_non_alphanumeric': 0.10150375939849623, 'fraction_numerical': 0.006015037593984963, 'mean_word_length': 3.8576642335766422, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1532479', 'n_tokens_mistral': 386, 'n_tokens_neox': 365, 'n_words': 146}