def development_status():
            global dev_status
            global customclassifiers_bool
            lifeeasy.clear()
            print('Choose a development status from the following')
            print('')
            print('Alpha')
            print('Beta')
            print('Stable')
            print('')
            print(
                'Or press [enter] to add a custom one when adding classifiers...'
            )
            print('')
            print('')
            dev_status_try = input('> ')

            if dev_status_try.lower() == 'alpha':
                dev_status = 'Development Status :: 3 - Alpha'
            elif dev_status_try.lower() == 'beta':
                dev_status = 'Development Status :: 4 - Beta'
            elif dev_status_try.lower() == 'stable':
                dev_status = 'Development Status :: 5 - Production/Stable'
            elif dev_status_try == '':
                customclassifiers_bool = True
            else:
                print("Sorry but I couldn't recognize the status.")
                lifeeasy.sleep(1)
                print('Please try again...')
                lifeeasy.sleep(1)
                development_status()
            def console_output():
                '''
                Internal Function used to display statistics during processing the images.\n
                Might be disabled and thus main function analyze_episode could be optimized for better performance but I prefer seeing what's going on. 
                '''
                total_fps = 0
                total_frames = 'N/A'
                total_frames_frame = 0
                total_frames_frames = 0
                for element in fps_dict:
                    total_fps += fps_dict[element]
                single_thread_stats = ''
                for element in frames_stats_dict:
                    total_frames_frame += frames_stats_dict[element]['frame']
                    total_frames_frames += frames_stats_dict[element]['total_frames']
                    try:
                        try:
                            thread_percentage = int(frames_stats_dict[element]['frame']) * 100 / int(frames_stats_dict[element]['total_frames'])
                            thread_percentage = round(thread_percentage, 1)
                        except:
                            thread_percentage = 'n/a'
                        try:
                            frames_per_second = str(fps_dict[element])
                        except:
                            frames_per_second = 'n/a'
                        single_thread_stats = single_thread_stats + 'Episode ' + str(element) + ': Frame ' + str(frames_stats_dict[element]['frame']) + '/' + str(int(frames_stats_dict[element]['total_frames'])) + ' (' + str(thread_percentage) + '%) ・ Analyze Speed: ' + frames_per_second + 'FPS ・ Status: ' + frames_stats_dict[element]['status'] + '\n'
                    except:
                        try:
                            thread_percentage = int(frames_stats_dict[element]['frame']) * 100 / int(frames_stats_dict[element]['total_frames'])
                            thread_percentage = round(thread_percentage, 1)
                        except:
                            thread_percentage = 'n/a'
                        single_thread_stats = single_thread_stats + 'Episode ' + str(element) + ': Frame ' + str(frames_stats_dict[element]['frame']) + '/' + str(int(frames_stats_dict[element]['total_frames'])) + ' (' + str(thread_percentage) + '%) ・ Analyze Speed: 0FPS ・ Status: Starting\n'

                try:
                    total_frames_percentage = total_frames_frame * 100 / total_frames_frames
                    total_frames_percentage = round(total_frames_percentage, 2)
                except:
                    total_frames_percentage = 'n/a'
                total_frames = str(total_frames_frame) + '/' + str(int(total_frames_frames))

                lifeeasy.sleep(0.1)
                lifeeasy.clear()
                try:
                    remaining_frames = total_frames_frames - total_frames_frame
                    remaining_time = remaining_frames / int(total_fps)
                    eta = str(timedelta(seconds=remaining_time))
                except:
                    eta = 'N/A'
                print(f'Anime: {anime}\nFrame: {total_frames} ({str(total_frames_percentage)}%)\nAnalyze Speed: {str(total_fps)}FPS\nRemaining Time (ETA): {eta[:-7]}\n\nActive Threads\nーーーーーーーーーーーー\n{single_thread_stats}\nErina Project\n©Anime no Sekai - 2020')
                if stop_command_output == False:
                    thread = threading.Thread(target=console_output)
                    thread.daemon = True
                    thread.start()
def goodbye(nothing=False):
    if nothing == False:
        lifeeasy.stop_display()
        lifeeasy.display_action('Creating the information file')
        create_information()
        lifeeasy.display_action('Opening the folder', delay=0.1)
        filecenter.open(cleaning_dir)
        lifeeasy.display_action('Opening your the result folder', delay=0.1)
        filecenter.open(destination_dir)
    lifeeasy.clear()
    lifeeasy.display_title("Thank you for using this program")
    lifeeasy.display_body(['Folder Cleaner', '©Anime no Sekai - 2020', ''])
    lifeeasy.display()
    lifeeasy.stop_display()
