<commit_before>import os
import logging
from lxml import etree
from parser.trigger import Trigger
from parser.tags import Random, Var
from errors import SamlSyntaxError, VarNotDefinedError, UserNotDefinedError, NoTagParserError


class Saml:
    def __init__(self):
        # Debug logger
        self._log = logging.getLogger('saml')

        # Paths
        self.script_path = os.path.dirname(os.path.realpath(__file__))
        self._schema_path = os.path.join(self.script_path, 'schemas', 'saml.rng')

        # Schema validator
        self._schema_doc = etree.parse(self._schema_path)
        self._schema = etree.RelaxNG(self._schema_doc)

        # State data
        self.topic = None
        self.mood = None

        # Define our base / system tags
        self.tags = {'random': Random, 'var': Var}

        # Containers<commit_msg>Utilize the schema common method over calling etree directly<commit_after>import os
import logging
from lxml import etree
from parser import schema
from parser.trigger import Trigger
from parser.tags import Random, Var
from errors import SamlSyntaxError, VarNotDefinedError, UserNotDefinedError, NoTagParserError


class Saml:
    def __init__(self):
        # Debug logger
        self._log = logging.getLogger('saml')

        # Paths
        self.script_path = os.path.dirname(os.path.realpath(__file__))
        self._schema_path = os.path.join(self.script_path, 'schemas', 'saml.rng')

        # Schema validator
        with open(self._schema_path) as file:
            self._schema = schema(file.read())

        # State data
        self.topic = None
        self.mood = None

        # Define our base / system tags
        self.tags = {'random': Random, 'var': Var}

        # Containers
{'fraction_non_alphanumeric': 0.08902929350947732, 'fraction_numerical': 0.0, 'mean_word_length': 2.7787418655097613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5943058', 'n_tokens_mistral': 514, 'n_tokens_neox': 499, 'n_words': 137}