def test_database_single_arg(arg): # Test the database where there is a single command line parameter. # The parameter is the name of the method to test. arg = arg[1].lower() db = Database() if arg == "__str__": print(db) elif arg == "__len__": print(len(db)) elif arg == "get_all": print_items(db.get_all()) elif arg == "get_regions": print_items(db.get_regions()) elif arg == "get_kanto": print_items(db.get_kanto()) elif arg == "get_johto": print_items(db.get_johto()) elif arg == "get_hoenn": print_items(db.get_hoenn()) elif arg == "get_sinnoh": print_items(db.get_sinnoh()) elif arg == "get_unova": print_items(db.get_unova()) elif arg == "get_kalos": print_items(db.get_kalos()) elif arg == "get_extra": print_items(db.get_extra()) elif arg == "get_random": print(db.get_random()) else: print("No such public method '" + arg + "' with zero 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)