How to use list_types method in localstack

Best Python code snippet using localstack_python

convert_dict_types.py

Source: convert_dict_types.py Github

copy

Full Screen

1from exceptions.exceptions import InputValueError2def convert_dict_types(input_dict):3 input_dict_corrected = dict(input_dict)4 list_types = {}5 for (case, elements) in input_dict_corrected.items():6 if case == "feeder":7 list_types = {8 "code": str,9 "vrms": float10 }11 elif case == "bus":12 list_types = {13 "code": str,14 "x": float,15 "y": float16 }17 elif case == "branch":18 list_types = {19 "code": str,20 "from": str,21 "to": str,22 "length": float,23 "phase": str,24 "cable": str,25 "pole": str,26 "rho": float27 }28 elif case == "source":29 list_types = {30 "code": str,31 "bus": str,32 "vrms": float,33 "frequency": float,34 "phase": str35 }36 elif case == "load":37 list_types = {38 "code": str,39 "bus": str,40 "phase": str,41 "s": float,42 "fp": float43 }44 elif case == "capacitor":45 list_types = {46 "code": str,47 "bus": str,48 "phase": str,49 "q": float50 }51 elif case == "switch":52 list_types = {53 "code": str,54 "from": str,55 "to": str,56 "tclose": float,57 "topen": float58 }59 elif case == "pole":60 list_types = {61 "code": str,62 "phase": str,63 "distance": float,64 "height": float,65 "sag": float66 }67 elif case == "cable":68 list_types = {69 "code": str,70 "ri": float,71 "ro": float,72 "rmg": float,73 "rac": float,74 "rdc": float75 }76 elif case == "surge_arrester":77 list_types = {78 "code": str,79 "bus": str,80 "diameter": float,81 "length": float,82 "ro": float,83 }84 elif case == "surge":85 list_types = {86 "code": str,87 "bus": str,88 "amp": float,89 "tfront": float,90 "tau": float91 }92 for (element, values) in elements.items():93 for (name, value) in values.items():94 converter = list_types[name]95 try:96 if case == "pole":97 for (n, list_value) in enumerate(value):98 input_dict_corrected[case][element][name][n] = converter(list_value)99 else:100 input_dict_corrected[case][element][name] = converter(value)101 except ValueError as excep:102 raise InputValueError(103 message=excep,104 errors="Conversion error in '{}' - '{}' - '{}', impossible to convert '{}' to {}".format(105 case,106 element,107 name,108 value,109 str(converter)110 )111 )...

Full Screen

Full Screen

io_utilities.py

Source: io_utilities.py Github

copy

Full Screen

1#!/​usr/​bin/​env python32# -*- coding: utf-8 -*-3import numpy as np4def load_config(main_window,filename='params.txt'):5 6 list_prefix = []7 list_name = []8 list_types = []9 list_values = []10 11 known_types = {'int': int,'float': float,'str': str}12 13 # Load txt file14 with open(filename, 'r') as fileobj:15 for row in fileobj:16 temp = row.rstrip('\n').split(' ')17 list_prefix.append(temp[0])18 list_name.append(temp[1])19 list_types.append(known_types[temp[2]])20 list_values.append(temp[3])21 22 # Load config into MainWindow Instance23 for i in range(len(list_prefix)):24 # Main (spinboxes)25 if list_prefix[i] == 'Main':26 main_window.spinboxes[list_name[i]].setValue(list_types[i](list_values[i]))27 # UnitType (checkbox)28 elif list_prefix[i] == 'UnitType':29 main_window.params[list_name[i]] = list_types[i](list_values[i])30 main_window.unit_types[main_window.params[list_name[i]]]['checkbox'].setChecked(True)31 main_window.update_checkbox_units()32 # Slider33 elif list_prefix[i] == 'Slider':34 main_window.sliders[list_name[i]].setValue(list_types[i](list_values[i]))35 # SubSlider36 elif list_prefix[i] == 'SubSlider':37 main_window.sub_sliders[list_name[i]].setValue(list_types[i](list_values[i]))38 39 return main_window40def save_config(main_window,filename='params.txt'):41 list_prefix = []42 list_name = []43 list_types = []44 list_values = []45 list_save = []46 47 # Main (spinboxes)48 for key in main_window.spinboxes.keys():49 list_prefix.append('Main')50 list_name.append(key)51 list_types.append(type(main_window.spinboxes[key].value()).__name__)52 list_values.append(main_window.spinboxes[key].value())53 # UnitType (checkbox)54 list_prefix.append('UnitType')55 list_name.append('unit_type')56 list_types.append(type(main_window.params['unit_type']).__name__)57 list_values.append(main_window.params['unit_type'])58 # Slider59 for key in main_window.sliders.keys():60 list_prefix.append('Slider')61 list_name.append(key)62 list_types.append(type(main_window.sliders[key].value()).__name__)63 list_values.append(main_window.sliders[key].value())64 # SubSlider65 for key in main_window.sub_sliders.keys():66 list_prefix.append('SubSlider')67 list_name.append(key)68 list_types.append(type(main_window.sub_sliders[key].value()).__name__)69 list_values.append(main_window.sub_sliders[key].value())70 71 # Format the txt file72 for i in range(len(list_name)):73 list_save.append(f'{list_prefix[i]} {list_name[i]} {list_types[i]} {list_values[i]}')74 75 # Save as txt file76 f = open(filename,'w')77 np.savetxt(f,list_save,fmt="%s")...

Full Screen

Full Screen

inline_generation.py

Source: inline_generation.py Github

copy

Full Screen

1from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton2from aiogram.utils.callback_data import CallbackData3filter_list = CallbackData('type', 'action', 'id')4def check_rule(rule, list_types):5 if rule[0] == 'student':6 for price in list_types:7 if price[0] == 'игра' or price[0] == 'Кластер':8 list_types.remove(price)9 elif rule[0] == 'intensivist':10 for price in list_types:11 if price[0] == 'Переговорные':12 list_types = price,13 return list_types14async def inline_type_list(user_db, id):15 rule = await user_db.sql_check_rule(id)16 list_types = await user_db.sql_object_type(id)17 ret = len(list_types) != 018 list_types = check_rule(rule, list_types)19 row_button = []20 for type_name in list_types:21 line = InlineKeyboardButton(text=type_name[0],22 callback_data=filter_list.new(action='get_type_list',23 id=type_name[0]))24 row_button.append([line, ])25 return InlineKeyboardMarkup(inline_keyboard=row_button), ret26async def inline_object_list(user_db, type_name):27 list_object = await user_db.sql_list_object(type_name)28 row_button = []29 for object_id, object_name in list_object:30 line = InlineKeyboardButton(text=object_name,31 callback_data=filter_list.new(action='get_object_list',32 id=object_name))33 row_button.append([line, ])...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Java Testing Frameworks For 2023

The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.

QA Innovation – Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

Best 23 Web Design Trends To Follow In 2023

Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

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