<commit_before>import sys, os, traceback, subprocess, webbrowser

def check_for_git():
    try:
        return bool(subprocess.check_output('git --version'))
    except:
        return False

def check_for_pip():
    try:
        return bool(subprocess.check_output('pip -V'))
    except:
        return False

def check_for_module_pip(mod):
    import pip
    return pip.main(['-q', 'show', mod]) == 0

def get_module_version(mod):
    # if not check_for_pip() blah blah blah
    try:
        out = subprocess.check_output('pip show %s' % mod, )
        datas = str(out).split('\\r\\n')
        expectedversion = datas[3]

        if expectedversion.startswith('Version: '):
            return expectedversion.split()[1]
        else:
            return [x.split()[1] for x in datas if x.startswith("Version: ")][0]
    except:
        pass

def install_module(mod, quiet=False):
    # TODO: Error code checks, I got 2 for permission denied (needs admin to write)
    try:
        import pip
        return pip.main(["-q", "install"] + mod.split() if quiet else ["install"] + mod.split())
    except:
        if check_for_pip():
            return subprocess.check_call("pip %sinstall %s" % ('-q ' if quiet else '', mod))

def open_in_wb(text, printanyways=True, indents=4):
    import webbrowser
    if isinstance(webbrowser.get(), webbrowser.BackgroundBrowser):
        print('%s%s' % (' ' * indents , text))
    else:
        webbrowser.open_new_tab(text)
        if printanyways:
            print('%s%s' % (' ' * indents , text))


def main():
    if not sys.version.startswith("3.5"):
        print("Python 3.5+ is required. This version is %s" % sys.version.split()[0])

        if subprocess.check_call('py --help') == 0:
            os.system('start cmd /k py -3.5 run.py')
            return
        else:
            pass
            # check other locations or some shit

        input("Press any key to continue . . .")
        return

    tried_requirementstxt = False
    tryagain = True

    while tryagain:
        tryagain = False

        try:
            from musicbot import MusicBot
            MusicBot().run()
            break

        except ImportError as e:
            traceback.print_exc()

            if not tried_requirementstxt:
                err = install_module('-r requirements.txt', True)
                tried_requirementstxt = True

                if err == 2:
                    print("\nIf that said \"Access is denied\", run it as admin.")
                    break<commit_msg>Now there's not a wall of text<commit_after>import sys, os, traceback, subprocess, webbrowser

def check_for_git():
    try:
        return bool(subprocess.check_output('git --version'))
    except:
        return False

def check_for_pip():
    try:
        return bool(subprocess.check_output('pip -V'))
    except:
        return False

def check_for_module_pip(mod):
    import pip
    return pip.main(['-q', 'show', mod]) == 0

def get_module_version(mod):
    # if not check_for_pip() blah blah blah
    try:
        out = subprocess.check_output('pip show %s' % mod, )
        datas = str(out).split('\\r\\n')
        expectedversion = datas[3]

        if expectedversion.startswith('Version: '):
            return expectedversion.split()[1]
        else:
            return [x.split()[1] for x in datas if x.startswith("Version: ")][0]
    except:
        pass

def install_module(mod, quiet=False):
    # TODO: Error code checks, I got 2 for permission denied (needs admin to write)
    try:
        import pip
        return pip.main(["-q", "install"] + mod.split() if quiet else ["install"] + mod.split())
    except:
        if check_for_pip():
            return subprocess.check_call("pip %sinstall %s" % ('-q ' if quiet else '', mod))

def open_in_wb(text, printanyways=True, indents=4):
    import webbrowser
    if isinstance(webbrowser.get(), webbrowser.BackgroundBrowser):
        print('%s%s' % (' ' * indents , text))
    else:
        webbrowser.open_new_tab(text)
        if printanyways:
            print('%s%s' % (' ' * indents , text))


def main():
    if not sys.version.startswith("3.5"):
        print("Python 3.5+ is required. This version is %s" % sys.version.split()[0])
        print("Attempting to locate python 3.5...")

        try:
            subprocess.check_output('py -3.5 -c "exit()"')
            print("Python 3.5 found.  Launching bot...")
            os.system('start cmd /k py -3.5 run.py')
            print("You can now close this window.")
            return
        except:
            pass
            # check other locations or some shit

        input("Press any key to continue . . .")
        return

    tried_requirementstxt = False
    tryagain = True

    while tryagain:
        tryagain = False

        try:
            from musicbot import MusicBot
            MusicBot().run()
            break

        except ImportError as e:
            traceback.print_exc()

            if not tried_requirementstxt:
                err = install_module('-r requirements.txt', True)
                tried_requirementstxt = True

                if err == 2:
                    print("\nIf that said \"Access is denied\", run it as admin.")
                    break
{'fraction_non_alphanumeric': 0.12042682926829268, 'fraction_numerical': 0.007050304878048781, 'mean_word_length': 2.035858877964141, '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': '5534485', 'n_tokens_mistral': 1604, 'n_tokens_neox': 1525, 'n_words': 440}