<commit_before>from rdflib.backends import Backend
from rdflib.syntax import serializer, serializers
from rdflib.syntax import parser, parsers

_kinds = {}
_adaptors = {}

def register(name, kind, module_path, class_name):
    _module_info = _kinds.get(kind, None)
    if _module_info is None:
        _module_info = _kinds[kind] = {}
    _module_info[name] = (module_path, class_name)

def get(name, kind):
    _module_info = _kinds.get(kind)
    if _module_info and name in _module_info:
        module_path, class_name = _module_info[name]
        module = __import__(module_path, globals(), locals(), True)
        return getattr(module, class_name)
    else:
        Adaptor = kind # TODO: look up of adaptor, for now just use kind
        Adaptee = get(name, _adaptors[kind])
        def const(*args, **keywords):
            return Adaptor(Adaptee(*args, **keywords))
        return const

def register_adaptor(adaptor, adaptee):
    _adaptors[adaptor] = adaptee


register_adaptor(serializer.Serializer, serializers.Serializer)
register_adaptor(parser.Parser, parsers.Parser)


register('xml', serializers.Serializer,
         'rdflib.syntax.serializers.XMLSerializer', 'XMLSerializer')

register('pretty-xml', serializers.Serializer,
         'rdflib.syntax.serializers.PrettyXMLSerializer', 'PrettyXMLSerializer')

register('nt', serializers.Serializer,
         'rdflib.syntax.serializers.NTSerializer', 'NTSerializer')

register('xml', parsers.Parser,
         'rdflib.syntax.parsers.RDFXMLParser', 'RDFXMLParser')

register('nt', parsers.Parser,
         'rdflib.syntax.parsers.NTParser', 'NTParser')

register('default', Backend,
         'rdflib.backends.IOMemory', 'IOMemory')

register('IOMemory', Backend,
         'rdflib.backends.IOMemory', 'IOMemory')

register('Memory', Backend,
         'rdflib.backends.Memory', 'Memory')

register('Sleepycat', Backend,
         'rdflib.backends.Sleepycat', 'Sleepycat')

register('Sleepycat_new', Backend,<commit_msg>removed reference to no longer existing parser.py<commit_after>from rdflib.backends import Backend
from rdflib.syntax import serializer, serializers
from rdflib.syntax import parsers

_kinds = {}
_adaptors = {}

def register(name, kind, module_path, class_name):
    _module_info = _kinds.get(kind, None)
    if _module_info is None:
        _module_info = _kinds[kind] = {}
    _module_info[name] = (module_path, class_name)

def get(name, kind):
    _module_info = _kinds.get(kind)
    if _module_info and name in _module_info:
        module_path, class_name = _module_info[name]
        module = __import__(module_path, globals(), locals(), True)
        return getattr(module, class_name)
    else:
        Adaptor = kind # TODO: look up of adaptor, for now just use kind
        Adaptee = get(name, _adaptors[kind])
        def const(*args, **keywords):
            return Adaptor(Adaptee(*args, **keywords))
        return const

def register_adaptor(adaptor, adaptee):
    _adaptors[adaptor] = adaptee


register_adaptor(serializer.Serializer, serializers.Serializer)
#register_adaptor(parser.Parser, parsers.Parser)


register('xml', serializers.Serializer,
         'rdflib.syntax.serializers.XMLSerializer', 'XMLSerializer')

register('pretty-xml', serializers.Serializer,
         'rdflib.syntax.serializers.PrettyXMLSerializer', 'PrettyXMLSerializer')

register('nt', serializers.Serializer,
         'rdflib.syntax.serializers.NTSerializer', 'NTSerializer')

register('xml', parsers.Parser,
         'rdflib.syntax.parsers.RDFXMLParser', 'RDFXMLParser')

register('nt', parsers.Parser,
         'rdflib.syntax.parsers.NTParser', 'NTParser')

register('default', Backend,
         'rdflib.backends.IOMemory', 'IOMemory')

register('IOMemory', Backend,
         'rdflib.backends.IOMemory', 'IOMemory')

register('Memory', Backend,
         'rdflib.backends.Memory', 'Memory')

register('Sleepycat', Backend,
         'rdflib.backends.Sleepycat', 'Sleepycat')

register('Sleepycat_new', Backend,
{'fraction_non_alphanumeric': 0.12076324378609089, 'fraction_numerical': 0.0, 'mean_word_length': 4.18075422626788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '2591975', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1280, 'n_words': 256}