コード例 #1
0
ファイル: repl.py プロジェクト: Accelegator/accelegator
def repl(dataframe, call, command, arg1, arg2):

    if call == 1:
        return display.display_list(queries.query_list(dataframe))
        logging.debug("calling query and display for " + command)

    elif call == 2:
        return display.display_show(queries.query_show(dataframe, arg1))
        logging.debug("calling query and display for " + command +
                      " with arg " + arg1)

    elif call == 3:
        return display.display_show_with_field(
            queries.query_show_field(dataframe, arg1, get_field_int(arg2)))
        logging.debug("calling query and display for " + command +
                      " with args " + arg1 + ", " + arg2)

    elif call == 4:
        return (display.display_search(queries.query_search(dataframe, arg1)))
        logging.debug("calling query and display for " + command +
                      " with arg " + arg1)

    elif call == 5:
        return display.display_search_with_field(
            queries.query_search_field(dataframe, get_field_int(arg1), arg2))
        logging.debug("calling query and display for " + command +
                      " with args " + arg1 + ", " + arg2)

    elif call == 7:
        return display.display_help()
        logging.debug("calling query and display for " + command)

    elif call == 8:
        return display.display_help_with_command(arg1)
        logging.debug("calling query and display for " + command)
コード例 #2
0
                print("Out: " + str(OUT))
        elif COMMAND == "list":
            if ARG1:
                REP = ARG1
            else:
                REP = "all"
            # list of repositories or files in specified repository returned
            REPO = file_list.list_files(REP, OUT)
            for r in REPO:
                print(r)
        elif COMMAND == "analyze":
            while ARG1 not in SPECIFIERS:
                print("You must enter a specifier " + str(SPECIFIERS) + ".")
                ARG1 = str(input('Specifier: '))
            if ARG1 == "source":
                analyze_java.analyze_java(OUT)
            elif ARG1 == "comments":
                analyze_comments.analyze_comments(OUT)
            elif ARG1 == "commits":
                analyze_commits.analyze_commits(OUT)
            elif ARG1 == "reflection":
                analyze_reflection.analyze_reflection(OUT)
        elif COMMAND == "help":
            if ARG1 == "":
                print(display.display_help())
            else:
                print(display.display_help_with_command(ARG1))
        COMMAND = str(input('>>> '))
        ARG1 = ""
        ARG2 = ""
コード例 #3
0
def test_display_help_with_command_quit():
    """Check if correct string is returned for quit command."""
    expected_help_string = """\x1b[1mquit\n----\x1b[0m\nCommand: quit\nDescription: Quits the Accelegator program\nArguments: None\n"""
    actual_help_string = display.display_help_with_command("quit")

    assert repr(actual_help_string) == repr(expected_help_string)
コード例 #4
0
def test_display_help_with_command_write():
    """Check if correct string is returned for write command."""
    expected_help_string = """\x1b[1mwrite\n-----\x1b[0m\nCommand: write\nDescription: Write the output of <command> to file (will prompt for file name)\nArguments: <command>: Command whose output to write to file\n"""
    actual_help_string = display.display_help_with_command("write")

    assert repr(actual_help_string) == repr(expected_help_string)
コード例 #5
0
def test_display_help_with_command_help():
    """Check if correct string is returned for help command."""
    expected_help_string = """\x1b[1mhelp\n----\x1b[0m\nCommand: help\nDescription: List commands and their brief descriptions\nArguments: None\n\nCommand: help <command>\nDescription: Show verbose description of usage and show valid arguments for <command>\nArguments: <command>: Command to show description and valid arguments for.\nCan be any of the following\n\thelp\n\tgensim\n\tlist\n\tshow\n\tsearch\n\twrite\n\tquit\n"""
    actual_help_string = display.display_help_with_command("help")

    assert repr(actual_help_string) == repr(expected_help_string)
コード例 #6
0
def test_display_help_with_command_search():
    """Check if correct string is returned for search command."""
    expected_help_string = """\x1b[1msearch\n------\x1b[0m\nCommand: search <field>\nDescription: Search all fields of all responses of all advisees for given <keyword>\nArguments: <keyword>: Any single string\n\nCommand: search <field> <keyword>\nDescription: can input any of the fields listed below and insert any keyword which would parse through the database for anything matching the keyword or anything close to it\nArguments: <keyword>: Any single string\n<field>: Can be any of the following\n\tacademic-interests\n\tacademic-update\n\tadvisor-questions\n\tcareer\n\tcover-letter\n\tfav-major-classes\n\tfav-nonmajor-classes\n\tgrad-year\n\tid\n\tlife-update\n\tlinkedin\n\tmajor\n\tminor\n\tname\n\tpersonal-interests\n\tresume\n\tsecond-major\n\tsecond-minor\n\tstrengths\n\ttwitter\n\tweaknesses\n\twebsite\n"""
    actual_help_string = display.display_help_with_command("search")

    assert repr(actual_help_string) == repr(expected_help_string)
コード例 #7
0
def test_display_help_with_command_list():
    """Check if correct string is returned for list command."""
    expected_help_string = """\x1b[1mlist\n----\x1b[0m\nCommand: list\nDescription: List emails of all advisees\nArguments: None\n"""
    actual_help_string = display.display_help_with_command("list")

    assert repr(actual_help_string) == repr(expected_help_string)
コード例 #8
0
def test_display_help_with_command_show():
    """Check if correct string is returned for show command."""
    expected_help_string = """\x1b[1mshow\n----\x1b[0m\nCommand: show <email>\nDescription: Display flattened (i.e. the latest response for each field) responses for advisee with <email>\nArguments: <email>: Email of advisee. Include "@allegheny.edu"\n\nCommand: show <email> <field>\nDescription: Display all responses for advisee with <email> for given <field> (a number). Will show all previous and latest responses.\nArguments: <email>: Email of advisee. Include "@allegheny.edu"\n<field>: Can be any of the following\n\tacademic-interests\n\tacademic-update\n\tadvisor-questions\n\tcareer\n\tcover-letter\n\tfav-major-classes\n\tfav-nonmajor-classes\n\tgrad-year\n\tid\n\tlife-update\n\tlinkedin\n\tmajor\n\tminor\n\tname\n\tpersonal-interests\n\tresume\n\tsecond-major\n\tsecond-minor\n\tstrengths\n\ttwitter\n\tweaknesses\n\twebsite\n"""
    actual_help_string = display.display_help_with_command("show")

    assert repr(actual_help_string) == repr(expected_help_string)
コード例 #9
0
def test_display_help_with_command_help():
    expected_help_list = """\x1b[1mhelp\n----\x1b[0m\nCommand: help\nDescription: List commands and their brief descriptions\nArguments: None\n\nCommand: help <command>\nDescription: Show verbose description of usage and show valid arguments for <command>\nArguments: <command>: Command to show description and valid arguments for.\nCan be any of the following:\n\thelp\n\tget\n\tconfig\n\tlist\n\tanalyze\n\tquit\n"""
    help_list = display.display_help_with_command("help")
    assert repr(help_list) == repr(expected_help_list)