How to use list_imports method in localstack

Best Python code snippet using localstack_python

generate.py

Source: generate.py Github

copy

Full Screen

1from pathlib import Path2import shutil3from os import listdir4#name = input("Введите название изделия: ")5def properties_name(name):6 if name == "bus-70":7 list_imports= {8 'arinc429_input_mezzanine_test.js',9 'arinc429_mezzanine_setup.js',10 'arinc429_output_mezzanine_test.js',11 'arinc429_setup.js',12 'bus-70_tu_requirements.js',13 'can_receive_mezzanine_test.js',14 'can_send_mezzanine_test.js',15 'configuration_pins_test.js',16 'dec_to_bin_array.js',17 'device_military_ports_identification.js',18 'ethernet_tests.js',19 'generate_data_for_arinc_test.js',20 'generate_data_for_can_test.js',21 'generate_data_for_military_ports.js',22 'generate_data_for_mkio.js',23 'generate_data_for_uart_test.js',24 'logging.js',25 'mcp2515_can_id_mezzanine_converter.js',26 'military_ports_types.js',27 'mkio_mezzanine_setup.js',28 'mkio_send_data_bc_to_rt_mezzanine_test.js',29 'mkio_send_data_device_rt_to_stand_rt_mezzanine_test.js',30 'mkio_send_data_rt_to_bc_mezzanine_test.js',31 'mkio_send_data_stand_rt_to_device_rt_mezzanine_test.js',32 'mkio_setup.js',33 'mkio_send_data_stand_rt_to_device_rt_mezzanine_test.js',34 'pins_and_pouts_mezzanine_setup.js',35 'pins_and_pouts_setup.js',36 'pins_test.js',37 'pouts_test.js',38 'random.js',39 'repetitions.js',40 'time.js',41 'uart_setup.js',42 'uart_test.js'43 }44 return list_imports45 elif name == "bus-70n":46 list_imports= {47 'bus-70n_tu_requirements.js',48 'can_receive_mezzanine_test.js',49 'can_send_mezzanine_test.js',50 'configuration_pins_test.js',51 'dec_to_bin_array.js',52 'device_military_ports_identification.js',53 'ethernet_tests.js',54 'generate_data_for_can_test.js',55 'generate_data_for_military_ports.js',56 'generate_data_for_uart_test.js',57 'logging.js',58 'mcp2515_can_id_mezzanine_converter.js',59 'military_ports_types.js',60 'pins_and_pouts_mezzanine_setup.js',61 'pins_and_pouts_setup.js',62 'pins_test.js',63 'pouts_test.js',64 'random.js',65 'repetitions.js',66 'time.js',67 'uart_setup.js',68 'uart_test.js'69 }70 return list_imports71 elif name == "ivs-70b":72 list_imports= {73 'time.js',74 'random.js',75 'can_receive_mezzanine_test.js',76 'ivs-70b_tu_requirements.js',77 'generate_data_for_can_test.js',78 'repetitions.js',79 'ethernet_tests.js',80 'generate_data_for_uart_test.js',81 'mcp2515_can_id_mezzanine_converter.js', 82 'uart_receive_mezzanine_test.js',83 'uart_send_mezzanine_test.js',84 'can_receive_mezzanine_test.js',85 'can_send_mezzanine_test.js'}86 return list_imports87 elif name == "dsps":88 list_imports= {89 'arinc429_input_mezzanine_test.js',90 'arinc429_mezzanine_setup.js',91 'arinc429_output_mezzanine_test.js',92 'arinc429_setup.js',93 'dsps_tu_requirements.js',94 'can_receive_mezzanine_test.js',95 'can_send_mezzanine_test.js',96 'configuration_pins_test.js',97 'dec_to_bin_array.js',98 'device_military_ports_identification.js',99 'ethernet_tests.js',100 'generate_data_for_arinc_test.js',101 'generate_data_for_can_test.js',102 'generate_data_for_military_ports.js',103 'generate_data_for_mkio.js',104 'generate_data_for_uart_test.js',105 'logging.js',106 'mcp2515_can_id_mezzanine_converter.js',107 'military_ports_types.js',108 'mkio_mezzanine_setup.js',109 'mkio_send_data_bc_to_rt_mezzanine_test.js',110 'mkio_send_data_device_rt_to_stand_rt_mezzanine_test.js',111 'mkio_send_data_rt_to_bc_mezzanine_test.js',112 'mkio_send_data_stand_rt_to_device_rt_mezzanine_test.js',113 'mkio_setup.js',114 'mkio_send_data_stand_rt_to_device_rt_mezzanine_test.js',115 'pins_and_pouts_mezzanine_setup.js',116 'pins_and_pouts_setup.js',117 'pins_test.js',118 'pouts_test.js',119 'random.js',120 'repetitions.js',121 'time.js',122 'uart_setup.js',123 'uart_test.js',124 'uart_receive_mezzanine_test.js',125 'uart_send_mezzanine_test.js'126 } 127 return list_imports128 elif name == "dpu":129 list_imports= {130 'arinc429_input_mezzanine_test.js',131 'arinc429_mezzanine_setup.js',132 'arinc429_output_mezzanine_test.js',133 'arinc429_setup.js',134 'dpu_tu_requirements.js',135 'can_receive_mezzanine_test.js',136 'can_send_mezzanine_test.js',137 'configuration_pins_test.js',138 'dec_to_bin_array.js',139 'device_military_ports_identification.js',140 'ethernet_tests.js',141 'generate_data_for_arinc_test.js',142 'generate_data_for_can_test.js',143 'generate_data_for_military_ports.js',144 'generate_data_for_mkio.js',145 'generate_data_for_uart_test.js',146 'logging.js',147 'mcp2515_can_id_mezzanine_converter.js',148 'military_ports_types.js',149 'mkio_mezzanine_setup.js',150 'mkio_send_data_bc_to_rt_mezzanine_test.js',151 'mkio_send_data_device_rt_to_stand_rt_mezzanine_test.js',152 'mkio_send_data_rt_to_bc_mezzanine_test.js',153 'mkio_send_data_stand_rt_to_device_rt_mezzanine_test.js',154 'mkio_setup.js',155 'mkio_send_data_stand_rt_to_device_rt_mezzanine_test.js',156 'pins_and_pouts_mezzanine_setup.js',157 'pins_and_pouts_setup.js',158 'pins_test.js',159 'pouts_test.js',160 'random.js',161 'repetitions.js',162 'time.js',163 'uart_setup.js',164 'uart_test.js',165 'dpu_internal_can_test.js'166 } 167 return list_imports 168 elif name == "mpp-70nr":169 list_imports= {170 'can_receive_mezzanine_test.js',171 'can_send_mezzanine_test.js',172 'configuration_pins_test.js',173 'ethernet_tests.js',174 'generate_data_for_can_test.js',175 'logging.js',176 'mcp2515_can_id_mezzanine_converter.js',177 'mpp-70nr_tu_requirements.js',178 'random.js',179 'repetitions.js',180 'time.js'}181 return list_imports182 elif name == "mpp-70r":183 list_imports= {184 'can_receive_mezzanine_test.js',185 'can_send_mezzanine_test.js',186 'configuration_pins_test.js',187 'ethernet_tests.js',188 'generate_data_for_can_test.js',189 'logging.js',190 'mcp2515_can_id_mezzanine_converter.js',191 'mpp-70r_tu_requirements.js',192 'random.js',193 'repetitions.js',194 'time.js'}195 return list_imports196 elif name == "ppb-1b":197 list_imports= {198 'can_receive_mezzanine_test.js',199 'can_send_mezzanine_test.js',200 'configuration_pins_test.js',201 'ethernet_tests.js',202 'generate_data_for_can_test.js',203 'logging.js',204 'mcp2515_can_id_mezzanine_converter.js',205 'ppb-1b_tu_requirements.js',206 'random.js',207 'repetitions.js',208 'time.js'} 209 return list_imports210def folder_mk(path_folder):211 if not path_folder.exists():212 path_folder.mkdir()213 else:214 shutil.rmtree(path_folder)215 path_folder.mkdir()216def copy_folder_imports (list_imports, path_imports):217 for i in list_imports:218 shutil.copy(219 home/​ 'imports'/​ i,220 path_imports221 )222def copy_folder_name(name, path_blocks):223 shutil.copytree(224 home /​ name,225 path_blocks,226 ignore=None,227 ignore_dangling_symlinks=False,228 dirs_exist_ok=False229 )230blocks = listdir(Path.cwd())231if 'results' in blocks:232 blocks.remove('results')233if '.git' in blocks:234 blocks.remove('.git')235blocks.remove('stepa_test_case.py')236blocks.remove('imports')237blocks.remove('generate.exe')238blocks.remove('generate.py')239home = Path.cwd()240path_results = home /​ 'results'241folder_mk(path_results)242for name in blocks: 243 name_test_cases = name + "_test_cases"244 path_name_test_cases = path_results /​ name_test_cases245 path_copy_imports = path_name_test_cases /​'imports'246 path_blocks = path_name_test_cases /​ name247 248 folder_mk(path_name_test_cases)249 folder_mk(path_copy_imports)250 list_imports_name = properties_name(name)251 copy_folder_imports (list_imports_name, path_copy_imports)252 copy_folder_name(name, path_blocks)...

