summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2023-02-06 13:31:34 -0500
committerPeter LaFosse <peter@vector35.com>2023-02-06 13:31:42 -0500
commite6b92a0fcd9a375672264e741a75dc584bcfc45f (patch)
tree2d2754979a7d79bcf951a6607a5a5542feaf8336 /python/binaryview.py
parent1a041b3cfaf2aebbae823779d96c17af3dcb95bf (diff)
Add a __bool__ to BinaryView, Section, and Segment classes
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index be4f28be..eab2373a 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -1316,6 +1316,9 @@ class Segment:
def length(self):
return int(core.BNSegmentGetLength(self.handle))
+ def __bool__(self):
+ return True
+
def __eq__(self, other):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -1415,6 +1418,9 @@ class Section:
def __len__(self):
return self.length
+ def __bool__(self):
+ return True
+
def __eq__(self, other):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -2050,6 +2056,9 @@ class BinaryView:
def length(self):
return int(core.BNGetViewLength(self.handle))
+ def __bool__(self):
+ return True
+
def __eq__(self, other):
if not isinstance(other, self.__class__):
return NotImplemented