def ProcessCmdKey(self, msg, keys): ''' Called anytime the user presses a key while this form has focus. ''' # overidden to allow various "application wide" hotkeys if keys == Keys.Escape: # ensure that all CVForms close themselves if you press the escape key. self.Close() elif keys == Keys.Control | Keys.Shift | Keys.L: # ensure that the use can manually save out an application log log.save() else: super(CVForm, self).ProcessCmdKey(msg, keys)
def ProcessCmdKey(self, msg, keys): ''' Called anytime the user presses a key while this form has focus. ''' # overidden to allow various "application wide" hotkeys if keys == Keys.Escape: # ensure that all CVForms close themselves if you press the escape key. self.Close() elif keys == Keys.Control|Keys.Shift|Keys.L: # ensure that the use can manually save out an application log log.save() else: super(CVForm, self).ProcessCmdKey(msg, keys)
def read(master, config): for s in config: now = datetime.utcnow() coils = [ master.execute(s['unit'], cst.READ_COILS, x, 1)[0] for x in s['coils'] ] discrete_inputs = [ master.execute(s['unit'], cst.READ_DISCRETE_INPUTS, x, 1)[0] for x in s['discrete_inputs'] ] input_registers = [ master.execute(s['unit'], cst.READ_INPUT_REGISTERS, x, 1)[0] for x in s['input_registers'] ] holding_registers = [ master.execute(s['unit'], cst.READ_HOLDING_REGISTERS, x, 1)[0] for x in s['holding_registers'] ] log.save(now, s, coils, discrete_inputs, input_registers, holding_registers)
def main(): gcu.clear_temp( ) # auf der lokalen Maschine relevant, die VM der Google Cloud wird mit jedem Job neu erstellt args = parse_arguments() global args imgs, gts, add_data = load_imgs(args.input, preprocess=preprocess1, size=256) kdata = kfold_split(imgs, gts, add_data, n_splits=4, use_splits=1) shape = kdata[0]["x_train"].shape[1:4] for n_fil_start in [6, 8, 10, 12, 14]: for d in [3, 4, 5]: model = get_u_net(shape, n_filter_start=n_fil_start, depth=d) model.summary() train_model(model, kdata, model_name="isles_f_{}_d{}".format(n_fil_start, d)) log.save(os.path.join(args.output, "log1.txt"))
for subdirectory in dirs: subdir = constants.DIRECTORY + subdirectory + '\\' for filename in os.listdir(subdir): folder_filename = subdirectory + '\\' + filename # replaced_features is True/False list that tells me if one particular feature was replaced or not. # It is the same size as features_to_replace or target_features lists replaced_features = list() # modified_lines will contain line numbers that represent ALL lines modified in this file modified_lines = list() with open(subdir + filename, 'U') as f_original: lines = f_original.readlines() #build a list with all the lines to be modified #Keep the original sentences to save the csv log later original = lines # Replace each feature in this file for feature in features_to_replace: flag_replace = False modified_lines_per_feature, lines = replace_all(lines, feature, target_features[features_to_replace.index(feature)]) #if this feature were replaced any time, save the lines that were changed if len(modified_lines_per_feature) > 0: flag_replace = True modified_lines.append((modified_lines_per_feature, feature)) replaced_features.append(flag_replace) if True in replaced_features: #If any feature was found and replaced in this file log.save(style, folder_filename, replaced_features) #create a new file with the new text create_modified_files(subdirectory, filename, lines) log.csv_log(folder_filename, style, modified_lines, original, lines, features_to_replace, target_features) f_original.close()
log.d("being login.. \nusername:"******"get Captcha is :" + captcha) formData = { '_xsrf': _xsrf, 'email': username, 'password': password, 'remember_me': 'true', } formData['captcha'] = captcha loginResponse = session.post(postUrl, data=formData, headers=headers, verify=False) loginJson = json.loads(loginResponse.text) log.d('json:' + str(loginJson)) try: login('*****@*****.**', '1234567') except Exception as e: log.e(e) finally: log.save()
def SetScoreToJSON(name, score): log.save(score, name)