How to use print_config_table method in localstack

Best Python code snippet using localstack_python

localstack.py

Source:localstack.py Github

copy

Full Screen

...182 from localstack import config183 assert config184 assert ext_config185 if format == "table":186 print_config_table()187 elif format == "plain":188 print_config_pairs()189 elif format == "dict":190 print_config_dict()191 elif format == "json":192 print_config_json()193 else:194 print_config_pairs() # fall back to plain195def print_config_json():196 import json197 from localstack import config198 console.print(json.dumps(dict(config.collect_config_items())))199def print_config_pairs():200 from localstack import config201 for key, value in config.collect_config_items():202 console.print(f"{key}={value}")203def print_config_dict():204 from localstack import config205 console.print(dict(config.collect_config_items()))206def print_config_table():207 from rich.table import Table208 from localstack import config209 grid = Table(show_header=True)210 grid.add_column("Key")211 grid.add_column("Value")212 for key, value in config.collect_config_items():213 grid.add_row(key, str(value))214 console.print(grid)215@localstack.command(name="ssh", help="Obtain a shell in the running LocalStack container")216def cmd_ssh():217 from localstack import config218 from localstack.utils.docker_utils import DOCKER_CLIENT219 from localstack.utils.run import run220 if not DOCKER_CLIENT.is_container_running(config.MAIN_CONTAINER_NAME):...

Full Screen

Full Screen

eval_hyperparameter_tuning.py

Source:eval_hyperparameter_tuning.py Github

copy

Full Screen

...44 print('%argmax: ' + str(np.argmax(results, axis=0)))45 print('%argmin: ' + str(np.argmin(results, axis=0)))46 sys.stdout = orig_stdout 47 return results[:,:n_val-1]48def print_config_table(path_trainings):49 '''50 Print a latex table of configurations to a .txt file51 '''52 header = ['Training', '$N_{Patches pp.}$', 'Patch Size', 'Overlap', 'Loss Weights(C:R)']53 54 # Create list of lists55 configs_used = []56 for i in range(len(path_trainings)):57 configs_used.append([])58 for j in range(len(header)):59 configs_used[i].append([])60 61 # Load data62 for idx, path in enumerate(path_trainings,0):63 with open(path + '/params.txt', 'r') as f:64 params = json.load(f)65 with open(path + '/config.txt', 'r') as f:66 config = json.load(f)67 configs_used[idx][0] = params['n_patches']68 configs_used[idx][1] = params['patch_size']69 configs_used[idx][2] = params['overlap']70 configs_used[idx][3] = config['loss_weights']71 72 # Print data 73 orig_stdout = sys.stdout74 with open('hyperparameter_table.txt', 'w') as f:75 sys.stdout = f76 for h in header:77 print(h, end='')78 if h != header[-1]:79 print(' & ', end='')80 else:81 print(' \\\\ \n\\hline')82# for idx in range(len(configs_used)):83 for training_idx, line in enumerate(configs_used,0):84 print('H'+f'{training_idx:02}'+ ' & ', end='')85 for idx in range(len(header)):86 print(line[idx], end='')87 if idx != len(header) -1:88 print(' & ', end='')89 if training_idx != len(configs_used)-1:90 print(' \\\\ \n', end='') 91 sys.stdout = orig_stdout 92 93if __name__ == '__main__':94 src_dir = '/home/s1283/no_backup/s1283/hyperparameter_tuning_01/'95 path_trainings = glob(os.path.join(src_dir, '*/'))96 path_trainings.sort()97 results = print_results_table(path_trainings)98 configs = print_config_table(path_trainings)99#%%100 # Create boxplots for hyperparameter training101 loss_class = results[:,0]102 mse = results[:,-1]103 metrics_class = results[:,1:-1]104 fig, ax1 = plt.subplots(figsize=(5,5))105 bp1 = ax1.boxplot(100*metrics_class,showmeans=True)106 ax1.set_ylim([0,100])107 ax1.set_ylabel('Percentage')108 109 ax1.set_xticklabels(['Accuracy', 'Precision', 'Sensitivity', 'Specificity'])110 ax1.set_title('Classification Metrics')111 plt.savefig('classification_boxplots.png', bbox_inches ='tight')112 fig, ax2 = plt.subplots(figsize=(2,5))...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful