def main(): os.system('cls') Interface.PrintMenu() activity = int(input('Enter activity : ')) Selector(activity) os.system('cls') main()
def Selector(Activity): if Activity == 1: Prettify() elif Activity == 2: Interface.PrintFindMenu() FmsActivity = int(input('Enter search type : ')) FindMenuSelector(FmsActivity) elif Activity == 3: filename = SetURL() elif Activity == 4: SetFileName() elif Activity == 5: pass else: os.system('cls') quit()
def get_if_list(self, host): """Get list of host's interfaces""" results = NetCrawler.snmp.walk(host.ip, '1.3.6.1.2.1.2.2.1.6') if results is not None: for result in results: for name, val in result: interface = str(name).split('1.3.6.1.2.1.2.2.1.6.', 1)[1] mac = hex_to_mac(val) host.add_mac(mac) intf = Interface() intf.number = str(name).split('1.3.6.1.2.1.2.2.1.6.', 1)[1] intf.mac = hex_to_mac(val) host.add_interface(intf) del interface del mac del results results = NetCrawler.snmp.walk(host.ip, '1.3.6.1.2.1.2.2.1.2') if results is not None: for result in results: for name, val in result: interface = str(name).split('1.3.6.1.2.1.2.2.1.2.', 1)[1] descr = str(val) intf = host.get_interface(interface) intf.descr = descr del interface del descr del results results = NetCrawler.snmp.walk(host.ip, '1.3.6.1.2.1.2.2.1.8') if results is not None: for result in results: for name, val in result: interface = str(name).split('1.3.6.1.2.1.2.2.1.8.', 1)[1] status = str(val) intf = host.get_interface(interface) intf.status = status del results results = NetCrawler.snmp.walk(host.ip, '1.3.6.1.2.1.31.1.1.1.1') #print('ifName') if results is not None: for result in results: for name, val in result: interface = str(name).split('1.3.6.1.2.1.31.1.1.1.1.', 1)[1] if_name = str(val) intf = host.get_interface(interface) intf.name = if_name
""" falando sobre heranças, onde se pode fazer com que a classe mae tenha atributos da classe filha (conceitualmente errado) """ from classes.interface import Interface i1 = Interface() i1.chama_metodo_interface()
async def text(message : Message): # --------Global variables global interface global database # --------Set interface language if message.text in INTERFACE_LANGUAGE.keys(): interface = Interface(INTERFACE_LANGUAGE[message.text]) animation, text, keyboard = interface.welcome() await bot.send_animation(chat_id=message.chat.id,animation = open(animation,'rb')) await bot.send_message(chat_id=message.chat.id, text = text.format(message.from_user.first_name),parse_mode='html',reply_markup=keyboard) # --------Keyboard listener if message.text in list(WELCOME_LANGUAGE.values())[0] or list(WELCOME_LANGUAGE.values())[1]: if message.text == WELCOME_LANGUAGE[interface.language][0]: photo, caption = interface.about_us() await send_photo(message.chat.id,photo=photo) await bot.send_message(message.chat.id,text =caption,parse_mode='html') elif message.text == WELCOME_LANGUAGE[interface.language][1]:# start_quiz photo,caption,keyboard = interface.importance() database.add_quiz(message.chat.id) await send_photo(message.chat.id,photo,caption,keyboard) elif message.text == WELCOME_LANGUAGE[interface.language][2]: await bot.send_message(message.chat.id,database.get_works(),parse_mode='html') pass elif message.text == WELCOME_LANGUAGE[interface.language][3]:#contact await bot.send_contact(chat_id=message.chat.id,phone_number='+77756508888',first_name='Yqylasfilms', last_name='LoveStory',vcard='19191919191919191919') await bot.send_contact(chat_id=message.chat.id,phone_number='+77056458888',first_name='Yqylasfilms', last_name='LoveStory',vcard='19191919191919191919') elif message.text == WELCOME_LANGUAGE[interface.language][4]:# address text,location = interface.office_address() await bot.send_message(chat_id=message.chat.id,text=text,parse_mode='html') await bot.send_location(chat_id=message.chat.id,latitude=location[0],longitude=location[1]) elif message.text == WELCOME_LANGUAGE[interface.language][5]:# price_list document,keyboard = interface.send_price() await bot.send_document(chat_id=message.chat.id,document=document,reply_markup=keyboard) elif message.text == WELCOME_LANGUAGE[interface.language][6]: await start(message) # elif message.text == WELCOME_LANGUAGE[interface.language][7]: # pass if message.text in LOVESTORY_KEYBOARD: if message.text != LOVESTORY_KEYBOARD[-1]: document, keyboard = interface.send_price() photo,text = interface.each_price(message.text) await send_photo(message.chat.id,photo,text,keyboard) else: animation, text, keyboard = interface.welcome() await send_photo(chat_id=message.chat.id,keyboard=keyboard) try: await bot.delete_message(message.chat.id, message.message_id) except Exception as e: print(e)
admins = [626420006,508774864,318364070, 269903576,557795357] # -------------Connection dbname = 'puttgvir' user = '******' password = '******' host = 'rogue.db.elephantsql.com' port = '5432' # -------------Classes interface = Interface() database = Database(dbname,user,password,host,port) # -------------Bot # TOKEN = '1251528088:AAECXGaHJx7J7PsDPKsot5rpWlThNN-hpuw' # TOKEN = '1300236281:AAFhQKebBujEHIlNN43r7xQ2YKtqWWzyy78' TOKEN = '1265307353:AAEZHrSyw6-AhWyXrZvMMuc0zxzYa2jGOD8' bot = Bot(TOKEN) dp = Dispatcher(bot)
""" Animal -> respirar (é um Animal) Lobo(Animal) -> respirar / uivar (Lobo é um lobo e um Animal) Cachorro(Lobo) -> respirar / uivar / latir (cachorro é um Cachorro, também é um lobo() e um Animal()) """ from classes.interface import Interface interface1 = Interface() interface1.metodo_da_interface()
from classes.match import Match from classes.user import User from classes.com import Com from classes.interface import Interface from classes.api_client import ApiClient interface = Interface() match = Match() user = User() com = Com() api_client = ApiClient() def reset(): """Resets wins and rounds""" match.reset_rounds() user.reset_wins() com.reset_wins() def print_default(): """Prints the default play area""" interface.clear_screen() interface.print_banner() def start_new_round(): """Starts a new round and sets input""" match.new_round() interface.print_input_prompt() user.set_play()
def main(): root = Tk() ex = Interface(root) root.geometry("250x650+300+300") root.mainloop()