<commit_before>import os
import re
from jinja2 import Environment, FileSystemLoader

class _Singleton(type):
    """ A metaclass that creates a Singleton base class when called. """
    _instances = {}
    def __call__(cls, *args, **kwargs):
        if cls not in cls._instances:
            cls._instances[cls] = super(_Singleton, cls).__call__(*args, **kwargs)
        return cls._instances[cls]

class Singleton(_Singleton('SingletonMeta', (object,), {})): pass

# creates class from dict on demand
class LazyClass(object):
    oftype = None

    def __init__(self, name = None, oftype = None):
        if not self.oftype and oftype:
            self.oftype = oftype

        assert name is not None, ('You should provide a name for new class')
        assert self.oftype is not None, ('You should provide a type for new class')

        self.handle = None
        self.attrs = dict()
        self.ready = False
        self.name = name

    def setup(self):
        self.handle = type(self.name, (self.oftype,), dict(self.attrs))
        self.ready = True

    def set_attr(self, key, value):
        self.attrs[key] = value

    def as_class(self):
        if not self.ready:
            self.setup()

        return self.handle

class Template():
    def __init__(self):
        self.loader = FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates'))
        self.env = Environment(loader = self.loader)

    def render(self, template_name, **kwargs):
        template = self.env.get_template(template_name)
        return template.render(**kwargs)

# processes $ref links
def Resolver(obj, path, full = False):
    m = re.search('#/(.*)/(.*)', path)
    x = None

    if full:
        b = obj[m.group(1)]
        x = b[m.group(2)]
    else:
        x = m.group(2)

    return x<commit_msg>Fixed LazyClass namespace<commit_after>import os
import re
from jinja2 import Environment, FileSystemLoader

class _Singleton(type):
    """ A metaclass that creates a Singleton base class when called. """
    _instances = {}
    def __call__(cls, *args, **kwargs):
        if cls not in cls._instances:
            cls._instances[cls] = super(_Singleton, cls).__call__(*args, **kwargs)
        return cls._instances[cls]

class Singleton(_Singleton('SingletonMeta', (object,), {})): pass

# creates class from dict on demand
class LazyClass(object):
    oftype = None

    def __init__(self, name = None, oftype = None):
        if not self.oftype and oftype:
            self.oftype = oftype

        assert name is not None, ('You should provide a name for new class')
        assert self.oftype is not None, ('You should provide a type for new class')

        self.handle = None
        self.attrs = dict()
        self.ready = False
        self.name = name

    def set_attr(self, key, value):
        self.attrs[key] = value

    def as_class(self):
        if not self.ready:
            self.setup()

        return type(self.name, (self.oftype,), dict(self.attrs))

class Template():
    def __init__(self):
        self.loader = FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates'))
        self.env = Environment(loader = self.loader)

    def render(self, template_name, **kwargs):
        template = self.env.get_template(template_name)
        return template.render(**kwargs)

# processes $ref links
def Resolver(obj, path, full = False):
    m = re.search('#/(.*)/(.*)', path)
    x = None

    if full:
        b = obj[m.group(1)]
        x = b[m.group(2)]
    else:
        x = m.group(2)

    return x
{'fraction_non_alphanumeric': 0.12232243517474634, 'fraction_numerical': 0.002254791431792559, 'mean_word_length': 2.595744680851064, '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': '6096892', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1071, 'n_words': 319}