<commit_before>#!/usr/bin/env python

class ipc(object):
    pass

class shutdown(ipc):
    pass

class shutdownMicroprocess(shutdown):

    def __new__(cls):
        if cls != shutdownNow and shutdownNow not in cls.__bases__:
            print "*** tsk tsk, creating a shutdownMicroprocess!!"
        return shutdown.__new__(shutdownNow)


class shutdownNow(shutdownMicroprocess):
    pass


class basedOnShutdownMicroprocess(shutdownMicroprocess):
    pass


print "What is a shutdownNow?"
s=shutdownNow()
print type(s)
print
print isinstance(s,shutdownNow)
print isinstance(s,shutdownMicroprocess)
print isinstance(s,shutdown)
print

print "What is a shutdownMicroprocess"
s=shutdownMicroprocess()
print type(s)
print
print isinstance(s,shutdownNow)
print isinstance(s,shutdownMicroprocess)
print isinstance(s,shutdown)

print "What is a shutdownNow?"
s=basedOnShutdownMicroprocess()
print type(s)
print
print isinstance(s,shutdownNow)
print isinstance(s,shutdownMicroprocess)
print isinstance(s,shutdown)
print

<commit_msg>Hmm, not ideal, but does trap the most common use of shutdownMicroprocess - in isinstance() calls :)<commit_after>#!/usr/bin/env python

class ipc(object):
    pass

class shutdown(ipc):
    pass

class shutdownMicroprocess(shutdown):

    def __new__(cls):
        if cls != shutdownNow and shutdownNow not in cls.__bases__:
            print "*** tsk tsk, creating a shutdownMicroprocess!!"
        return shutdown.__new__(shutdownNow)


class shutdownNow(shutdownMicroprocess):
    pass


class basedOnShutdownMicroprocess(shutdownMicroprocess):
    pass


# install a wrapper for isinstance() to check for shutdownMicroprocess usage
__original_isinstance = isinstance

def __isinstance(instance, types):
    if types == shutdownMicroprocess:
        print "*** tsk tsk, not in an isinstance() call!!!"
    else:
        try:
            if shutdownMicroprocess in types:
                print "*** tsk tsk, not in an isinstance() call!!!"
        except:
            pass
    return __original_isinstance(instance,types)


isinstance = __isinstance
if __name__ != "__main__":
    __builtins__["isinstance"] = __isinstance
    
else:
    print "What is a shutdownNow?"
    s=shutdownNow()
    print type(s)
    print
    print isinstance(s,shutdownNow)
    print isinstance(s,shutdownMicroprocess)
    print isinstance(s,shutdown)
    print
    
    print "What is a shutdownMicroprocess"
    s=shutdownMicroprocess()
    print type(s)
    print
    print isinstance(s,shutdownNow)
    print isinstance(s,shutdownMicroprocess)
    print isinstance(s,shutdown)
    
    print "What is a shutdownNow?"
    s=basedOnShutdownMicroprocess()
    print type(s)
    print
    print isinstance(s,shutdownNow)
    print isinstance(s,shutdownMicroprocess)
    print isinstance(s,shutdown)
    print
    

{'fraction_non_alphanumeric': 0.0853399433427762, 'fraction_numerical': 0.0, 'mean_word_length': 3.9735915492957745, 'pattern_counts': {'":': 1, '<': 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': '6788363', 'n_tokens_mistral': 883, 'n_tokens_neox': 825, 'n_words': 229}