<commit_before>from imp import find_module, load_module
import os

class SourceExtension(object):
    def __init__(self, mod):
        self.initialized = False
        self.mod = mod
        self.renew = mod.renew
        self.Source = mod.Source
    def __call__(self, _ses, **kwargs):
        if not self.initialized or self.renew:
            self.fetcher = self.Source(_ses, **kwargs)
            self.initialized = True
        return self.fetcher.getseries(_ses, **kwargs)

sources = {}

curdir = os.path.dirname(os.path.realpath(__file__))

extension_names = os.listdir(os.path.join(curdir,'source'))

for name in extension_names:
    ext = find_module(name, ['source'])
    mod = load_module(name, *ext)
    sources[mod.stype] = SourceExtension(mod)<commit_msg>Use full path to find mods<commit_after>from imp import find_module, load_module
import os

class SourceExtension(object):
    def __init__(self, mod):
        self.initialized = False
        self.mod = mod
        self.renew = mod.renew
        self.Source = mod.Source
    def __call__(self, _ses, **kwargs):
        if not self.initialized or self.renew:
            self.fetcher = self.Source(_ses, **kwargs)
            self.initialized = True
        return self.fetcher.getseries(_ses, **kwargs)

sources = {}

curdir = os.path.dirname(os.path.realpath(__file__))
sourcedir = os.path.join(curdir,'source')

extension_names = os.listdir(sourcedir)

for name in extension_names:
    ext = find_module(name, [sourcedir])
    mod = load_module(name, *ext)
    sources[mod.stype] = SourceExtension(mod)
{'fraction_non_alphanumeric': 0.11499364675984752, 'fraction_numerical': 0.0, 'mean_word_length': 3.1777188328912467, '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': '938707', 'n_tokens_mistral': 495, 'n_tokens_neox': 490, 'n_words': 114}