def run(): print(" ****************** Welcome host **************** ") print() show_commands() while True: action = get_action() with switch(action) as s: s.case("c", create_account) s.case("a", log_into_account) s.case("l", list_cages) s.case("r", register_cage) s.case("u", update_availability) s.case("v", view_bookings) s.case("m", lambda: "change_mode") s.case(["x", "bye", "exit", "exit()"], exit_app) s.case("?", show_commands) s.case("", lambda: None) s.default(unknown_command) if action: print() if s.result == "change_mode": return
def run(): print(' ****************** Welcome Dancer **************** ') print() show_commands() while True: action = studios.get_action() with switch(action) as s: s.case('c', studios.create_account) s.case('l', studios.log_into_account) s.case('a', apply_to_teach) s.case('y', view_your_studios) s.case('b', book_a_class) s.case('v', view_bookings) s.case('m', lambda: 'change_mode') s.case('?', show_commands) s.case('', lambda: None) s.case(['x', 'bye', 'exit', 'exit()'], studios.exit_app) s.default(studios.unknown_command) state.reload_account() if action: print() if s.result == 'change_mode': return
def run(): print(' ****************** Welcome host **************** ') print() show_commands() while True: action = get_action() with switch(action) as s: s.case('c', create_account) s.case('a', create_account) s.case('l', log_into_account) s.case('y', list_cages) s.case('r', register_cage) s.case('u', update_availability) s.case('v', view_bookings) s.case('m', lambda: 'change_mode') s.case(['x', 'bye', 'exit', 'exit()'], exit_app) s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) if action: print() if s.result == 'change_mode': return
def run(): print(' ****************** Welcome host **************** ') print() show_commands() while True: action = get_action() with switch(action) as s: s.case('c', create_account) s.case('l', log_into_account) s.case('s', list_schools) s.case('a', attendance_an) s.case('n', scores_an) s.case('e', enrol_an) s.case('f', rate_forms_in_school) s.case('b', rate_students_all_forms_by_school) s.case('an_s', an.analysis_students) s.case('an_d', an.analysis_districts) s.case('m', lambda: 'change_mode') s.case(['x', 'bye', 'exit', 'exit()'], exit_app) s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) if action: print() if s.result == 'change_mode': return
def scores_an(): print( ' ****************** Schools of NYC sorted by any score **************** ' ) if not state.active_account: error_msg("You must log in first to view scools by score analysis") return show_commands2() while True: action = get_action() with switch(action) as s: s.case('1', get_schools_sorted_m) s.case('2', get_schools_sorted_r) s.case('3', get_schools_sorted_w) s.case('4', get_schools_sorted_ex) s.case('5', get_schools_sorted_av) s.case('m', lambda: 'change_mode') s.case(['x', 'bye', 'exit', 'exit()'], exit_app) s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) if action: print() if s.result == 'change_mode': return
def run(): print() print('***************************** WELCOME ***************************') print() show_commands() while True: action = get_action() with switch(action) as s: s.case('a', add_record) s.case('e', export_records) s.case('g', generate_labels) s.case('l', list_records) s.case('f', find_record) s.case(['x', 'bye', 'exit', 'exit()'], exit_app) s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) if action: print() if s.result == 'change_mode': return
def run(): print(' ****************** Welcome host **************** ') print() show_commands() while True: action = get_action() with switch(action) as s: s.case('c', create_account) s.case('a', log_into_account) s.case('l', list_cages) s.case('r', register_cage) s.case('u', update_availability) s.case('v', view_bookings) s.case('m', lambda: 'change_mode') s.case(['x', 'bye', 'exit', 'exit()'], exit_app) s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) if action: print() if s.result == 'change_mode': return
def run(): print(' ****************** Welcome guest **************** ') print() show_commands() while True: action = hosts.get_action() with switch(action) as s: s.case('c', hosts.create_account) s.case('l', hosts.log_into_account) s.case('a', add_a_school) s.case('y', view_his_schools) s.case('v', view_districts) s.case('m', lambda: 'change_mode') s.case('?', show_commands) s.case('', lambda: None) s.case(['x', 'bye', 'exit', 'exit()'], hosts.exit_app) s.default(hosts.unknown_command) state.reload_account() if action: print() if s.result == 'change_mode': return
def run(): print(' ****************** Welcome guest **************** ') print() show_commands() while True: action = hosts.get_action() with switch(action) as s: s.case('c', hosts.create_account) s.case('l', hosts.log_into_account) s.case('a', add_a_snake) s.case('y', view_your_snakes) s.case('b', book_a_cage) s.case('v', view_bookings) s.case('m', lambda: 'change_mode') s.case('?', show_commands) s.case('', lambda: None) s.case(['x', 'bye', 'exit', 'exit()'], hosts.exit_app) s.default(hosts.unknown_command) state.reload_account() if action: print() if s.result == 'change_mode': return
def run(): print(' ****************** Welcome guest **************** ') print() show_commands() while True: action = hosts.get_action() # there is no default switch smt. in python , # so this is a library by @michaelkennedy with switch(action) as s: s.case('c', hosts.create_account) s.case('l', hosts.log_into_account) s.case('a', add_a_snake) s.case('y', view_your_snakes) s.case('b', book_a_cage) s.case('v', view_bookings) s.case('m', lambda: 'change_mode') s.case('?', show_commands) s.case('', lambda: None) s.case(['x', 'bye', 'exit', 'exit()'], hosts.exit_app) s.default(hosts.unknown_command) state.reload_account() if action: print() if s.result == 'change_mode': return
def run(): print(" ****************** Welcome guest **************** ") print() show_commands() while True: action = hosts.get_action() with switch(action) as s: s.case("c", hosts.create_account) s.case("l", hosts.log_into_account) s.case("a", add_a_snake) s.case("y", view_your_snakes) s.case("b", book_a_cage) s.case("v", view_bookings) s.case("m", lambda: "change_mode") s.case("?", show_commands) s.case("", lambda: None) s.case(["x", "bye", "exit", "exit()"], hosts.exit_app) s.default(hosts.unknown_command) state.reload_account() if action: print() if s.result == "change_mode": return
def main(): setup_db() options = "Enter a command: [b]rowse, [f]ind, [r]ead reviews, e[x]it: " cmd = "NOT SET" while cmd: cmd = input(options).lower().strip() with switch(cmd) as s: s.case('b', browse_locations) s.case('f', find_locations) s.case('r', read_reviews) s.case(['x', ''], exit_app) s.default(lambda: print(f"Not a valid command: {cmd}"))
def main(): setup_db() options = 'Enter a command, [r]ent, [a]vailable, [l]ocate, [h]istory, e[X]it: ' cmd = "NOT SET" while cmd: cmd = input(options).lower().strip() with switch(cmd) as s: s.case('r', rent_a_scooter) s.case('a', find_available_scooters) s.case('l', locate_our_scooters) s.case('h', my_history) s.case(['x', ''], exit_app) s.default(lambda: print(f"Don't know what to do with {cmd}."))
def main(): setup_db() options = 'Enter a command, [r]ent, [a]dd patient, [l]ist all patients, [h]istory, e[X]it: ' cmd = "NOT SET" while cmd: cmd = input(options).lower().strip() with switch(cmd) as s: #s.case('r', rent_a_scooter) s.case('a', add_patient) s.case('l', list_all_patients) s.case('n', list_patient_by_name) s.case('b', blood_possibilities) s.case(['x', ''], exit_app) s.default(lambda: print(f"Don't know what to do with {cmd}."))
def main(): mongo_setup.global_init(set_up_globals.database_name) print_header() while not state.active_account: try: response = log_into_account() if response in set_up_globals.exitResponseList: exit_app() except KeyboardInterrupt: return show_commands() try: while True: action = get_action() with switch(action) as s: s.case('a', import_assay_data) s.case('d', import_clinical_data) # s.case('r', import_redcap_data) s.case('b', import_biospecimen_data) # s.case('p', import_proteomics_data) s.case('scrna', import_scrnaseq_summary_data) s.case('dlt', import_data_label_types) s.case('compids', import_compound_ids) s.case('pathways', import_pathway_data) s.case('cdlt', combine_data_label_types) s.case('tp', test_pathway_mapping) s.case('vc', list_clinical_data) s.case('vb', list_biospecimen_data_for_study_id) s.case('vsc', list_biospecimen_data_for_scrnaseq_summary) s.case('vosc', list_only_scrnaseq_summary) s.case(set_up_globals.exitResponseList, exit_app) # ['x', 'bye', 'exit', 'exit()'] s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) if action: print() except KeyboardInterrupt: return
def run(): print(' ****************** Welcome host **************** ') print() show_commands() while True: action = get_action() with switch(action) as s: s.case('c', create_account) s.case('l', log_into_account) s.case('p', create_post) if action: print() if s.result == 'change_mode': return
def for_guest(): print(' ********** Welcome Guest **********') while 1: show_options() action = host.get_option() with switchlang.switch(action) as s: s.case('C', host.create_account) s.case('L', host.login) s.case('B', book_cage) s.case('A', add_bird) s.case('Y', list_birds) # s.case('L', my_bookings) s.case('M', lambda: 'mode_change') s.case(['X', 'exit', 'quit', 'exit()', 'quit()', 'bye'], exit) state.reload_account() if s.result == 'mode_change': return
def Personal(user): global brk brk = 0 show_commands() while True: action = get_action(user) with switch(action) as s: s.case('t', lambda: create_task(user)) s.case('b', lambda: backlog(user)) s.case('c', lambda: completed_task(user)) s.case('o', lambda: in_progress(user)) s.case('l', lambda: log_work(user)) s.case('p', lambda: change_password(user)) s.case(['<'], break_loop) s.case(['e', 'bye', 'exit', 'exit()'], exit) s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) if brk: break
def for_host(): print(' ********** Welcome Host **********') while 1: show_options() action = get_option() with switchlang.switch(action) as s: s.case('C', create_account) s.case('L', login) s.case('R', register_cage) s.case('Y', list_cages) s.case('U', update_availability) s.case('S', lambda: 'mode_change') s.case(['X', 'exit', 'quit', 'exit()', 'quit()', 'bye'], exit) # s.case('L', log_into_account) state.reload_account() if s.result == 'mode_change': return
def main(kwargs): user = login_user(kwargs['username'], kwargs['password']) if not user: raise ValueError("Incorrect User/password") try: welcome(user) while True: show_commands() action = get_action(user) with switch(action) as s: s.case('p', lambda: Personal(user)) s.case('o', lambda: Office(user)) s.case(['e', 'bye', 'exit', 'exit()'], exit) s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) except KeyboardInterrupt: return "" finally: print(Fore.BLACK, "Thank you For using FreeWork".center(110, " "), end='') print()
def run(): print(' ****************** Welcome host **************** ') print() show_commands() while True: action = get_action() with switch(action) as s: s.case(['c', 'C'], create_account) s.case(['l', 'L'], log_into_account) s.case(['u', 'U'], unknown_command) s.case(['m', 'M'], lambda: 'change_mode') s.case(['x', 'bye', 'exit', 'exit()'], exit_app) s.case('?', show_commands) s.case('', lambda: None) s.default(unknown_command) if action: print() if s.result == 'change_mode': return