<commit_before>from core import bcolors
import traceback, sys, os
from modules import *
import glob
import py_compile


def check_customcommands():
    global funcname
    try:
        funcname.mhelp
    except AttributeError:
        print(bcolors.WARNING+"\n[!] test failed\n")
        traceback.print_exc()
        print(bcolors.END)
        sys.exit(1)

def challenge():
    try:
        global funcname
        modules = glob.glob("modules/*.py")
        core = glob.glob("core/*.py")
        libs1 = glob.glob("core/libs/*.p")
        libs2 = glob.glob("core/libs/*/*.py")

        print(bcolors.OKGREEN+"\n[*] starting test"+bcolors.END)
        print(bcolors.OKGREEN+"\n[*] testing modules\n"+bcolors.END)
        #testing modules
        for module in modules:
            module = module.replace('modules/', '').replace('.py', '')
            if module != '__init__':
                funcname = globals()[module]
                print(bcolors.YEL+'checking',funcname.modulename+bcolors.END)
                funcname.version
                funcname.desc
                funcname.github
                funcname.createdby
                funcname.email
                funcname.variables
                funcname.vdesc
                funcname.changelog
                funcname.run
                try:
                    funcname.customcommands
                    check_customcommands()
                except AttributeError:
                    pass
        print(bcolors.OKGREEN+'\n[*] testing core\n'+bcolors.END)

        for item in core:
            print(bcolors.YEL+'compiling',item+bcolors.END)
            py_compile.compile(item)

        print(bcolors.OKGREEN+'\n[*] testing libs\n'+bcolors.END)

        for lib in libs1:
            print(bcolors.YEL+'compiling',lib+bcolors.END)
            py_compile.compile(lib)
        
        for lib in libs2:
            print(bcolors.YEL+'compiling',lib+bcolors.END)
            py_compile.compile(lib)



        print(bcolors.OKGREEN+"\n[*] test passed"+bcolors.END)

        sys.exit(0)

    except SystemExit as e:
        sys.exit(e)

    except:
        print(bcolors.WARNING+"\n[!] test failed\n")
        traceback.print_exc()
        print(bcolors.END)
        sys.exit(1)<commit_msg>updated usftest<commit_after>from core import bcolors
import traceback, sys, os
from modules import *
import glob
import py_compile


def check_customcommands():
    global funcname
    try:
        funcname.mhelp
    except AttributeError:
        testfailed()

def challenge():
    try:
        global funcname
        modules = glob.glob("modules/*.py")
        core = glob.glob("core/*.py")
        libs1 = glob.glob("core/libs/*.p")
        libs2 = glob.glob("core/libs/*/*.py")

        print(bcolors.OKGREEN+"\n[*] starting test"+bcolors.END)
        print(bcolors.OKGREEN+"\n[*] testing modules\n"+bcolors.END)
        #testing modules
        for module in modules:
            module = module.replace('modules/', '').replace('.py', '')
            if module != '__init__':
                funcname = globals()[module]
                print(bcolors.YEL+'checking',funcname.modulename+bcolors.END)
                if funcname.modulename != module:
                    print(bcolors.WARNING+"\nmodules name doesn't match")
                    testfailed()
                funcname.version
                if funcname.desc == 'modules_description':
                    print(bcolors.WARNING+'\ndesc variable has default value'+bcolors.END)
                    testfailed()
                if funcname.github == 'mygithub':
                     print(bcolors.WARNING+'\ngithub variable has default value'+bcolors.END)
                     testfailed()
                if funcname.createdby == 'creators_name':
                    print(bcolors.WARNING+'\ncreatedby variable has default value'+bcolors.END)
                    testfailed()
                if funcname.email == '<EMAIL>':
                    print(bcolors.WARNING+'\nemail variable has default value'+bcolors.END)
                    testfailed()
                funcname.variables
                funcname.vdesc
                funcname.changelog
                funcname.run
                try:
                    funcname.customcommands
                    check_customcommands()
                except AttributeError:
                    pass
        print(bcolors.OKGREEN+'\n[*] testing core\n'+bcolors.END)

        for item in core:
            print(bcolors.YEL+'compiling',item+bcolors.END)
            py_compile.compile(item)

        print(bcolors.OKGREEN+'\n[*] testing libs\n'+bcolors.END)

        for lib in libs1:
            print(bcolors.YEL+'compiling',lib+bcolors.END)
            py_compile.compile(lib)
        
        for lib in libs2:
            print(bcolors.YEL+'compiling',lib+bcolors.END)
            py_compile.compile(lib)

        print(bcolors.OKGREEN+'\n[*] testing '+'\xb5'+'Sploit'+bcolors.END)

        from __main__ import module
        from __main__ import terminal
        from __main__ import modulename
        from __main__ import funcname
        from __main__ import scoml
        from __main__ import scripting
        from __main__ import scriptline



        print(bcolors.OKGREEN+"\n[*] test passed"+bcolors.END)

        sys.exit(0)

    except SystemExit as e:
        sys.exit(e)

    except:
       testfailed()

def testfailed():
    print(bcolors.WARNING+"\n[!] test failed\n")
    traceback.print_exc()
    print(bcolors.END)
    sys.exit(1)
{'fraction_non_alphanumeric': 0.10982658959537572, 'fraction_numerical': 0.0025289017341040463, 'mean_word_length': 1.800708143651998, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1596243', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1550, 'n_words': 305}