Skip to content

Commit

Permalink
change filter: have a repr()
Browse files Browse the repository at this point in the history
  • Loading branch information
xrg authored and Dustin J. Mitchell committed Oct 3, 2010
1 parent cb8120f commit fe8263e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions master/buildbot/schedulers/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,17 @@ def filter_change(self, change):
if filt_fn is not None and not filt_fn(chg_val):
return False
return True

def __repr__(self):
checks = []
for (filt_list, filt_re, filt_fn, chg_attr) in self.checks:
if filt_list is not None and len(filt_list) == 1:
checks.append('%s == %s' % (chg_attr, filt_list[0]))
elif filt_list is not None:
checks.append('%s in %r' % (chg_attr, filt_list))
if filt_re is not None :
checks.append('%s ~/%s/' % (chg_attr, filt_re))
if filt_fn is not None :
checks.append('%s(%s)' % (filt_fn.__name__, chg_attr))

return "<%s on %s>" % (self.__class__.__name__, ' and '.join(checks))

0 comments on commit fe8263e

Please sign in to comment.