Best Python code snippet using localstack_python
Node_Data.py
Source:Node_Data.py  
1import random2from src.NodeData import NodeData3class Node_Data(NodeData):4    """5     This class describes the vertices in the graph6    """7    def __init__(self, key: int = 0, location: tuple = None, weight: float = 0.0, info: str = "", tag: int = 0,8                 inDegree: dict = None, outDegree: dict = None):9        """"10        constructor11        """12        self._node_key = key13        self._node_location = location14        self._node_weight = weight15        self._node_info = info16        self._node_tag = tag17        self._inDegree = inDegree18        self._outDegree = outDegree19    def getKey(self) -> int:20        """21        :return:Vertex ID number22        """23        return self._node_key24    def getLocation(self) -> tuple:25        """26        :return: 3D point27        """28        if self._node_location is None:29            return random.random()*10,random.random()*10,0.030        return self._node_location31    def setLocation(self, location: tuple) -> None:32        """33        :param location:new new location  (position) of this node.34        :return: the void35        """36        self._node_location = location37    def getWeight(self) -> float:38        """39        :return:  The weight of the vertex40        """41        return self._node_weight42    def setWeight(self, weight: float) -> None:43        """44        :param weight:- the new weight45        :return: the void46        """47        self._node_weight = weight;48    def getInfo(self) -> str:49        """50        :return:Get Info51        """52        return self._node_info53    def setInfo(self, info: str) -> None:54        """55        :param info: changes Info56        :return: the void57        """58        self._node_info = info59    def getTag(self) -> int:60        """61        :return: Get Tag62        """63        return self._node_tag64    def setTag(self, tag: int) -> None:65        """66        :param tag:  the new value of the tag67        :return: the void68        """69        self._node_tag = tag70    def __repr__(self) -> str:71        """72        :return:A string of the whole class73        """74        return f"{self._node_key}: |edges out| {len(self._outDegree)} |edges in| {len(self._inDegree)} "75if __name__ == '__main__':76   v = random.random()*10...Flow.py
Source:Flow.py  
1import copy2class Flow():3    def __init__(self,pipeline): 4        self.pipeline = pipeline5       6    def compile(self):7        print("---COMPILING---")8        self.compiled = self.pipeline()9        print(self.compiled)10    11    def run(self):12        print("---RUNNING---")13        comp_dic = {}14        node_data = self.compiled['node_data']15        current_op = node_data[0].func16        current_args = node_data[0].args17        current_kwargs = node_data[0].kwargs18        node_id = node_data[0].node_id19        current_comp = current_op(*current_args,**current_kwargs)20        comp_dic[node_id] = current_comp21        for index in range(1,len(node_data)):22            node_id = node_data[index].node_id23            if node_id in comp_dic:24                continue 25            current_op = node_data[index].func26            current_args = node_data[index].args27            current_kwargs = node_data[index].kwargs28            altered_args = []29            for arg in current_args:30                if type(arg) == dict and '_requires_compute' in arg:31                    compute_key = arg['_requires_compute']32                    altered_args.append(copy.copy(comp_dic[compute_key]))33                else:34                    altered_args.append(arg)35            36            current_comp = current_op(*altered_args,**current_kwargs)37            38            if node_data[index]._node_tag != None:39                current_comp = current_comp[node_data[index]._node_tag]40            comp_dic[node_id] = current_comp41        return current_comp42def createflow(func):...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!!
