Skip to content

Commit d7ae8f6

Browse files
authored
Merge pull request pyserial#354 from vlovich/patch-3
Make ListPortInfo hashable
2 parents 22d3900 + 791fa85 commit d7ae8f6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

serial/tools/list_ports_common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ def apply_usb_info(self):
7777
def __eq__(self, other):
7878
return isinstance(other, ListPortInfo) and self.device == other.device
7979

80+
def __hash__(self):
81+
return hash(self.device)
82+
8083
def __lt__(self, other):
8184
if not isinstance(other, ListPortInfo):
8285
raise TypeError('unorderable types: {}() and {}()'.format(

0 commit comments

Comments
 (0)