Python 2.x compatibility
This commit is contained in:
parent
5f14d958ac
commit
6e8196d475
@ -143,6 +143,8 @@ class QCombination(QNode):
|
|||||||
def __bool__(self):
|
def __bool__(self):
|
||||||
return bool(self.children)
|
return bool(self.children)
|
||||||
|
|
||||||
|
__nonzero__ = __bool__ # For Py2 support
|
||||||
|
|
||||||
def accept(self, visitor):
|
def accept(self, visitor):
|
||||||
for i in range(len(self.children)):
|
for i in range(len(self.children)):
|
||||||
if isinstance(self.children[i], QNode):
|
if isinstance(self.children[i], QNode):
|
||||||
@ -178,6 +180,8 @@ class Q(QNode):
|
|||||||
def __bool__(self):
|
def __bool__(self):
|
||||||
return bool(self.query)
|
return bool(self.query)
|
||||||
|
|
||||||
|
__nonzero__ = __bool__ # For Py2 support
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.__class__ == other.__class__ and self.query == other.query
|
return self.__class__ == other.__class__ and self.query == other.query
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user