-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconn.py
More file actions
30 lines (21 loc) · 748 Bytes
/
conn.py
File metadata and controls
30 lines (21 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class conn:
def __init__(self, nodeID=None, address=None, udp_address=None):
self.nodeID = nodeID
self.address = address
self.udp_address = udp_address
self.active = True
@property
def is_valid(self):
return not self.nodeID is None
def __eq__(self, other):
return not other is None and self.nodeID == other.nodeID \
and self.address == other.address \
and self.udp_address == other.udp_address
def __str__(self):
return str(self.nodeID)
def __repr__(self):
return self.__str__()
def __le__(self, other):
return self.nodeID <= other.nodeID
def __lt__(self, other):
return self.nodeID < other.nodeID