summaryrefslogtreecommitdiffstats
path: root/pattern.py
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2008-12-23 00:21:14 -0500
committerCasey Dahlin <cdahlin@redhat.com>2008-12-23 00:21:14 -0500
commit2c0fbebde3d1d668855d2c9b52b20483f4f5ebd0 (patch)
tree36ccf666afb78fad0108a5ae3e70ef782d6c0245 /pattern.py
parent456d6679048b1508717159c35d80b38bbc351b7f (diff)
downloadupstate-2c0fbebde3d1d668855d2c9b52b20483f4f5ebd0.tar.gz
upstate-2c0fbebde3d1d668855d2c9b52b20483f4f5ebd0.tar.xz
upstate-2c0fbebde3d1d668855d2c9b52b20483f4f5ebd0.zip
Add __eq__ and __hash__
Diffstat (limited to 'pattern.py')
-rw-r--r--pattern.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pattern.py b/pattern.py
index a1919b5..7ff95d8 100644
--- a/pattern.py
+++ b/pattern.py
@@ -81,3 +81,11 @@ class Pattern:
def __repr__(self):
return str(self)
+
+ def __hash__(self):
+ return hash(str(self))
+
+ def __eq__(self, other):
+ if not other.__class__ == Pattern:
+ return False
+ return self.items == other.items and self.invert == other.invert