def test_database_double_arg(arg): # Test the database where there are two command line parameters. # The first parameter is the name of the method to test. # The second parameter is the input parameter for the method that is being test. arg1 = arg[1].lower() arg2 = arg[2].lower() db = Database() if arg1 == "__contains__": print(arg2 in db) elif arg1 == "pokemon_id_exists": print(db.pokemon_id_exists(arg2)) elif arg1 == "pokemon_name_exists": print(db.pokemon_name_exists(arg2)) elif arg1 == "get_pokemon": print(db.get_pokemon(arg2)) elif arg1 == "get_pokemon_by_name": print(db.get_pokemon_by_name(arg2)) elif arg1 == "get_pokemon_by_id": print(db.get_pokemon_by_id(arg2)) elif arg1 == "names_with_prefix": print_items(db.names_with_prefix(arg2)) elif arg1 == "names_with_infix": print_items(db.names_with_infix(arg2)) elif arg1 == "get_light": print_items(db.get_light(threshold=int(arg2) / 10, all_pkmn=True)) elif arg1 == "get_dark": print_items(db.get_dark(threshold=int(arg2) / 10, all_pkmn=True)) else: print("No such public method '" + arg + "' with two parameters" " exists in the Database class.")
def single_argument_handler(arg, escape_code): """Handle the logic for when there is only one command line parameter inputted.""" db = Database() if len(arg) < 3 and arg.isalpha(): prefix_search(db, arg) elif arg == "extra": print_extra(db) elif arg == "regions": print_list(db.get_regions()) elif arg == "help" or arg.startswith("-h"): print_usage() elif arg == "kanto": print_columns(db.get_kanto()) elif arg == "johto": print_columns(db.get_johto()) elif arg == "hoenn": print_columns(db.get_hoenn()) elif arg == "sinnoh": print_columns(db.get_sinnoh()) elif arg == "unova": print_columns(db.get_unova()) elif arg == "kalos": print_columns(db.get_kalos()) elif arg == "all": print_columns(db.get_all()) elif arg in ("clear", "disable", "off"): scripter.clear_terminal() elif arg == "random" and escape_code: change_wallpaper(db, db.get_random()) elif arg == "random-kanto" and escape_code: change_wallpaper(db, db.get_random_from_region("kanto")) elif arg == "random-johto" and escape_code: change_wallpaper(db, db.get_random_from_region("johto")) elif arg == "random-hoenn" and escape_code: change_wallpaper(db, db.get_random_from_region("hoenn")) elif arg == "random-sinnoh" and escape_code: change_wallpaper(db, db.get_random_from_region("sinnoh")) elif arg == "random-unova" and escape_code: change_wallpaper(db, db.get_random_from_region("unova")) elif arg == "random-kalos" and escape_code: change_wallpaper(db, db.get_random_from_region("kalos")) elif arg == "random": change_terminal_background(db, db.get_random()) elif arg == "random-kanto": change_terminal_background(db, db.get_random_from_region("kanto")) elif arg == "random-johto": change_terminal_background(db, db.get_random_from_region("johto")) elif arg == "random-hoenn": change_terminal_background(db, db.get_random_from_region("hoenn")) elif arg == "random-sinnoh": change_terminal_background(db, db.get_random_from_region("sinnoh")) elif arg == "random-unova": change_terminal_background(db, db.get_random_from_region("unova")) elif arg == "random-kalos": change_terminal_background(db, db.get_random_from_region("kalos")) elif arg == "light" and escape_code: change_wallpaper(db, db.get_light()) elif arg == "dark" and escape_code: change_wallpaper(db, db.get_dark()) elif arg == "light": change_terminal_background(db, db.get_light()) elif arg == "dark": change_terminal_background(db, db.get_dark()) elif arg in ("type", "types"): print_types(db.get_pokemon_types()) elif arg == "slideshow": slideshow(db, 1, 494) elif arg == "slideshow-kanto": slideshow(db, 1, 152) elif arg == "slideshow-johto": slideshow(db, 152, 252) elif arg == "slideshow-hoenn": slideshow(db, 252, 387) elif arg == "slideshow-sinnoh": slideshow(db, 387, 494) elif arg == "slideshow-unova": slideshow(db, 494, 650) elif arg == "slideshow-kalos": slideshow(db, 650, 720) elif arg.endswith("slideshow"): slideshow(db, 1, 494, rand=arg.startswith("rnd")) elif arg.endswith("slideshow-kanto"): slideshow(db, 1, 152, rand=arg.startswith("rnd")) elif arg.endswith("slideshow-johto"): slideshow(db, 152, 252, rand=arg.startswith("rnd")) elif arg.endswith("slideshow-hoenn"): slideshow(db, 252, 387, rand=arg.startswith("rnd")) elif arg.endswith("slideshow-sinnoh"): slideshow(db, 387, 494, rand=arg.startswith("rnd")) elif arg.endswith("slideshow-unova"): slideshow(db, 494, 650, rand=arg.startswith("rnd")) elif arg.endswith("slideshow-kalos"): slideshow(db, 650, 720, rand=arg.startswith("rnd")) elif arg == "?": print("This function is deprecated.") elif arg == "evolve": evolve(db) elif arg == "party": party.party_print() elif arg == "party-show": party.party_show(db) elif arg.endswith("party-show"): party.party_show(db, rand=arg.startswith("rnd")) elif escape_code: change_wallpaper(db, arg) else: change_terminal_background(db, arg)