<commit_before>##
# Copyright (c) 2010 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##


import collections
import numbers

from semantix.caos import types as caos_types
from semantix.caos.tree.transformer import TreeTransformer

from semantix.utils import ast

from semantix.utils.lang.python import ast as py_ast
from semantix.utils.lang.python import codegen as py_codegen

from semantix.utils import datastructures

from . import ast as caos_ast


_operator_map = {
    ast.ops.AND:    py_ast.PyAnd,
    ast.ops.OR:     py_ast.PyOr,

    ast.ops.ADD:    py_ast.PyAdd,
    ast.ops.SUB:    py_ast.PySub,
    ast.ops.MUL:    py_ast.PyMult,
    ast.ops.DIV:    py_ast.PyDiv,
    ast.ops.MOD:    py_ast.PyMod,
    ast.ops.POW:    py_ast.PyPow,

    ast.ops.EQ:     py_ast.PyEq,
    ast.ops.GT:     py_ast.PyGt,
    ast.ops.GE:     py_ast.PyGtE,
    ast.ops.IN:     py_ast.PyIn,
    ast.ops.IS:     py_ast.PyIs,
    ast.ops.IS_NOT: py_ast.PyIsNot,
    ast.ops.LT:     py_ast.PyLt,
    ast.ops.LE:     py_ast.PyLtE,
    ast.ops.NE:     py_ast.PyNotEq,
    ast.ops.NOT_IN: py_ast.PyNotIn,

    ast.ops.NOT:    py_ast.PyNot,
    ast.ops.UPLUS:  py_ast.PyUAdd,
    ast.ops.UMINUS: py_ast.PyUSub
}


class PythonQuery:
    def __init__(self, text, result_types, argument_types, context=None):
        self.text = text
        self.statement = compile(text, '<string>', 'eval')
        self.context = context
        self.result_types = result_types
        self.argument_types = argument_types
        self.record = datastructures.Record('pyquery_result', self.result_types, None)
        self.query = self

        import semantix<commit_msg>caos.tree.python: Fix PythonQuery result type initialization<commit_after>##
# Copyright (c) 2010 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##


import collections
import numbers

from semantix.caos import types as caos_types
from semantix.caos.tree.transformer import TreeTransformer

from semantix.utils import ast

from semantix.utils.lang.python import ast as py_ast
from semantix.utils.lang.python import codegen as py_codegen

from semantix.utils import datastructures

from . import ast as caos_ast


_operator_map = {
    ast.ops.AND:    py_ast.PyAnd,
    ast.ops.OR:     py_ast.PyOr,

    ast.ops.ADD:    py_ast.PyAdd,
    ast.ops.SUB:    py_ast.PySub,
    ast.ops.MUL:    py_ast.PyMult,
    ast.ops.DIV:    py_ast.PyDiv,
    ast.ops.MOD:    py_ast.PyMod,
    ast.ops.POW:    py_ast.PyPow,

    ast.ops.EQ:     py_ast.PyEq,
    ast.ops.GT:     py_ast.PyGt,
    ast.ops.GE:     py_ast.PyGtE,
    ast.ops.IN:     py_ast.PyIn,
    ast.ops.IS:     py_ast.PyIs,
    ast.ops.IS_NOT: py_ast.PyIsNot,
    ast.ops.LT:     py_ast.PyLt,
    ast.ops.LE:     py_ast.PyLtE,
    ast.ops.NE:     py_ast.PyNotEq,
    ast.ops.NOT_IN: py_ast.PyNotIn,

    ast.ops.NOT:    py_ast.PyNot,
    ast.ops.UPLUS:  py_ast.PyUAdd,
    ast.ops.UMINUS: py_ast.PyUSub
}


class PythonQuery:
    def __init__(self, text, result_types, argument_types, context=None):
        self.text = text
        self.statement = compile(text, '<string>', 'eval')
        self.context = context
        self.result_types = result_types
        self.argument_types = argument_types
        self.record = datastructures.Record('pyquery_result', tuple(self.result_types), None)
        self.query = self

        import semantix
{'fraction_non_alphanumeric': 0.10665478312537136, 'fraction_numerical': 0.0023767082590612004, 'mean_word_length': 2.675764192139738, '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': '5252296', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1274, 'n_words': 250}