Full Screen

Full Screen

import_collector_test.py

Source: import_collector_test.py Github

copy

Full Screen

2import unittest3from .import_collector import list_imports4class ListImportsTest(unittest.TestCase):5 def test_import_absolute(self):6 absolute_imports, relative_imports = list_imports('''7 import some_package8 '''.strip())9 self.assertEqual(['some_package'], absolute_imports)10 self.assertEqual([], relative_imports)11 def test_import_absolute_as(self):12 absolute_imports, relative_imports = list_imports('''13 import some_package as sp14 '''.strip())15 self.assertEqual(['some_package'], absolute_imports)16 self.assertEqual([], relative_imports)17 def test_import_multiple(self):18 absolute_imports, relative_imports = list_imports('''19 import some_package, another_package20 '''.strip())21 self.assertEqual(['some_package', 'another_package'], absolute_imports)22 self.assertEqual([], relative_imports)23 def test_from_import_absolute(self):24 absolute_imports, relative_imports = list_imports('''25 from some_package import some_function26 '''.strip())27 self.assertEqual(['some_package', 'some_package.some_function'], absolute_imports)28 self.assertEqual([], relative_imports)29 def test_from_import_absolute_as(self):30 absolute_imports, relative_imports = list_imports('''31 from some_package import some_function as sf32 '''.strip())33 self.assertEqual(['some_package', 'some_package.some_function'], absolute_imports)34 self.assertEqual([], relative_imports)35 def test_from_import_absolute_star(self):36 absolute_imports, relative_imports = list_imports('''37 from some_package import *38 '''.strip())39 self.assertEqual(['some_package', 'some_package.*'], absolute_imports)40 self.assertEqual([], relative_imports)41 def test_from_import_relative(self):42 absolute_imports, relative_imports = list_imports('''43 from .internal_module import some_function44 '''.strip())45 self.assertEqual([], absolute_imports)46 self.assertEqual([(1, 'internal_module', 'some_function')], relative_imports)47 def test_from_import_relative_multiple_levels(self):48 absolute_imports, relative_imports = list_imports('''49 from ..internal_module import some_function50 '''.strip())51 self.assertEqual([], absolute_imports)52 self.assertEqual([(2, 'internal_module', 'some_function')], relative_imports)53 def test_from_import_multiple_sub_modules(self):54 absolute_imports, relative_imports = list_imports('''55 from some_package import some_function as sf, another_function as af56 '''.strip())57 self.assertEqual({'some_package', 'some_package.some_function', 'some_package.another_function'},58 set(absolute_imports))59 self.assertEqual([], relative_imports)60 def test_mixed_case(self):61 lines = [62 'import yet_another_package',63 'from some_package import some_function as sf, another_function as af',64 'import another_package',65 'from ..internal_module import some_function']66 absolute_imports, relative_imports = list_imports('\n'.join(lines))67 self.assertEqual({'some_package', 'some_package.some_function', 'some_package.another_function',68 'another_package', 'yet_another_package'}, set(absolute_imports))...

