comparison hglib/context.py @ 149:958307b30af3

hglib: add a __bool__ method where __nonzero__ is defined (issue4520) Python 3 uses the __bool__ magic method for determining the boolean value of an object instead of __nonzero__.
author Brett Cannon <brett@python.org>
date Mon, 16 Mar 2015 17:59:27 -0400
parents c1b966866ed7
children b91356bf7186
comparison
equal deleted inserted replaced
148:c1b966866ed7 149:958307b30af3
77 return not (self == other) 77 return not (self == other)
78 78
79 def __nonzero__(self): 79 def __nonzero__(self):
80 return self._rev != -1 80 return self._rev != -1
81 81
82 def __bool__(self):
83 return self.__nonzero__()
84
82 def __contains__(self, key): 85 def __contains__(self, key):
83 return key in self._manifest 86 return key in self._manifest
84 87
85 def __iter__(self): 88 def __iter__(self):
86 for f in sorted(self._manifest): 89 for f in sorted(self._manifest):