diff options
| author | Peter LaFosse <peter@vector35.com> | 2023-02-06 13:31:34 -0500 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2023-02-06 13:31:42 -0500 |
| commit | e6b92a0fcd9a375672264e741a75dc584bcfc45f (patch) | |
| tree | 2d2754979a7d79bcf951a6607a5a5542feaf8336 /python/binaryview.py | |
| parent | 1a041b3cfaf2aebbae823779d96c17af3dcb95bf (diff) | |
Add a __bool__ to BinaryView, Section, and Segment classes
Diffstat (limited to 'python/binaryview.py')
| -rw-r--r-- | python/binaryview.py | 9 |
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 |
