<commit_before>"""\
C'Dent parser for already compiled AST
"""

from __future__ import absolute_import

from yaml import load
try:
    from yaml import CLoader as Loader
except ImportError:
    from yaml import Loader

import cdent.ast
from cdent.parser import Parser as Base
from cdent.parser import ParseError

class Parser(Base):
    def parse(self):
        return load(self.stream)

    def multi_constructor(loader, type, node):
        obj = getattr(cdent.ast, type)()
        obj.__dict__.update(loader.construct_mapping(node))
        return obj

    Loader.add_multi_constructor('tag:cdent.org,2010:', multi_constructor)<commit_msg>Fix test bug<commit_after>"""\
C'Dent parser for already compiled AST
"""

from __future__ import absolute_import

from yaml import load
try:
    from yaml import CLoader as Loader
except ImportError:
    from yaml import Loader

import cdent.ast
from cdent.parser import Parser as Base
from cdent.parser import ParseError

class Parser(Base):
    def parse(self):
        return load(self.stream, Loader)

    def multi_constructor(loader, type, node):
        obj = getattr(cdent.ast, type)()
        obj.__dict__.update(loader.construct_mapping(node))
        return obj

    Loader.add_multi_constructor('tag:cdent.org,2010:', multi_constructor)
{'fraction_non_alphanumeric': 0.0844306738962045, 'fraction_numerical': 0.006196746707978312, 'mean_word_length': 3.9692307692307693, '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': '2853083', 'n_tokens_mistral': 398, 'n_tokens_neox': 378, 'n_words': 118}