<commit_before># A lot of this code come from https://github.com/sympy/sympy_gamma/blob/master/app/logic/logic.py
# http://www.sympygamma.com/
import sys
import queue
import collections

import sympy
from sympy.core.function import FunctionClass
from sympy import latex, series, sympify, solve, Derivative, Integral, Symbol, diff, integrate
from sympy.parsing.sympy_parser import stringify_expr, eval_expr, standard_transformations, convert_xor, TokenError

from .parser import Parser
from .config import Config
from .supyprocess import process

PREEXEC = """from sympy import *
import sympy
from sympy.solvers.diophantine import diophantine
"""

def evaluate(s):
    result = None
    parser = Parser(s)
    inputFormula=parser.normalize()
    expr, latex = process(eval_input, inputFormula, timeout=Config().timeout, heap_size=Config().max_heap)

    return expr, latex

def eval_input(s):
    namespace = {}
    exec(PREEXEC, {}, namespace)

    def plot(f=None, **kwargs):
        pass
    namespace.update({
        'plot': plot,  # prevent textplot from printing stuff
        'help': lambda f: f
    })
<commit_msg>Less useless code in eval<commit_after># A lot of this code come from https://github.com/sympy/sympy_gamma/blob/master/app/logic/logic.py
# http://www.sympygamma.com/
import sys
import queue
import collections

import sympy
from sympy.core.function import FunctionClass
from sympy import latex, series, sympify, solve, Derivative, Integral, Symbol, diff, integrate
from sympy.parsing.sympy_parser import stringify_expr, eval_expr, standard_transformations, convert_xor, TokenError

from .parser import Parser
from .config import Config
from .supyprocess import process

PREEXEC = """from sympy import *"""

def evaluate(s):
    result = None
    parser = Parser(s)
    inputFormula=parser.normalize()
    expr, latex = process(eval_input, inputFormula, timeout=Config().timeout, heap_size=Config().max_heap)

    return expr, latex

def eval_input(s):
    namespace = {}
    exec(PREEXEC, {}, namespace)

    def plot(f=None, **kwargs):
        pass
    namespace.update({
        'plot': plot,  # prevent textplot from printing stuff
        'help': lambda f: f
    })

{'fraction_non_alphanumeric': 0.10127737226277372, 'fraction_numerical': 0.0, 'mean_word_length': 4.172169811320755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '7180238', 'n_tokens_mistral': 671, 'n_tokens_neox': 652, 'n_words': 200}