diff options
author | zsquareplusc <cliechti@gmx.net> | 2018-06-15 01:47:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-15 01:47:30 +0200 |
commit | d7ae8f668f0d55abe2808144a1ee6c8e1254f13b (patch) | |
tree | 46c17f15497bd5fd5f915fec1b7a33dae7e7e50d | |
parent | 22d3900706df7a9c3846094f04dde830553e1a7c (diff) | |
parent | 791fa852a6ae28be43f6211d6ce226a691c37773 (diff) | |
download | pyserial-git-d7ae8f668f0d55abe2808144a1ee6c8e1254f13b.tar.gz |
Merge pull request #354 from vlovich/patch-3
Make ListPortInfo hashable
-rw-r--r-- | serial/tools/list_ports_common.py | 3 |
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( |