Best Python code snippet using hypothesis
pmpermit_menu.py
Source:pmpermit_menu.py
...33 if chat_id not in PM_START:34 PM_START.append(chat_id)35 if not event.is_private:36 return37 set_key(PMMESSAGE_CACHE, event.chat_id, event.id)38 try:39 async with event.client.conversation(chat) as conv:40 if pmpermit_sql.is_approved(chat_id):41 return42 test1 = await event.client.send_message(chat, PM)43 set_key(PMMESSAGE_CACHE, event.chat_id, test1.id)44 chat_id = event.sender_id45 response = await conv.get_response(chat)46 y = response.text47 if y == "a" or "A":48 if pmpermit_sql.is_approved(chat_id):49 return50 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)51 test2 = await event.client.send_message(chat, ONE)52 set_key(PMMESSAGE_CACHE, event.chat_id, test2.id)53 response = await conv.get_response(chat)54 if response.text != "/start":55 if pmpermit_sql.is_approved(chat_id):56 return57 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)58 test3 = await event.client.send_message(chat, LWARN)59 set_key(PMMESSAGE_CACHE, event.chat_id, test3.id)60 response = await conv.get_response(chat)61 if response.text != "/start":62 if pmpermit_sql.is_approved(chat_id):63 return64 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)65 test4 = await event.client.send_message(chat, TWO)66 set_key(PMMESSAGE_CACHE, event.chat_id, test4.id)67 await asyncio.sleep(3)68 await event.client(functions.contacts.BlockRequest(chat_id))69 elif y == "b" or "B":70 if pmpermit_sql.is_approved(chat_id):71 return72 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)73 test5 = await event.client.send_message(chat, LWARN)74 set_key(PMMESSAGE_CACHE, event.chat_id, test5.id)75 response = await conv.get_response(chat)76 if response.text != "/start":77 if pmpermit_sql.is_approved(chat_id):78 return79 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)80 test6 = await event.client.send_message(chat, TWO)81 set_key(PMMESSAGE_CACHE, event.chat_id, test6.id)82 await asyncio.sleep(3)83 await event.client(functions.contacts.BlockRequest(chat_id))84 elif y == "c" or "C":85 if pmpermit_sql.is_approved(chat_id):86 return87 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)88 test7 = await event.client.send_message(chat, THREE)89 set_key(PMMESSAGE_CACHE, event.chat_id, test7.id)90 response = await conv.get_response(chat)91 if response.text != "/start":92 if pmpermit_sql.is_approved(chat_id):93 return94 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)95 test8 = await event.client.send_message(chat, LWARN)96 set_key(PMMESSAGE_CACHE, event.chat_id, test8.id)97 response = await conv.get_response(chat)98 if response.text != "/start":99 if pmpermit_sql.is_approved(chat_id):100 return101 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)102 test9 = await event.client.send_message(chat, TWO)103 set_key(PMMESSAGE_CACHE, event.chat_id, test9.id)104 await asyncio.sleep(3)105 await event.client(functions.contacts.BlockRequest(chat_id))106 elif y == "d" or "D":107 if pmpermit_sql.is_approved(chat_id):108 return109 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)110 test10 = await event.client.send_message(chat, FOUR)111 set_key(PMMESSAGE_CACHE, event.chat_id, test10.id)112 response = await conv.get_response(chat)113 if response.text != "/start":114 if pmpermit_sql.is_approved(chat_id):115 return116 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)117 test11 = await event.client.send_message(chat, LWARN)118 set_key(PMMESSAGE_CACHE, event.chat_id, test11.id)119 response = await conv.get_response(chat)120 if response.text != "/start":121 if pmpermit_sql.is_approved(chat_id):122 return123 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)124 await event.client.send_message(chat, TWO)125 await asyncio.sleep(3)126 await event.client(functions.contacts.BlockRequest(chat_id))127 else:128 if pmpermit_sql.is_approved(chat_id):129 return130 test12 = await event.client.send_message(131 chat,132 "You have entered an invalid command. Please send `/start` again or do not send another message if you do not wish to be blocked and reported.",133 )134 set_key(PMMESSAGE_CACHE, event.chat_id, test12.id)135 response = await conv.get_response(chat)136 z = response.text137 if z != "/start":138 if pmpermit_sql.is_approved(chat_id):139 return140 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)141 test13 = await event.client.send_message(chat, LWARN)142 set_key(PMMESSAGE_CACHE, event.chat_id, test13.id)143 response = await conv.get_response(chat)144 if response.text != "/start":145 if pmpermit_sql.is_approved(chat_id):146 return147 set_key(PMMESSAGE_CACHE, event.chat_id, response.id)148 test14 = await event.client.send_message(chat, TWO)149 set_key(PMMESSAGE_CACHE, event.chat_id, test14.id)150 await asyncio.sleep(3)151 await event.client(functions.contacts.BlockRequest(chat_id))152 except Exception as e:...
C1060controlling.py
Source:C1060controlling.py
1# -c2from pymol import cmd3print "BEGIN-LOG"4print cmd.set_key('F1',lambda :cmd.turn('x',10))5print cmd.set_key('F12',lambda :cmd.turn('x',10))6print cmd.set_key('left',lambda :cmd.turn('x',10))7print cmd.set_key('right',lambda :cmd.turn('x',10))8print cmd.set_key('pgup',lambda :cmd.turn('x',10))9print cmd.set_key('pgdn',lambda :cmd.turn('x',10))10print cmd.set_key('home',lambda :cmd.turn('x',10))11print cmd.set_key('insert',lambda :cmd.turn('x',10))12print cmd.set_key('ALT-A',lambda :cmd.turn('y',10))13print cmd.set_key('CTRL-C',lambda :cmd.turn('z',10))14print cmd.set_key('SHFT-F1', lambda :cmd.turn('z',10))15print cmd.set_key('ALT-F1', lambda :cmd.turn('y',10))16print cmd.set_key('CTRL-F8', lambda :cmd.move('x',1))...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!