How to use _build_param_dict method in rester

Best Python code snippet using rester_python

transform_wrappers.py

Source: transform_wrappers.py Github

copy

Full Screen

1from PIL import Image2def _build_param_dict(conf, required_params, optional_params=[],3 key_renames={}, kwargs={}):4 # Filter out params which are passed in kwargs5 required_params = [p for p in required_params if p not in kwargs]6 param_dict = conf.to_param_dict(required_params,7 optional_params.copy(),8 key_renames)9 param_dict.update(kwargs)10 return param_dict11def get_sr_transform(conf, mode, **kwargs):12 def _get_interp(method):13 if method == 'bilinear':14 return Image.BILINEAR15 elif method == 'bicubic':16 return Image.BICUBIC17 else:18 raise ValueError('Unknown interpolation method {}'.format(method))19 assert mode in ('train', 'test')20 required_params = [21 'train_crop_size', 'upscale_factor'22 ]23 # Maps keys in configuration to parameter names in transform functions24 key_renames = {25 'train_crop_size': 'crop_size',26 'test_crop_size': 'crop_size',27 'scale_to_orig': 'upscale'28 }29 if mode == 'train':30 from data.sr_transforms import sr_train_transform31 optional_params = {32 'scale_to_orig': False,33 'interpolation': 'bilinear'34 }35 param_dict = _build_param_dict(conf,36 required_params,37 optional_params,38 key_renames,39 kwargs)40 param_dict['interpolation'] = _get_interp(param_dict['interpolation'])41 transform = sr_train_transform(**param_dict)42 else:43 from data.sr_transforms import sr_test_transform44 optional_params = {45 'scale_to_orig': False,46 'interpolation': 'bilinear',47 'full_image': False48 }49 param_dict = _build_param_dict(conf,50 required_params,51 optional_params,52 key_renames,53 kwargs)54 param_dict['interpolation'] = _get_interp(param_dict['interpolation'])55 transform = sr_test_transform(**param_dict)56 return transform57def get_sr_output_transform(conf, mode, **kwargs):58 assert mode in ('train', 'test', 'output')59 if mode == 'train':60 from data.sr_transforms import sr_output_train_transform61 transform = sr_output_train_transform(convert_luma=True)62 else:63 from data.sr_transforms import sr_output_test_transform64 if mode == 'test':65 param_dict = _build_param_dict(conf,66 ['upscale_factor'],67 kwargs={'crop_border_pixels': True,68 'convert_luma': True})69 else:70 param_dict = _build_param_dict(conf,71 ['upscale_factor'])72 transform = sr_output_test_transform(**param_dict)73 return transform74def get_output_transform(conf, application, mode, **kwargs):75 applications = {76 'super_resolution': get_sr_output_transform,77 }78 assert application in applications...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Top 17 Resources To Learn Test Automation

Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on a new technology so soon.

Putting Together a Testing Team

As part of one of my consulting efforts, I worked with a mid-sized company that was looking to move toward a more agile manner of developing software. As with any shift in work style, there is some bewilderment and, for some, considerable anxiety. People are being challenged to leave their comfort zones and embrace a continuously changing, dynamic working environment. And, dare I say it, testing may be the most ‘disturbed’ of the software roles in agile development.

Scala Testing: A Comprehensive Guide

Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.

Nov’22 Updates: Live With Automation Testing On OTT Streaming Devices, Test On Samsung Galaxy Z Fold4, Galaxy Z Flip4, & More

Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.

How To Handle Multiple Windows In Selenium Python

Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.

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 rester 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