Skip to content

Commit

Permalink
fixed Rule hash method
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamas Kemenczy committed Mar 17, 2009
1 parent 5de99e0 commit 8e9258c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions recurrence/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ def __init__(
setattr(self, param, [])

def __hash__(self):
byparam_values = []
for param in self.byparams:
byparam_values.append(param)
byparam_values.extend(getattr(self, param, []) or [])
return hash((
self.freq, self.interval, self.wkst, self.count, self.until,
tuple(map(
lambda p: map(lambda v: tuple(v), getattr(self, p, []) or []),
self.byparams))))
tuple(byparam_values)))

def __eq__(self, other):
if not isinstance(other, Rule):
Expand Down

0 comments on commit 8e9258c

Please sign in to comment.