<commit_before>from pychecker2.Check import Check
from pychecker2.Check import Warning
from pychecker2 import util

from compiler import walk

class ModuleReference:
    def __init__(self, localname, remotename, module, nodes):
        self.localname = localname
        self.remotename = remotename
        self.module = module
        self.nodes = nodes

    def __getstate__(self):
        return (self.localname, self.remotename, self.module.__name__, 
                self.nodes)

    def __setstate__(self, data):
        (self.localname, self.remotename, self.module, self.nodes) = data
        self.module = __import__(self.module)

class ImportCheck(Check):
    '''<commit_msg>use __import__ correctly<commit_after>from pychecker2.Check import Check
from pychecker2.Check import Warning
from pychecker2 import util

from compiler import walk

class ModuleReference:
    def __init__(self, localname, remotename, module, nodes):
        self.localname = localname
        self.remotename = remotename
        self.module = module
        self.nodes = nodes

    def __getstate__(self):
        print self.module.__name__, self.localname, self.remotename
        return (self.localname, self.remotename, self.module.__name__, 
                self.nodes)

    def __setstate__(self, data):
        (self.localname, self.remotename, module, self.nodes) = data
        self.module = __import__(module, globals(), {}, [''])

class ImportCheck(Check):
    '''
{'fraction_non_alphanumeric': 0.09097127222982217, 'fraction_numerical': 0.004103967168262654, 'mean_word_length': 3.109550561797753, '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': '232070', 'n_tokens_mistral': 422, 'n_tokens_neox': 412, 'n_words': 109}