diff options
author | Andy Grover <agrover@redhat.com> | 2014-11-20 15:54:11 -0800 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2014-11-20 15:54:11 -0800 |
commit | aa1cb2d5e5852e4a2bc63b66cc8aee18ae062c92 (patch) | |
tree | 89e5476133c2b46be84a73f78a22eb675734a739 | |
parent | 8388ada59fed8c18ce622901d3b4590cc4162d16 (diff) | |
download | rtslib-fb-aa1cb2d5e5852e4a2bc63b66cc8aee18ae062c92.tar.gz |
Add equality operators for CFSNode
Two rtslib objects can point to the same underlying configfs directory
yet be different Python objects. We should consider these equal. Implement
__eq__().
Also implement __ne__() because Python does not assume this is the inverse
of __eq__().
Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r-- | rtslib/node.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rtslib/node.py b/rtslib/node.py index ed1e10a..3b56486 100644 --- a/rtslib/node.py +++ b/rtslib/node.py @@ -33,6 +33,12 @@ class CFSNode(object): def __init__(self): self._path = self.configfs_dir + def __eq__(self, other): + return self._path == other._path + + def __ne__(self, other): + return self._path != other._path + def _get_path(self): return self._path |