Best Python code snippet using lisa_python
isri_handler.py
Source:isri_handler.py
...37 def use_case_insensitive(self):38 self._used_config_acc.append("-i")39 def use_display_suspect_markers_in_output(self):40 self._used_config_acc.append("-s")41 def get_used_config(self):42 return self._used_config_acc43 def clear_used_config(self):44 self._used_config_acc = []45 def synctext(self, filepaths, path_generatedfile=None, synctext_config = SynctextConfig()):46 try:47 flags = synctext_config.get_used_config()48 calls = ["synctext"]49 calls.extend(flags)50 calls.extend(filepaths)51 if path_generatedfile is None:52 call(calls)53 else:54 filehandle = self.create_file_if_doesnt_exist(path_generatedfile, True)55 call(calls, stdout=filehandle)56 filehandle.close()57 except Exception as ex:58 self.cpr.printex("Exception calling pycharm", ex)59 def accsum(self, filepaths_accreports, path_generatedfile=None):60 try:61 calls = ["accsum"]62 calls.extend(filepaths_accreports)63 if path_generatedfile is None:64 call(calls)65 else:66 filehandle = self.create_file_if_doesnt_exist(path_generatedfile, True)67 call(calls, stdout=filehandle)68 filehandle.close()69 except Exception as ex:70 self.cpr.printex("Exception calling pycharm", ex)71 def groupacc(self, path_groupfile, path_accuracy_report, path_groupacc_report = None):72 try:73 calls = ["groupacc"]74 calls.append(path_groupfile)75 calls.append(path_accuracy_report)76 if path_groupacc_report is None:77 call(calls)78 else:79 filehandle = self.create_file_if_doesnt_exist(path_groupacc_report, True)80 filehandle.close()81 calls.append(path_groupacc_report)82 call(calls)83 except Exception as ex:84 self.cpr.printex("Exception calling pycharm", ex)85 def accdist(self, filepaths_accreports, path_generated_xyfile=None):86 try:87 calls = ["accdist"]88 calls.extend(filepaths_accreports)89 if path_generated_xyfile is None:90 call(calls)91 else:92 filehandle = self.create_file_if_doesnt_exist(path_generated_xyfile, True)93 call(calls, stdout=filehandle)94 filehandle.close()95 except Exception as ex:96 self.cpr.printex("Exception calling pycharm", ex)97 class NGramConfig(object):98 def __init__(self):99 self._used_config_acc =[]100 def set_ngram_size(self, number):101 if number>=1 and number <= 3:102 self._used_config_acc.append("-n")103 self._used_config_acc.append(str(number))104 def clear_used_config(self):105 self._used_config_acc = []106 def get_used_config(self):107 return self._used_config_acc108 def ngram(self, filepaths, path_generatedfile = None, ngram_config = NGramConfig()):109 try:110 flags = ngram_config.get_used_config()111 calls = ["ngram"]112 calls.extend(flags)113 calls.extend(filepaths)114 if path_generatedfile is None:115 call(calls)116 else:117 filehandle = self.create_file_if_doesnt_exist(path_generatedfile, True)118 call(calls, stdout=filehandle)119 filehandle.close()120 except Exception as ex:121 self.cpr.printex("Exception calling pycharm", ex)122 class VoteConfig(object):123 def __init__(self):124 self._used_config_acc =[]125 def enable_O_optimization(self):126 self._used_config_acc.append("-O")127 def set_s(self, fraction_counter, fraction_denominator):128 self._used_config_acc.append("-s")129 self._used_config_acc.append(fraction_counter+"/"+fraction_denominator)130 def set_w(self, fraction_counter, fraction_denominator):131 self._used_config_acc.append("-w")132 self._used_config_acc.append(fraction_counter+"/"+fraction_denominator)133 def set_output_file(self, path_outputfile):134 self._used_config_acc.append("-o")135 self._used_config_acc.append(path_outputfile) #ok?136 def clear_used_config(self):137 self._used_config_acc = []138 def get_used_config(self):139 return self._used_config_acc140 def vote(self, filepaths, ngram_config = VoteConfig()):141 try:142 flags = ngram_config.get_used_config()143 calls = ["vote"]144 calls.extend(flags)145 calls.extend(filepaths)146 call(calls)147 except Exception as ex:148 self.cpr.printex("Exception calling pycharm", ex)149 def wordacc(self, path_correctfile, path_comparison_file, path_stopwordfile = None, path_wordacc_report = None):150 try:151 calls = ["wordacc"]152 if path_stopwordfile is not None:153 calls.append("-S")154 calls.append(path_stopwordfile)155 calls.append(path_correctfile)156 calls.append(path_comparison_file)...
manage_bot.py
Source:manage_bot.py
...17 db = Db()18 config_id = db.check_pin(pin)19 if config_id:20 user_id = db.get_user_id(cid)21 if not db.get_used_config(user_id, config_id):22 bot.send_message(cid, messages.pin_error, reply_markup=keyboards.main)23 return24 else:25 bot.send_message(cid, messages.pin_error, reply_markup=keyboards.main)26 return27 db.close()28 msg = bot.send_message(cid, messages.manage_menu, reply_markup=keyboards.manage)29 bot.register_next_step_handler(msg, manage_menu, pin)30def manage_menu(m, pin):31 cid = m.chat.id32 text = m.text33 if text == 'Ð Ð°Ð·Ð¼ÐµÑ ÐºÐ¾Ð½ÑÑакÑов':34 msg = bot.send_message(cid, 'ТÑÑ Ð¼Ð¾Ð¶Ð½Ð¾ измениÑÑ ÑÐ°Ð·Ð¼ÐµÑ ÐºÐ¾Ð½ÑÑакÑа', reply_markup=make_keyboard([['ÐзмениÑÑ', 'Ðазад']]))35 bot.register_next_step_handler(msg, change_contract, pin)...
run_bot.py
Source:run_bot.py
...17 db = Db()18 config_id = db.check_pin(pin)19 if config_id:20 user_id = db.get_user_id(cid)21 if not db.get_used_config(user_id, config_id):22 bot.send_message(cid, messages.pin_error, reply_markup=keyboards.main)23 return24 else:25 bot.send_message(cid, messages.pin_error, reply_markup=keyboards.main)26 return27 db.close()28 msg = bot.send_message(cid, messages.manage_menu, reply_markup=keyboards.run)29 bot.register_next_step_handler(msg, run_menu, pin)30def run_menu(m, pin):31 cid = m.chat.id32 text = m.text33 run_commands = {34 'RUNBULL': 'BUYBTC',35 'RUNBEAR': 'SELLBTC',...
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!!