summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsquareplusc <cliechti@gmx.net>2018-06-15 01:47:30 +0200
committerGitHub <noreply@github.com>2018-06-15 01:47:30 +0200
commitd7ae8f668f0d55abe2808144a1ee6c8e1254f13b (patch)
tree46c17f15497bd5fd5f915fec1b7a33dae7e7e50d
parent22d3900706df7a9c3846094f04dde830553e1a7c (diff)
parent791fa852a6ae28be43f6211d6ce226a691c37773 (diff)
downloadpyserial-git-d7ae8f668f0d55abe2808144a1ee6c8e1254f13b.tar.gz
Merge pull request #354 from vlovich/patch-3
Make ListPortInfo hashable
-rw-r--r--serial/tools/list_ports_common.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/serial/tools/list_ports_common.py b/serial/tools/list_ports_common.py
index 8a1b625..617f3dc 100644
--- a/serial/tools/list_ports_common.py
+++ b/serial/tools/list_ports_common.py
@@ -77,6 +77,9 @@ class ListPortInfo(object):
def __eq__(self, other):
return isinstance(other, ListPortInfo) and self.device == other.device
+ def __hash__(self):
+ return hash(self.device)
+
def __lt__(self, other):
if not isinstance(other, ListPortInfo):
raise TypeError('unorderable types: {}() and {}()'.format(