model/network.py
def connect_nodes(self, nodes: list) -> None:
        """Connect nodes that weren't connected before"""

        for node in nodes:
            if not Counter(node.keys()) == Counter(["ip", "port"]):
                raise ValueError(
                    "Node must contain two arguments: \"ip\" and \"port\"")
            elif not node in self.__info["connected_nodes"]:
                if not isinstance(node["ip"], str):
                    raise TypeError("Node ip must be of type \"str\"")
                elif not isinstance(node["port"], int):
                    raise TypeError("Node port must be of type \"int\"")

                self.__info["connected_nodes"].append(node)

        self.save()
Connect nodes that weren't connected before
Connect nodes that weren't connected before
Connect nodes that weren ' t connected before
def connect_nodes(self, nodes: list) -> None:
        for node in nodes:
            if not Counter(node.keys()) == Counter(["ip", "port"]):
                raise ValueError(
                    "Node must contain two arguments: \"ip\" and \"port\"")
            elif not node in self.__info["connected_nodes"]:
                if not isinstance(node["ip"], str):
                    raise TypeError("Node ip must be of type \"str\"")
                elif not isinstance(node["port"], int):
                    raise TypeError("Node port must be of type \"int\"")
                self.__info["connected_nodes"].append(node)
        self.save()
def connect_nodes ( self , nodes : list ) -> None : for node in nodes : if not Counter ( node . keys ( ) ) == Counter ( [ "ip" , "port" ] ) : raise ValueError ( "Node must contain two arguments: \"ip\" and \"port\"" ) elif not node in self . __info [ "connected_nodes" ] : if not isinstance ( node [ "ip" ] , str ) : raise TypeError ( "Node ip must be of type \"str\"" ) elif not isinstance ( node [ "port" ] , int ) : raise TypeError ( "Node port must be of type \"int\"" ) self . __info [ "connected_nodes" ] . append ( node ) self . save ( )
Connect nodes that weren't connected before
Connect nodes that weren ' t connected before
"""Connect nodes that weren't connected before"""
self
nodes
list