def start():
    global cleaning_dir
    global destination_dir
    global destination_dir_name
    global unique_number
    global number_of_items

    lifeeasy.clear()
    if __file__ == '__main__':
        print("What's the folder you want to clean today?")
        cleaning_dir = input('> ')
    else:
        cleaning_dir = lifeeasy.working_dir()
    if cleaning_dir.lower() == 'cancel' or cleaning_dir.lower(
    ) == 'stop' or cleaning_dir.lower() == 'quit' or cleaning_dir.lower(
    ) == 'exit':
        goodbye(nothing=True)
    elif filecenter.isdir(cleaning_dir):
        if cleaning_dir[-1] != '/' or cleaning_dir[-1] != '\\':
            if filecenter.os_name() == 'nt':
                cleaning_dir = cleaning_dir + '\\'
            else:
                cleaning_dir = cleaning_dir + '/'

        for _ in filecenter.files_in_dir(cleaning_dir):
            number_of_items += 1

        destination_dir_name = 'Cleaned'
        while filecenter.exists(cleaning_dir + destination_dir_name):
            destination_dir_name = destination_dir_name + ' ' + str(
                unique_number)
            unique_number += 1
        destination_dir = cleaning_dir + destination_dir_name
        filecenter.make_dir(destination_dir)
        decide_mode()
    else:
        lifeeasy.display_action('It seems like you mistyped the path',
                                delay=0.1)
        print('Please retry entering the path to your folder')
        lifeeasy.sleep(2)
        start()
def decide_mode():
    lifeeasy.clear()
    print('Available options')
    print('')
    print('nosort   >   nothing will be sorted in your cleaned up folder')
    print(
        'type     >   each file will be sorted and put in a folder according to its type'
    )
    print('')
    print('')
    print('')
    print('How do you want to sort your cleaned folder?')
    decision = input('> ')
    if decision.lower() == 'cancel' or decision.lower(
    ) == 'stop' or decision.lower() == 'quit' or decision.lower() == 'exit':
        goodbye(nothing=True)
    elif decision.lower() == 'nosort' or decision.lower(
    ) == 'osort' or decision.lower() == 'nsort' or decision.lower(
    ) == 'noort' or decision.lower() == 'nosrt' or decision.lower(
    ) == 'nosot' or decision.lower() == 'nosor':
        lifeeasy.display_title('Cleaning your folder')
        lifeeasy.display_body(['Chosen mode: No Sorting'])
        lifeeasy.display(wait=0.5)
        nosort()
    elif decision.lower() == 'type' or decision.lower(
    ) == 'ype' or decision.lower() == 'tpe' or decision.lower(
    ) == 'tye' or decision.lower() == 'typ':
        lifeeasy.display_title('Cleaning your folder')
        lifeeasy.display_body(['Chosen mode: Type Sorting'])
        lifeeasy.display(wait=0.5)
        sort_by_type()
    else:
        print('Sorry I did not understand.')
        lifeeasy.sleep(2)
        lifeeasy.clear()
        decide_mode()
import lifeeasy
import sys

sys.setrecursionlimit(10**6)

iteration = 0


def fib(n, memo):
    global iteration
    iteration += 1
    if memo[n - 1] != None:
        result = memo[n - 1]
    elif n == 1 or n == 2:
        result = 1
    elif n > 2:
        result = fib(n - 1, memo) + fib(n - 2, memo)
    else:
        result = "Not a positive number"
    memo[n - 1] = result
    #print(result)
    return (result)


print("What's the number you want to get from Fibonacci?")
n = int(input('> '))
lifeeasy.clear()

