<commit_before>#!/usr/bin/env python
# encoding: UTF-8
'''
网易云音乐 Entry
'''
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import str
from future import standard_library
standard_library.install_aliases()

import curses
import traceback
import argparse
import sys

from .menu import Menu
version = "0.2.4.0"


def start():
    nembox_menu = Menu()
    try:
        nembox_menu.start_fork(version)
    except (OSError, TypeError, ValueError, KeyError):
        # clean up terminal while failed
        nembox_menu.screen.keypad(1)
        curses.echo()
        curses.nocbreak()
        curses.endwin()
        traceback.print_exc()


if __name__ == '__main__':
    start()

parser = argparse.ArgumentParser()
parser.add_argument("-v",
                    "--version",
                    help="show this version and exit",
                    action="store_true")
args = parser.parse_args()
if args.version:
    latest = Menu().check_version()
    curses.endwin()
    print('NetEase-MusicBox installed version:' + version)
    if latest != version:
        print('NetEase-MusicBox latest version:' + str(latest))
    sys.exit()<commit_msg>Moves argument parsing into start (#532)<commit_after>#!/usr/bin/env python
# encoding: UTF-8
'''
网易云音乐 Entry
'''
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import str
from future import standard_library
standard_library.install_aliases()

import curses
import traceback
import argparse
import sys

from .menu import Menu
version = "0.2.4.0"


def start():
    parser = argparse.ArgumentParser()
    parser.add_argument("-v",
                        "--version",
                        help="show this version and exit",
                        action="store_true")
    args = parser.parse_args()
    if args.version:
        latest = Menu().check_version()
        curses.endwin()
        print('NetEase-MusicBox installed version:' + version)
        if latest != version:
            print('NetEase-MusicBox latest version:' + str(latest))
        sys.exit()

    nembox_menu = Menu()
    try:
        nembox_menu.start_fork(version)
    except (OSError, TypeError, ValueError, KeyError):
        # clean up terminal while failed
        nembox_menu.screen.keypad(1)
        curses.echo()
        curses.nocbreak()
        curses.endwin()
        traceback.print_exc()


if __name__ == '__main__':
    start()
{'fraction_non_alphanumeric': 0.09934286818708929, 'fraction_numerical': 0.005798221878623889, 'mean_word_length': 2.8626865671641792, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1631953', 'n_tokens_mistral': 771, 'n_tokens_neox': 756, 'n_words': 202}