Full Screen

Full Screen

views.py

Source: views.py Github

copy

Full Screen

1import requests2from decouple import config3from django.contrib import messages4from django.shortcuts import render, redirect5def index(request):6 context = {}7 bmx_token = config('BMX_TOKEN')8 headers = {'Bmx-Token': bmx_token}9 if request.GET.get('type', None):10 id_serie = request.GET['type']11 initial_date = request.GET.get('initial_date', None)12 final_date = request.GET.get('final_date', None)13 url = f'https:/​/​www.banxico.org.mx/​SieAPIRest/​service/​v1/​series/​{id_serie}/​datos/​{initial_date}/​{final_date}'14 response = requests.get(url, headers=headers)15 if response.status_code == 200:16 data = response.json()17 data = data['bmx']['series'][0]['datos']18 total = 019 list_imports = []20 list_dates = []21 for d in data:22 total += float(d['dato'])23 list_dates.append(d['fecha'])24 list_imports.append(d['dato'])25 context.update({26 'data': data,27 'promedio': total /​ len(data),28 'max_value': max(list_imports),29 'min_value': min(list_imports),30 'labels_chart': list_dates,31 'data_chart': list_imports,32 })33 else:34 messages.error(request, 'No se pudo cargar la informacion')35 return redirect('home:index')...

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