memo = [None] * n
print(fib(n, memo))
print("It took " + str(iteration) + ' iteration to get this result.')
def setup(customurl=False, force_upgrade=False):
    global package_name
    global upgrade
    global custom_setup

    upgrade = force_upgrade

    setup = []

    # AUTHOR
    author = input('Who is the author? ')
    print('')

    def naming_package():
        global package_name
        global upgrade
        # NAME
        package_name = input("What's the name of your package? ")
        print('')

        lifeeasy.display_action('Verification', delay=0.1)
        name_verification = lifeeasy.request(
            'https://pypi.org/project/' + package_name + '/', 'get')
        if name_verification.status_code == 404:
            print('The name is available!')
        elif name_verification.status_code == 200:
            request = lifeeasy.request(
                'https://pypi.org/pypi/' + package_name + '/json', 'get')
            request_json = json.loads(request.text)
            if request_json['info']['author'] == author:
                print('upload mode: upgrade')
                print('Do you want to change some metadatas or keep them?')
                user_choice = input(
                    'press [enter] to continue with current metadatas or type [continue] to continue modifying the metadatas... '
                )
                if user_choice.lower() == 'continue' or user_choice.lower(
                ) == 'ontinue' or user_choice.lower(
                ) == 'cntinue' or user_choice.lower(
                ) == 'coninue' or user_choice.lower(
                ) == 'contnue' or user_choice.lower(
                ) == 'contiue' or user_choice.lower(
                ) == 'contine' or user_choice.lower() == 'continu':
                    upgrade = False
                else:
                    upgrade = True
            else:
                print('This name is already taken!')
                print('Please try giving another name to the package...')
                print('')
                naming_package()
        else:
            print('An error occured with the name verification...')
            return 1

    if upgrade == False:
        if naming_package() == 1:
            return 1
    else:
        # NAME
        package_name = input("What's the name of your package? ")
        print('')

    # VERSION
    version = input("What's the version of " + package_name + '? ')
    print('')

    if upgrade == False:
        # DESCRIPTION
        print('Write a little summary/description of ' + package_name)
        desc = input('> ')
        print('')

        # EMAIL
        email = input('What is his ' + author + "'s email? ")
        print('')

        # LICENSE
        print('Warning: the license name is case-sensitive!')
        package_license = input('What is the license for ' + package_name +
                                ' ? ')
        package_license_classifier = 'License :: OSI Approved :: ' + package_license + ' License'
        print('')

        request = lifeeasy.request(
            'https://github.com/' + author + '/' + package_name, 'get')
        if request.status_code == 404:
            # GITHUB REPO
            print("What is the GitHub repository for this package?")
            url = input('> ')
            print('')
        else:
            url = 'https://github.com/' + author + '/' + package_name

        # ARCHIVE
        if url[-1] == '/':
            download_url_try = url + 'archive/' + version + '.tar.gz'
        else:
            download_url_try = url + '/archive/' + version + '.tar.gz'
        request = lifeeasy.request(method='get', url=download_url_try)
        if request.status_code == 200:
            download_url = download_url_try
        else:
            if url[-1] == '/':
                download_url_try = url + 'archive/v' + version + '.tar.gz'
            else:
                download_url_try = url + '/archive/v' + version + '.tar.gz'
            request = lifeeasy.request(method='get', url=download_url_try)
            if request.status_code == 200:
                download_url = download_url_try
            else:
                github_release = input(
                    "What is the name of the GitHub release? ")
                print('')
                if url[-1] == '/':
                    download_url_try = url + 'archive/' + github_release + '.tar.gz'
                else:
                    download_url_try = url + '/archive/' + github_release + '.tar.gz'
                request = lifeeasy.request(method='get', url=download_url_try)
                if request.status_code == 200:
                    download_url = download_url_try
                else:

                    def ask_for_github_release():
                        global download_url
                        print(
                            'What is the URL of your GitHub release? (it ends with .tar.gz)'
                        )
                        download_url_try = input('> ')
                        print('')
                        request = lifeeasy.request(method='get',
                                                   url=download_url_try)
                        if request.status_code == 200:
                            download_url = download_url_try
                        else:
                            print(
                                "It seems that you mistyped the URL or that the repository is private..."
                            )
                            lifeeasy.sleep(2)
                            print(
                                "Please put your GitHub repository visibility in public and retry..."
                            )
                            print('')
                            lifeeasy.sleep(2)
                            ask_for_github_release()

                    ask_for_github_release()

        # CUSTOM URL
        if customurl == True:
            print('What is the URL of the website for this package?')
            url = input('> ')
            print('')

        # KEYWORDS
        print('Enter a comma-separated list of keywords for your package')
        keywords = input('> ')
        keywords = keywords.split(',')
        print('')

        # DEPENDENCIES
        print('Enter a comma-separated list of dependencies for your package')
        dependencies = input('> ')
        dependencies = dependencies.replace(' ', '')
        dependencies = dependencies.split(',')
        print('')

        # PYTHON VERSIONS
        print(
            'Enter a comma-separated list of supported Python version numbers for this package'
        )
        print('(i.e 3,3.4,3.5,3.6,3.7,3.8)')
        python_versions = input('> ')
        print('')
        python_versions = python_versions.replace(' ', '')
        python_versions = python_versions.split(',')

        versions_classifiers = []
        for python_version in python_versions:
            versions_classifiers.append('Programming Language :: Python :: ' +
                                        python_version)

        dev_status = 'Development Status :: 4 - Beta'

        def development_status():
            global dev_status
            global customclassifiers_bool
            lifeeasy.clear()
            print('Choose a development status from the following')
            print('')
            print('Alpha')
            print('Beta')
            print('Stable')
            print('')
            print(
                'Or press [enter] to add a custom one when adding classifiers...'
            )
            print('')
            print('')
            dev_status_try = input('> ')

            if dev_status_try.lower() == 'alpha':
                dev_status = 'Development Status :: 3 - Alpha'
            elif dev_status_try.lower() == 'beta':
                dev_status = 'Development Status :: 4 - Beta'
            elif dev_status_try.lower() == 'stable':
                dev_status = 'Development Status :: 5 - Production/Stable'
            elif dev_status_try == '':
                customclassifiers_bool = True
            else:
                print("Sorry but I couldn't recognize the status.")
                lifeeasy.sleep(1)
                print('Please try again...')
                lifeeasy.sleep(1)
                development_status()

        development_status()

        # CUSTOM CLASSIFIERS
        custom_classifiers = []
        if customclassifiers_bool == True:
            lifeeasy.clear()
            print("What are the custom classifiers that you want to add?")
            print('')
            print("You need to enter your classifiers one-by-one")
            print("You need to write the full classifier")
            print(
                "When you are done press [enter] again without entering anything."
            )
            print('')
            print('')
            user_choice = input('> ')
            if user_choice != '':
                custom_classifiers.append(user_choice)
            while user_choice != '':
                lifeeasy.clear()
                print("What are the custom classifiers that you want to add?")
                print('')
                print("You need to enter your classifiers one-by-one")
                print("You need to write the full classifier")
                print(
                    "When you are done press [enter] again without entering anything."
                )
                print('')
                print('')
                user_choice = input('> ')
                if user_choice != '':
                    custom_classifiers.append(user_choice)

    else:
        package_infos = lifeeasy.request(
            'https://pypi.org/pypi/' + package_name + '/json', 'get')
        package_infos = json.loads(package_infos.text)
        package_license = package_infos['info']['license']
        desc = package_infos['info']['summary']
        author = package_infos['info']['author']
        email = package_infos['info']['author_email']
        url = package_infos['info']['home_page']

        def ask_for_github_release():
            global download_url
            print(
                'What is the URL of your GitHub release? (it ends with .tar.gz)'
            )
            download_url_try = input('> ')
            print('')
            if lifeeasy.request_statuscode(method='get',
                                           url=download_url_try) == 200:
                download_url = download_url_try
            else:
                print(
                    "It seems that you mistyped the URL or that the repository is private..."
                )
                lifeeasy.sleep(2)
                print(
                    "Please put your GitHub repository visibility in public and retry..."
                )
                print('')
                lifeeasy.sleep(2)
                ask_for_github_release()

        ask_for_github_release()
        download_url = package_infos['info']['download_url']
        keywords_string = package_infos['info']['keywords']
        keywords = keywords_string.split(',')
        dependencies = package_infos['info']['requires_dist']
        classifiers = package_infos['info']['classifiers']

    # CUSTOM SETUP

    if custom_setup == True:
        print('Add your custom setup sections (comma-separated)')
        setup_customized = input('> ')
        if len(setup_customized) == 0:
            custom_setup = False

    lifeeasy.clear()
    print('Building your setup file')
    lifeeasy.sleep(random.uniform(0.126, 0.31))

    print('adding imports')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('from setuptools import setup')

    # README

    if filecenter.exists(lifeeasy.working_dir() + '/README.md'):
        print('adding the package readme')
        lifeeasy.sleep(random.uniform(0.126, 0.31))
        setup.append('from os import path')
        setup.append(
            "with open(path.join(path.abspath(path.dirname(__file__)), 'README.md'), encoding='utf-8') as f:"
        )
        setup.append("    readme_description = f.read()")

        long_description_type = 'text/markdown'

    elif filecenter.exists(lifeeasy.working_dir() + '/readme.md'):
        print('adding the package readme')
        lifeeasy.sleep(random.uniform(0.126, 0.31))
        setup.append('from os import path')
        setup.append('')
        setup.append(
            "with open(path.join(path.abspath(path.dirname(__file__)), 'readme.md'), encoding='utf-8') as f:"
        )
        setup.append("    readme_description = f.read()")
        setup.append('')
        setup.append('')

        long_description_type = 'text/markdown'

    else:
        long_description_type = ''

    # Need to add more readme type

    print('creating the setup class')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('setup(')

    print('adding the package name')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('name = "' + package_name + '",')

    print('adding the packages name')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('packages = ["' + package_name + '"],')

    print('adding the package version')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('version = "' + version + '",')

    print('adding the package license')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('license = "' + package_license + '",')

    print('adding the package description')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('description = "' + desc + '",')

    print('adding the package author')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('author = "' + author + '",')

    print('adding the package email')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('author_email = "' + email + '",')

    print('adding the package url')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('url = "' + url + '",')

    print('adding the package download url')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('download_url = "' + download_url + '",')

    print('adding the package keywords')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('keywords = ' + str(keywords) + ',')

    print('adding the package dependencies')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('install_requires = ' + str(dependencies) + ',')

    print('creating the package classifiers')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    if upgrade == False:
        classifiers = []
        classifiers.append(dev_status)
        classifiers.append(package_license_classifier)
        classifiers.extend(versions_classifiers)
        classifiers.extend(custom_classifiers)

    print('adding the package classifiers')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('classifiers = ' + str(classifiers) + ',')

    print('adding the package readme')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('long_description = readme_description,')

    print('adding the package readme type')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append('long_description_content_type = "' + long_description_type +
                 '",')

    setup.append('include_package_data=True,')

    if custom_setup == True:
        print('adding your custom setup sections')
        lifeeasy.sleep(random.uniform(0.126, 0.31))
        setup.append(setup_customized)

    print('finishing...')
    lifeeasy.sleep(random.uniform(0.126, 0.31))
    setup.append(')')

    print('creating the file...')
    lifeeasy.write_file('setup.py', setup)
    lifeeasy.sleep(random.uniform(1.5, 2.3))
    return 0
