diff options
| author | Brian Potchik <brian@vector35.com> | 2025-06-20 16:05:02 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2025-06-20 16:05:02 -0400 |
| commit | bd163fb24e4ad95c82d769838c54b46b31262a0f (patch) | |
| tree | 89b8fbdbdd6f48bae17b23beb6a32bec65f62f92 /python | |
| parent | 55b3ce7de85ef38158e0a248105d3eb2a8562871 (diff) | |
Update the Settings IsEmpty API for querying resources.
Diffstat (limited to 'python')
| -rw-r--r-- | python/settings.py | 15 |
1 files changed, 13 insertions, 2 deletions
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]: """ |
