<commit_before>from grako.ast import AST
from FrontEnd.exceptions import *
from core.TOS import _TOS as TOS
from core.expression import BaseExpression, Symbol, Matrix, Vector, Scalar,\
                            Equal, Plus, Minus, Times, Transpose,\
                            Inverse
from storage import ST_LOWER, ST_UPPER, ST_FULL


class cl1ckSemantics(object):
    def __init__(self):
        super().__init__()
        self._cache = dict()

    def declarations(self, ast):
        decs = dict((d.name, d) for d in ast)
        return decs

    def declaration(self, ast):
        if ast['name'] not in self._cache:
            if ast['vartype'] == 'Matrix':
                rows, cols = ast['dims']
                rows, cols = Symbol(rows), Symbol(cols)
                var = Matrix(ast['name'], (rows, cols))
                for prop in ast.props:
                    var.set_property(prop)
            elif ast['vartype'] == 'Vector':
                rows = ast['dims'][0]
                rows = Symbol(rows)
                var = Vector(ast['name'], (rows,))
            elif ast['vartype'] == 'Scalar':
                var = Scalar(ast['name'])
            else:
                raise Exception
<commit_msg>Storage removed from properties (it is part of st_info)<commit_after>from grako.ast import AST
from FrontEnd.exceptions import *
from core.TOS import _TOS as TOS
from core.expression import BaseExpression, Symbol, Matrix, Vector, Scalar,\
                            Equal, Plus, Minus, Times, Transpose,\
                            Inverse
from storage import ST_LOWER, ST_UPPER, ST_FULL


class cl1ckSemantics(object):
    def __init__(self):
        super().__init__()
        self._cache = dict()

    def declarations(self, ast):
        decs = dict((d.name, d) for d in ast)
        return decs

    def declaration(self, ast):
        if ast['name'] not in self._cache:
            if ast['vartype'] == 'Matrix':
                rows, cols = ast['dims']
                rows, cols = Symbol(rows), Symbol(cols)
                var = Matrix(ast['name'], (rows, cols))
                for prop in ast.props:
                    if prop not in ("LowerStorage", "UpperStorage"):
                        var.set_property(prop)
            elif ast['vartype'] == 'Vector':
                rows = ast['dims'][0]
                rows = Symbol(rows)
                var = Vector(ast['name'], (rows,))
            elif ast['vartype'] == 'Scalar':
                var = Scalar(ast['name'])
            else:
                raise Exception

{'fraction_non_alphanumeric': 0.11576065701994524, 'fraction_numerical': 0.001564333202972233, 'mean_word_length': 1.7475832438238452, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6506588', 'n_tokens_mistral': 722, 'n_tokens_neox': 694, 'n_words': 208}