def start(keepsetup=False,
          cleanup=True,
          customclassifiers=True,
          customurl=False,
          upgrade=False,
          customsetup=False):
    global customclassifiers_bool
    global custom_setup
    custom_setup = customsetup
    customclassifiers_bool = customclassifiers
    lifeeasy.clear()
    status = first_confirmation()
    if status == 0:
        status = detect_setup(customurl=customurl, upgrade=upgrade)
        lifeeasy.clear()
        if status == 0:
            status = module_verification()
            lifeeasy.clear()
            if status == 0:
                status = build()
                lifeeasy.clear()
                if status == 0:
                    status = upload()
                    lifeeasy.clear()
                    if status == 0:
                        if cleanup == True:
                            status = clean(keepsetup=keepsetup)
                            lifeeasy.clear()
                            if status == 0:
                                print('Do you want to install the package?')
                                user_choice = input(
                                    '[enter] to install or enter [quit] ')
                                if user_choice.lower(
                                ) != 'quit' and user_choice.lower(
                                ) != 'stop' and user_choice.lower() != 'no':
                                    status = download()
                                    if status == 0:
                                        print('Everything is ok!')
                                        return 0
                                    else:
                                        print(
                                            'An error occured while downloading the package.'
                                        )
                                        return 7
                                else:
                                    print('Everything is ok!')
                                    return 0
                            else:
                                print(
                                    'An error occured while cleaning up the package directory.'
                                )
                                return 1
                        else:
                            print('Everything is ok!')
                            return 0
                    else:
                        print('An error occured while uploading your package.')
                        return 2
                else:
                    print('An error occured while building the package.')
                    return 3
            else:
                print('An error occured while verifying the module.')
                return 4
        else:
            print('An error occured while creating your setup file.')
            return 5
    else:
        print('Ok!')
        return 6
# IMPORTS
try:
    import lifeeasy
    import matplotlib.pyplot as plt
except:
    print('It is the first time launching the program')
    print('Installing the dependencies...')
    command_output = check_output(["pip", "install", "lifeeasy", "matplotlib"],
                                  universal_newlines=True)
    import lifeeasy
    import matplotlib.pyplot as plt
    print('Successfully installed the dependencies!')
    lifeeasy.sleep(2)

lifeeasy.clear()
lifeeasy.display_action('Retrieving data from data-lambda-etoile-polaire.txt')
lambda_data = []

# Open file for reading
file = open(lifeeasy.working_dir() + "/data-lambda-etoile-polaire.txt")
# Read the first line from the file
line = file.readline()
# Initialize counter for line number
line_no = 1

# Loop until EOF (fin)
while line != '':
    lambda_data.append(float(line[:-1]))
    line = file.readline()
    line_no += 1