How to use legacy_from_config method in localstack

Best Python code snippet using localstack_python

models.py

Source: models.py Github

copy

Full Screen

...1041 return copy.deepcopy(config)1042 @classmethod1043 def from_config(cls, config, custom_objects=None):1044 if 'class_name' not in config[0] or config[0]['class_name'] == 'Merge':1045 return cls.legacy_from_config(config)1046 model = cls()1047 for conf in config:1048 layer = layer_module.deserialize(conf, custom_objects=custom_objects)1049 model.add(layer)1050 return model1051 def legacy_get_config(self):1052 """Retrieves the model configuration as a Python list.1053 # Returns1054 A list of dicts (each dict is a layer config).1055 """1056 config = []1057 if isinstance(self.layers[0], legacy_layers.Merge):1058 assert hasattr(self.layers[0], 'layers')1059 layers = []1060 for layer in self.layers[0].layers:1061 layer_config = {'class_name': layer.__class__.__name__,1062 'config': layer.get_config()}1063 layers.append(layer_config)1064 merge_config = self.layers[0].get_config()1065 merge_config['layers'] = layers1066 config.append({'class_name': 'Merge', 'config': merge_config})1067 else:1068 config.append({'class_name': self.layers[0].__class__.__name__,1069 'config': self.layers[0].get_config()})1070 for layer in self.layers[1:]:1071 config.append({'class_name': layer.__class__.__name__,1072 'config': layer.get_config()})1073 return copy.deepcopy(config)1074 @classmethod1075 def legacy_from_config(cls, config, layer_cache=None):1076 """Load a model from a legacy configuration.1077 # Arguments1078 config: dictionary with configuration.1079 layer_cache: cache to draw pre-existing layer.1080 # Returns1081 The loaded Model.1082 """1083 if not layer_cache:1084 layer_cache = {}1085 def normalize_legacy_config(conf):1086 if 'class_name' not in conf:1087 class_name = conf['name']1088 name = conf.get('custom_name')1089 conf['name'] = name...

Full Screen

Full Screen

test_cli.py

Source: test_cli.py Github

copy

Full Screen

...89 monkeypatch.setenv("DATA_DIR", str(data_dir))90 monkeypatch.setattr(config, "DATA_DIR", str(data_dir))91 monkeypatch.setattr(config, "TMP_FOLDER", str(tmp_folder))92 # reload directories from manipulated config93 monkeypatch.setattr(config, "dirs", config.Directories.legacy_from_config())94 runner.invoke(cli, ["start", "-d"])95 runner.invoke(cli, ["wait", "-t", "60"])96 # check that mounts were created correctly97 inspect = container_client.inspect_container(config.MAIN_CONTAINER_NAME)98 container_dirs = config.Directories.for_container()99 binds = inspect["HostConfig"]["Binds"]100 assert f"{tmp_folder}:{container_dirs.tmp}" in binds101 assert f"{data_dir}:{container_dirs.data}" in binds102 assert f"{DOCKER_SOCK}:{DOCKER_SOCK}" in binds103 @pytest.mark.skipif(104 condition=config.LEGACY_DIRECTORIES, reason="this test targets LEGACY_DIRECTORIES=0"105 )106 def test_volume_dir_mounted_correctly(self, runner, tmp_path, monkeypatch, container_client):107 volume_dir = tmp_path /​ "volume"...

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