Best Python code snippet using autotest_python
serverset.py
Source:serverset.py
...102 self._members[member_id] = ServiceInstance.unpack(service_instance)103 except Exception as e:104 log.warning('Failed to deserialize endpoint: %s' % e)105 return106 self._on_join(self._members[member_id])107 return callback108 for member_id in new_members:109 self._group.info(member_id, make_callback(member_id))...
server_setting.py
Source:server_setting.py
1# -*- coding:utf-8 -*- 2##########################################################3# Rutap Bot 2019 Server Setting Module #4# Under The MIT License #5##########################################################6import os7from mysql import *8def prefix_change(message):9 prefix_change = message.content[5:6]10 if prefix_change == "`" or prefix_change == "'":11 return False12 else:13 mysql_do("UPDATE `and_so_on` SET `prefix`='%s' WHERE server_id = %s" % (prefix_change, message.guild.id))14 return True15def welcome_message(message):16 if message.content[5:].startswith('ë기'):17 say = mysql_do_return("SELECT say FROM `on_join` WHERE server_id = %s" % (message.guild.id))18 if len(say) == 1:19 mysql_do("DELETE FROM `on_join` WHERE server_id = %s" % (message.guild.id))20 return "Delete"21 else:22 return False23 else: 24 welcome_msg = message.content[5:]25 #welcome_msg = welcome_msg.replace("'", "")26 #if welcome_msg == "" or welcome_msg == " " or welcome_msg == None:27 # return "asdf"28 say = mysql_do_return("SELECT say FROM `on_join` WHERE server_id = %s" % (message.guild.id))29 if len(say) == 1:30 mysql_do("UPDATE `on_join` SET `channel_id`=%s,`say`='%s' WHERE server_id = %s" % (message.channel.id, welcome_msg, message.guild.id))31 return welcome_msg32 else:33 mysql_do("INSERT INTO `on_join`(`server_id`, `channel_id`, `say`) VALUES (%s, %s, '%s')" % (message.guild.id, message.channel.id, welcome_msg))34 return welcome_msg35def bye_message(message):36 if message.content[6:].startswith('ë기'):37 say = mysql_do_return("SELECT say FROM `on_join` WHERE server_id = %s" % (message.guild.id))38 if len(say) == 1:39 mysql_do("DELETE FROM `on_leave` WHERE server_id = %s" % (message.guild.id))40 return "Delete"41 else:42 return False43 else: 44 bye_msg = message.content[6:]45 #bye_msg = bye_msg.replace("'", "")46 #if bye_msg == "" or bye_msg == " " or bye_msg == None:47 # return "asdf"48 say = mysql_do_return("SELECT say FROM `on_join` WHERE server_id = %s" % (message.guild.id))49 if len(say) == 1:50 mysql_do("UPDATE `on_join` SET `channel_id`=%s,`say`='%s' WHERE server_id = %s" % (message.channel.id, bye_msg, message.guild.id))51 return bye_msg52 else:53 mysql_do("INSERT INTO `on_join`(`server_id`, `channel_id`, `say`) VALUES (%s, %s, '%s')" % (message.guild.id, message.channel.id, bye_msg))54 return bye_msg55def bot_selection_noti(message, p):56 asdf = message.content.replace(p + "ê³µì§ìì ")57 if asdf == "ì·¨ì":58 return "OK"59 channel = mysql_do_return("SELECT channel_id FROM `bot_selection_noti` WHERE server_id = %s" % (message.guild.id))60 if len(channel) == 1:61 channel = channel[0][0]62 if message.channel.id == channel:63 return False64 else:65 mysql_do("UPDATE `bot_selection_noti` SET `server_id`=%s,`channel_id`='%s' WHERE server_id = %s" % (message.guild.id, message.channel.id, message.guild.id))66 return True67 else:68 mysql_do("INSERT INTO `bot_selection_noti`(`server_id`, `channel_id`) VALUES (%s, %s)" % (message.guild.id, message.channel.id))...
wamp_client.py
Source:wamp_client.py
...20 self.on_join = on_join21 self.on_join_fut = on_join_fut22 async def onJoin(self, details):23 logging.error("Joined")24 result = await self.on_join(self)25 self.on_join_fut.set_result(result)26 return result27 async def call_server(self, endpoint, *args, **kwargs):28 """Generate the correct endpoint for the known server."""29 try:30 return await self.call(31 'com.ltldoorstep.{server}.{endpoint}'.format(32 server=self._server, endpoint=endpoint),33 self._session,34 *args,35 **kwargs36 )37 except Exception as e:38 if e.error.startswith('LintolDoorstep'):...
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!!