From f218b83833808c287a432033dc0cb7e8dd372d34 Mon Sep 17 00:00:00 2001 From: Brian Muller Date: Wed, 3 Jul 2019 08:22:35 -0400 Subject: [PATCH] added additional docs to Node to reduce confusion noted in #73 --- kademlia/node.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kademlia/node.py b/kademlia/node.py index 2f087f5..c8bc406 100644 --- a/kademlia/node.py +++ b/kademlia/node.py @@ -3,7 +3,21 @@ import heapq class Node: + """ + Simple object to encapsulate the concept of a Node (minimally an ID, but + also possibly an IP and port if this represents a node on the network). + This class should generally not be instantiated directly, as it is a low + level construct mostly used by the router. + """ def __init__(self, node_id, ip=None, port=None): + """ + Create a Node instance. + + Args: + node_id (int): A value between 0 and 2^160 + ip (string): Optional IP address where this Node lives + port (int): Optional port for this Node (set when IP is set) + """ self.id = node_id # pylint: disable=invalid-name self.ip = ip # pylint: disable=invalid-name self.port = port