def employee(): functions.header_line("Enter an employee name to search for.") search_term = input("Enter the employee name: ") # Get a list of employees employee_list = [] names = (db.Task.select(db.Task.user_name).distinct().where( db.Task.user_name.startswith(search_term)).group_by(db.Task.user_name)) for name in names: employee_list.append(name.user_name) if len(employee_list) == 0: functions.header_line("No records for employee found.") input("Press enter to continue.") return if len(employee_list) == 1: # Display the results display_tasks( db.Task.select().where(db.Task.user_name == employee_list[0])) if len(employee_list) > 1: # Display a list of employees menu_employee = functions.menu("Select a employee to view tasks.", *employee_list, "Return to reports menu.") # Quit option if int(menu_employee) > len(employee_list): return # Display the results display_tasks(db.Task.select().where( db.Task.user_name == employee_list[int(menu_employee) - 1]))
def main(): fn.init() myself = Student() # 创建实例 fn.login(myself) # 登录 """主循环""" while True: get_input = fn.menu() if get_input == 1: exit() elif get_input == 2: fn.add_new_test(myself) elif get_input == 3: fn.make_bar_graph(myself) elif get_input == 4: fn.remove_test(myself) elif get_input == 5: fn.change_results(myself) elif get_input == 6: fn.make_line_graph(myself) elif get_input == 7: fn.show_tests_list(myself) elif get_input == 8: fn.show_test_info(myself) elif get_input == 9: fn.rename_test(myself) elif get_input == 10: fn.change_passwd(myself)
def main(): while True: menu() operation = choose_operation() if not operation: break elif operation == 1: write_db(create_user()) elif operation == 2 and read_db(): delete_user() elif operation == 3 and read_db(): show_n_users() elif operation == 4 and read_db(): search_user() elif operation == 5 and read_db(): edit_user() elif operation == 6 and read_db(): filter_by_keyword()
def welcome(message): global user markup = f.menu() bot.send_message( message.chat.id, 'Привет, {0.first_name}!\n Я Пифа, кабарга. Создана для выполнения крайне необходимых задач) Ну а если хочешь узнать, кто это такая ваша кабарга, то вот ссылка: https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B1%D0%B0%D1%80%D0%B3%D0%B0' .format(message.from_user), parse_mode='html', reply_markup=markup) user[message.from_user.id] = {} user[message.from_user.id]['weather'] = False
def dialog(message): global user #user.set(message.from_user.id) if message.text != 'Хватит' and user[message.from_user.id]['weather']: gorod = str(message.text) temperature = f.weather(gorod) bot.send_message(message.chat.id, temperature) #elif message.text != 'Хватит' and user.number and user.code == message.from_user.id: # number = str(message.text) # number = f.simple(number) # bot.send_message(message.chat.id, number) elif message.text == 'Хватит': #user.number = False user[message.from_user.id]['weather'] = False markup = f.menu() bot.send_message(message.chat.id, 'Ok', reply_markup=markup) elif message.text == '5 Новостей': for i in f.parser(): bot.send_message(message.chat.id, i) elif message.text == 'Орел и Решка': choice = f.orel() bot.send_message(message.chat.id, choice) elif message.text == 'Простое число': #user.number = True markup = f.break_() bot.send_message(message.chat.id, 'Введи число', parse_mode='html', reply_markup=markup) elif message.text == 'Погода': user[message.from_user.id]['weather'] = True markup = f.break_() bot.send_message(message.chat.id, 'Введи город', parse_mode='html', reply_markup=markup) elif message.text == 'Угадай число': bot.send_message(message.chat.id, x) else: print(user) bot.send_message(message.chat.id, 'Мой глупый автор не прописал диалоги 😢')
def program_loop(): while True: menu_choice = functions.menu("Main Menu:", "Record a new task entry.", "Lookup previous task entries.", "Exit the program.") if int(menu_choice) == 1: new_task = task.Task() if int(menu_choice) == 2: reports_menu() if int(menu_choice) == 3: functions.clear_screen() break
def date(): while True: # Get a list of dates date_list = [] dates = db.Task.select(db.Task.date).distinct().group_by(db.Task.date) for date in dates: date_list.append(str(date.date)) # Display a list of employees§ menu_date = functions.menu("Select a date to view tasks.", *date_list, "Return to reports menu.") # Quit option if int(menu_date) > len(date_list): break # Display the results display_tasks(db.Task.select().where( db.Task.date == date_list[int(menu_date) - 1])) break
def reports_menu(): while True: menu_search = functions.menu("Lookup previous task entries:", "Find by employee.", "Find by date.", "Find by search term.", "Find by date range.", "Return to main menu.") if int(menu_search) == 1: result = lookup.employee() if int(menu_search) == 2: result = lookup.date() if int(menu_search) == 3: result = lookup.term() if int(menu_search) == 4: result = lookup.date_range() if int(menu_search) == 5: functions.clear_screen() break
import functions from masterpw import MASTERPW from mongodb import collection PASSWORD = input("\nIntroduce the master password: "******"Invalid password! Try again.") break if MASTERPW == PASSWORD: while True: # show the menu functions.menu() # we ask the user to introduce an option opcionMenu = input("\nInsert an option: ") # depends on what the user introduces, we do different things if opcionMenu == "1": print("\nOk, now you have to introduce some data.") pass_id = int( input( "\nIntroduce an id for this password (Number between 1 and 1000): " )) service = input("Introduce the service (Facebook, Gmail...): ") user = input("Introduce your user: "******"Introduce your password: ") functions.addPassword(pass_id, service, user, password)
url = input("Enter the name of Website: ") try: urln = int(input("Enter 1 for http and 2 for https: ")) urlt = '' if (urln == 1): urlt = "http://" elif (urln == 2): urlt = "https://" else: print("Invalid Input Please Re-enter") a = 1 / 0 website = requests.get(urlt + url) print(website.status_code) f.menu() while (1): ch = input("[#] Choose Any Scan OR Action From The Above List: ") if (ch == '0'): print("[+] Scanning Begins..... \n[i] Scanning Site: " + urlt + url + "\n[S] Scan Type: Basic Recon") f.basic_recon(urlt, url) elif (ch == '1'): print("[+] Scanning Begins..... \n[i] Scanning Site: " + urlt + url + "\n[S] Scan Type: WHOIS Lookup") f.whois(url) elif (ch == '2'): print("[+] Scanning Begins..... \n[i] Scanning Site: " + urlt + url + "\n[S] Scan Type: Geo-IP Lookup") f.geoip_lookup(url) elif (ch == '3'):
# main file from DataBase import DataBase import functions as func # MAIN LOOP loop = True while loop: #func.clear() action = func.menu() if action == '1': func.clear() func.createDB() elif action == '2': func.clear() dbName = func.listDBs() print(dbName) func.manageDB(dbName) elif action == '3': func.clear() loop = False
from functions import create, remove, menu, show menu() n = int(input("Uildliin dugaar oruulna uu: ")) if n == 1: show() elif n == 2: create() elif n == 3: remove() elif n == 4: print("homework") else: print("Ta programmaas garlaa")
def menu(tid): logger.info("[%s] - %s" % (request.method, request.path)) return Response(functions.menu(tid))
import functions print('=========== Searcher of Similar Figures ===========') print(''' Option 1: Compare Option 2: Save Exit: Press Enter ''') user_answer = input('Answer: ') functions.menu(user_answer) # Find similar figure consists in using the figure reader function and the comparison function, # then execute the function save the image. It will be cool if we add a function than show other similar results # Save figure just save the figure in a file. We should create .txt in the project file.
def main(): functions.menu()
print " 0.1 Beta Version " #import modules import values import random import functions username=raw_input("Hi. What's your name ? ") score=0 if functions.load(values.savefile)!=False and username in functions.load(values.savefile).keys(): s=functions.load(values.savefile) score+=s[username] print "I remember ya ! You had {0} points !".format(s[username]) functions.menu() print "Guess the word ! You have 8 tries only though." answer='y' while answer.lower()[0]=='y': #declaring variables count=0 i=random.randrange(113810) word_to_guess=values.words[i] #hide the word print functions.hide_it(word_to_guess, "-") print "Left:",values.retries-count, "retries."
def main(): """Funkcja wykonująca cały program""" modul = modules.Modules() fun = function.Functions() file = files.Files() register = registration.Registration() files_with_code = pythonfiles.FileInDirectory() path = r'.\\' extend = 'py' result = files_with_code.list_directory(path, extend) files.Files.checking_connections_between_files(result) function_list1 = function.Functions.checking_connections_between_functions1( result) function_list2 = fun.checking_weight_of_connections_between_functions( result, function_list1) weight_fun = functions.write_to_file_fun_data(function_list1, function_list2) function.Functions.checking_connections_between_functions( result, weight_fun) modul_list = modules.Modules.searching_for_used_modules(result) modules.Modules.checking_connections_between_modules(result, modul_list) join_list = functions.convert_list_to_list_for_cc( files.Files.filesConnectionList, modules.Modules.modulConnectionList) join_list = list(set(join_list)) cyclomatic_complexity = functions.cyclomatic_complexity() cyclomatic_complexity = functions.compare(function_list1, cyclomatic_complexity) cyclomatic_complexity += join_list menu_choice = functions.menu() if menu_choice == 1: registration.Registration.write_to_file( "FILES", files.Files.filesConnectionList ) # Wpisywanie do pliku połączeń plików registration.Registration.write_to_file( "", files.Files.filesConnectionWeight) elif menu_choice == 2: registration.Registration.write_to_file( "Functions", function.Functions.functionsConnectionList ) # Wpisywanie do pliku połączeń funkcji registration.Registration.write_to_file( "", function.Functions.functionsConnectionWeight) registration.Registration.write_to_file("CYCLOMATIC_COMPLEXITY", cyclomatic_complexity) elif menu_choice == 3: registration.Registration.write_to_file( "Modules", files.Files.filesConnectionList ) # Wpisywanie do pliku połączeń modułów registration.Registration.write_to_file( "", modul.Modules.modulConnectionWeight) elif menu_choice == 4: registration.Registration.write_to_file( "FILES", files.Files.filesConnectionList ) # Wpisywanie do pliku połączeń plików registration.Registration.write_to_file( "", files.Files.filesConnectionWeight) registration.Registration.write_to_file( "Functions", function.Functions.functionsConnectionList ) # Wpisywanie do pliku połączeń funkcji registration.Registration.write_to_file( "", function.Functions.functionsConnectionWeight) registration.Registration.write_to_file("CYCLOMATIC_COMPLEXITY", cyclomatic_complexity) elif menu_choice == 5: registration.Registration.write_to_file( "FILES", files.Files.filesConnectionList ) # Wpisywanie do pliku połączeń plików registration.Registration.write_to_file( "", files.Files.filesConnectionWeight) registration.Registration.write_to_file( "Modules", modules.Modules.modulConnectionList ) # Wpisywanie do pliku połączeń modułów registration.Registration.write_to_file( "", modules.Modules.modulConnectionWeight) elif menu_choice == 6: registration.Registration.write_to_file( "Functions", function.Functions.functionsConnectionList ) # Wpisywanie do pliku połączeń funkcji registration.Registration.write_to_file( "", function.Functions.functionsConnectionWeight) registration.Registration.write_to_file( "Modules", modules.Modules.modulConnectionList ) # Wpisywanie do pliku połączeń modułów registration.Registration.write_to_file( "", modules.Modules.modulConnectionWeight) registration.Registration.write_to_file("CYCLOMATIC_COMPLEXITY", cyclomatic_complexity) elif menu_choice == 7: registration.Registration.write_to_file( "FILES", files.Files.filesConnectionList ) # Wpisywanie do pliku połączeń plików registration.Registration.write_to_file( "", files.Files.filesConnectionWeight) registration.Registration.write_to_file( "Functions", function.Functions.functionsConnectionList ) # Wpisywanie do pliku połączeń funkcji registration.Registration.write_to_file( "", function.Functions.functionsConnectionWeight) registration.Registration.write_to_file( "Modules", modules.Modules.modulConnectionList ) # Wpisywanie do pliku połączeń modułów registration.Registration.write_to_file( "", modules.Modules.modulConnectionWeight) registration.Registration.write_to_file("CYCLOMATIC_COMPLEXITY", cyclomatic_complexity) else: print("Wybrałeś opcję z poza zakresu") main()
vacina = 0 social = 50 moedas = 200 estoque = { "alimentos": { "agua": 5, "lanche": 2, "frango": 0 }, "cuidados": { "mascara": 10, "alquingel": 0 } } atividade = fn.menu(moedas) #1.Alimentar # 2.Armário # 3.loja # 4.Médico # 5.Dormir # 6.Passear # 7. Status if atividade == "1": fome, estoque = fn.alimentar(fome, estoque, moedas) elif atividade == "2": fn.armario(estoque) elif atividade == "3":
def main(): f.inici() f.menu()
import functions import webpages import webbrowser import real_weppage from functions import makeurl movie_name = functions.takeinput() url = functions.makeurl(movie_name) # webbrowser.open(url) html = webpages.requests_webpage(url) parsed_html = webpages.parse_html(html) # print(parsed_html) webpages.create_movie_database(parsed_html) [movie_names, movie_links] = webpages.create_movie_database(parsed_html) # print(movie_links) choice = functions.menu(movie_names) html2 = webpages.requests_webpage(movie_links[int(choice) - 1]) parsed_html2 = webpages.parse_html(html2) links = webpages.click_gd(parsed_html2) real_weppage.real_site(links) # print(url) # import webbrowser # import requests # webbrowser.open("http://www.google.com") # requests.get("https://www.google.com") # print(makeurl("iron man"))
import functions as f defaults = dict( path='C:\\0Utvikling\\Installasjon\\bmc-tools-master\\output\\', extension='bmp') if __name__ == '__main__': f.welcome_screen() main_menu = f.menu() keep_running = True while keep_running: command = input("> ").split(' ', maxsplit=2) if command[0] in main_menu: if main_menu[command[0]] == 1: # help menu f.help_screen() elif main_menu[command[0]] == 2: # load menu if len(command) > 1: print('Loading ' + command[1]) f.find_images(path=command[1], file_extension=command[2]) else: print(f.message('invalid_path')) elif main_menu[command[0]] == 3: # quick load list_images = f.find_images(defaults['path'], defaults['extension']) print(list_images) f.create_new_image(list_images) elif main_menu[command[0]] == 99: # quit the program print(f.message('quit')) keep_running = False