summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2026-05-06 19:17:55 -0400
committerGlenn Smith <glenn@vector35.com>2026-05-07 12:23:28 -0400
commit4215166558981845825850843420447910917304 (patch)
tree918bb0034a5680a7c1fc034c5216b009f1c2d352
parent9b47a623795003e48b0311fdf4bb199a10f37028 (diff)
Python: Use BNMetadataIsEqual for object-object comparisons
-rw-r--r--python/metadata.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/python/metadata.py b/python/metadata.py
index c533dd4a..06f10848 100644
--- a/python/metadata.py
+++ b/python/metadata.py
@@ -85,30 +85,22 @@ class Metadata:
return float(self) == other
elif isinstance(other, bool) and self.is_boolean:
return bool(self) == other
- elif self.is_array and ((isinstance(other, Metadata) and other.is_array) or isinstance(other, list)):
+ elif self.is_array and isinstance(other, list):
if len(self) != len(other):
return False
for a, b in zip(self, other):
if a != b:
return False
return True
- elif self.is_dict and ((isinstance(other, Metadata) and other.is_dict) or isinstance(other, dict)):
+ elif self.is_dict and isinstance(other, dict):
if len(self) != len(other):
return False
for a, b in zip(self, other):
if a != b or self[a] != other[b]:
return False
return True
- elif isinstance(other, Metadata) and self.is_integer and other.is_integer:
- return int(self) == int(other)
- elif isinstance(other, Metadata) and self.is_string and other.is_string:
- return str(self) == str(other)
- elif isinstance(other, Metadata) and self.is_bytes and other.is_bytes:
- return bytes(self) == bytes(other)
- elif isinstance(other, Metadata) and self.is_float and other.is_float:
- return float(self) == float(other)
- elif isinstance(other, Metadata) and self.is_boolean and other.is_boolean:
- return bool(self) == bool(other)
+ elif isinstance(other, Metadata):
+ return core.BNMetadataIsEqual(self.handle, other.handle)
return NotImplemented
def __ne__(self, other):