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


from semantix.caos import proto as caos_proto
from semantix.utils.lang import protoschema

from .semantics import Semantics
from .delta import Delta


class Semantics(Semantics):
    def get_import_context_class(self):
        return caos_proto.ImportContext

    @classmethod
    def get_module_class(cls):
        return caos_proto.SchemaModule
<commit_msg>cais.backends.yaml: Announce Caos YAML schema as cacheable<commit_after>##
# Copyright (c) 2008-2012 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##


from semantix.caos import proto as caos_proto
from semantix.utils.lang import protoschema
from semantix.utils.lang.yaml.schema import CachingSchema

from .semantics import Semantics
from .delta import Delta


class Semantics(Semantics, CachingSchema):
    def get_import_context_class(self):
        return caos_proto.ImportContext

    @classmethod
    def get_module_class(cls):
        return caos_proto.SchemaModule

    @classmethod
    def normalize_code(cls, module_data, imports):
        protomod = dict(module_data)['__sx_prototypes__']
        schema = caos_proto.get_global_proto_schema()
        protomod.normalize(imports)

    @classmethod
    def get_implicit_imports(cls):
        # cls.get_module_class().get_schema_class().get_builtins_module()
        return ('semantix.caos.builtins',)

{'fraction_non_alphanumeric': 0.08063404548587182, 'fraction_numerical': 0.011026878015161957, 'mean_word_length': 4.076923076923077, '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': '6872929', 'n_tokens_mistral': 485, 'n_tokens_neox': 451, 'n_words': 111}