From bd163fb24e4ad95c82d769838c54b46b31262a0f Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Fri, 20 Jun 2025 16:05:02 -0400 Subject: Update the Settings IsEmpty API for querying resources. --- python/settings.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/settings.py b/python/settings.py index 50110df8..59a595e3 100644 --- a/python/settings.py +++ b/python/settings.py @@ -244,14 +244,25 @@ class Settings: """ return core.BNSettingsContains(self.handle, key) - def is_empty(self) -> bool: + def is_empty(self, resource: Optional[Union['binaryview.BinaryView', 'function.Function']] = None, scope: 'SettingsScope' = SettingsScope.SettingsAutoScope) -> bool: """ ``is_empty`` determine if the active settings schema is empty + :param resource: a BinaryView or Function object to check for emptiness + :param scope: the SettingsScope to check for emptiness :return: True if the active settings schema is empty, False otherwise :rtype: bool """ - return core.BNSettingsIsEmpty(self.handle) + view_handle = None + func_handle = None + if resource is not None: + if isinstance(resource, binaryview.BinaryView): + view_handle = resource.handle + elif isinstance(resource, function.Function): + func_handle = resource.handle + else: + raise TypeError("Expected resource to be either a BinaryView or a Function.") + return core.BNSettingsIsEmpty(self.handle, view_handle, func_handle, scope) def keys(self) -> List[str]: """ -- cgit v1.3.1