summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2020-08-19 15:15:18 -0400
committerJosh Ferrell <josh@vector35.com>2020-08-19 15:15:18 -0400
commitd4804f23a48091f03f962d44a7a9c2fd6aeeee81 (patch)
tree83c79dd2d951e9707d6b0a8c48e7eb0d03bb2b98 /python
parentacea8a46cde62af24b0bca4d47ec56ad027d8f14 (diff)
Documentation for SaveSettings and SaveOption
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py6
-rw-r--r--python/filemetadata.py26
2 files changed, 31 insertions, 1 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 1086035b..abcc5f49 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -2506,13 +2506,17 @@ class BinaryView(object):
def create_database(self, filename, progress_func=None, settings=None):
"""
- ``create_database`` writes the current database (.bndb) file out to the specified file.
+ ``create_database`` writes the current database (.bndb) out to the specified file.
:param str filename: path and filename to write the bndb to, this string `should` have ".bndb" appended to it.
:param callback progress_func: optional function to be called with the current progress and total count.
:param SaveSettings settings: optional argument for special save options.
:return: true on success, false on failure
:rtype: bool
+ :Example:
+ >>> settings = SaveSettings()
+ >>> bv.create_database(f"{bv.file.filename}.bndb", None, settings)
+ True
"""
return self._file.create_database(filename, progress_func, settings)
diff --git a/python/filemetadata.py b/python/filemetadata.py
index bf9abd7c..66639c3b 100644
--- a/python/filemetadata.py
+++ b/python/filemetadata.py
@@ -62,6 +62,10 @@ class NavigationHandler(object):
class SaveSettings(object):
+ """
+ ``class SaveSettings`` is used to specify actions and options that apply to saving a database (.bndb).
+ """
+
def __init__(self, handle = None):
if handle is None:
self.handle = core.BNCreateSaveSettings()
@@ -77,6 +81,15 @@ class SaveSettings(object):
return core.BNIsSaveSettingsOptionSet(self.handle, option)
def set_option(self, option, state = True):
+ """
+ Set a SaveOption in this instance.
+
+ :param SaveOption option: Option to set.
+ :param bool state: State to assign. Defaults to True.
+ :Example:
+ >>> settings = SaveSettings()
+ >>> settings.set_option(SaveOption.TrimSnapshots)
+ """
if isinstance(option, str):
option = SaveOption[option]
core.BNSetSaveSettingsOption(self.handle, option, state)
@@ -354,6 +367,19 @@ class FileMetadata(object):
return core.BNNavigate(self.handle, str(view), offset)
def create_database(self, filename, progress_func = None, settings = None):
+ """
+ ``create_database`` writes the current database (.bndb) out to the specified file.
+
+ :param str filename: path and filename to write the bndb to, this string `should` have ".bndb" appended to it.
+ :param callback progress_func: optional function to be called with the current progress and total count.
+ :param SaveSettings settings: optional argument for special save options.
+ :return: true on success, false on failure
+ :rtype: bool
+ :Example:
+ >>> settings = SaveSettings()
+ >>> bv.file.create_database(f"{bv.file.filename}.bndb", None, settings)
+ True
+ """
if settings is not None:
settings = settings.handle