Best Python code snippet using localstack_python
template_deployer.py
Source:template_deployer.py  
...1039    def update_stack(self, new_stack):1040        self.stack.set_stack_status("UPDATE_IN_PROGRESS")1041        # apply changes1042        self.apply_changes(self.stack, new_stack, stack_name=self.stack.stack_name, action="UPDATE")1043        self.stack.set_time_attribute("LastUpdatedTime")1044    def delete_stack(self):1045        if not self.stack:1046            return1047        self.stack.set_stack_status("DELETE_IN_PROGRESS")1048        stack_resources = list(self.stack.resources.values())1049        resources = {r["LogicalResourceId"]: clone_safe(r) for r in stack_resources}1050        for key, resource in resources.items():1051            resource["Properties"] = resource.get("Properties", clone_safe(resource))1052            resource["ResourceType"] = resource.get("ResourceType") or resource.get("Type")1053        for resource_id, resource in resources.items():1054            # TODO: cache condition value in resource details on deployment and use cached value here1055            if evaluate_resource_condition(self, resource):1056                delete_resource(self, resource_id)1057                self.stack.set_resource_status(resource_id, "DELETE_COMPLETE")1058        # update status1059        self.stack.set_stack_status("DELETE_COMPLETE")1060        self.stack.set_time_attribute("DeletionTime")1061    # ----------------------------1062    # DEPENDENCY RESOLUTION UTILS1063    # ----------------------------1064    def is_deployable_resource(self, resource):1065        resource_type = get_resource_type(resource)1066        entry = get_deployment_config(resource_type)1067        if entry is None and resource_type not in ["Parameter", None]:1068            resource_str = dump_resource_as_json(resource)1069            LOG.warning(f'Unable to deploy resource type "{resource_type}": {resource_str}')1070        return bool(entry and entry.get(ACTION_CREATE))1071    def is_deployed(self, resource):1072        resource_status = {}1073        resource_id = resource["LogicalResourceId"]1074        details = retrieve_resource_details(resource_id, resource_status, stack=self.stack)...utils.py
Source:utils.py  
...29    def from_img(cls, img_c, voxel_spacing):30        coords = (img_c[2] * voxel_spacing[2], img_c[1] * voxel_spacing[1],31                  img_c[0] * voxel_spacing[0])32        return cls(coords, voxel_spacing)33def set_time_attribute(tree, time_interval):34    '''Set a new "time" attribute = "mamut_t" x time_interval'''35    for n, attr in tree.nodes:36        attr['time'] = attr['mamut_t'] * time_interval37def label_split_cells(tree):38    '''Labels splitting cells as 1 before and as 2 after split'''39    tree.set_all_nodes_attribute('split', 0)40    for n_id, n_attr in tree.nodes:41        successors = list(tree.successors(n_id))42        if len(successors) > 1:43            n_attr['split'] = 144            for nid in successors:45                tree.nodes[nid]['split'] = 246def compute_split_orientation(tree):47    '''compute abs(cos(alpha)) where alpha is the angle between segment ...tree_tasks.py
Source:tree_tasks.py  
...38            os.makedirs(self.temp_output_dir, exist_ok=True)39            # parse mamut tree40            tree = construct_tree(self.input()['xml_tree'].path)41            # calculate all implemented features42            set_time_attribute(tree, experiment_config['time_interval'])43            label_merge_cells(tree)44            label_merged_tracks(tree)45            compute_timepoint_ids(tree)46            compute_dendrogram_coordinates(tree)47            label_split_cells(tree)48            label_generation(tree)49            label_cell_id(tree)50            calculate_displacement(tree)51            for es, ee, e_attr in tree.edges:52                # copy displacement attribute to end node53                tree.nodes[ee]['displacement'] = e_attr['displacement']54            max_generation = max(55                tree.get_all_nodes_attribute('generation').values())56            for gen in range(1, max_generation + 1):...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
