diff options
| author | Brian Potchik <brian@vector35.com> | 2025-04-07 16:00:53 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2025-04-07 16:00:53 -0400 |
| commit | 7fe42b552795f441f01a9cabb04599dc68bfbb7e (patch) | |
| tree | e0c7d946db7a54ba78483b344a4432dc7b75051f /python/workflow.py | |
| parent | bb2b80d9b09f67859081ff3cd30d118c9d0372f5 (diff) | |
Support string arguments to workflow functions that expect activity lists. (skip-ci)
Diffstat (limited to 'python/workflow.py')
| -rw-r--r-- | python/workflow.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/python/workflow.py b/python/workflow.py index bda6c5cb..d118b9f5 100644 --- a/python/workflow.py +++ b/python/workflow.py @@ -464,7 +464,7 @@ class Workflow(metaclass=_WorkflowMetaclass): finally: core.BNFreeStringList(result, length.value) - def assign_subactivities(self, activity: Activity, activities: List[str]) -> bool: + def assign_subactivities(self, activity: Activity, activities: Union[List[str], str]) -> bool: """ ``assign_subactivities`` Assign the list of ``activities`` as the new set of children for the specified ``activity``. @@ -473,6 +473,8 @@ class Workflow(metaclass=_WorkflowMetaclass): :return: True on success, False otherwise :rtype: bool """ + if isinstance(activities, str): + activities = [activities] input_list = (ctypes.c_char_p * len(activities))() for i in range(0, len(activities)): input_list[i] = str(activities[i]).encode('charmap') @@ -529,12 +531,12 @@ class Workflow(metaclass=_WorkflowMetaclass): """ return core.BNWorkflowRemove(self.handle, str(activity)) - def replace(self, activity: ActivityType, new_activity: List[str]) -> bool: + def replace(self, activity: ActivityType, new_activity: str) -> bool: """ ``replace`` Replace the specified ``activity``. :param str activity: the Activity to replace - :param list[str] new_activity: the replacement Activity + :param str new_activity: the replacement Activity :return: True on success, False otherwise :rtype: bool """ @@ -704,6 +706,8 @@ class WorkflowMachine: return json.loads(core.BNPostWorkflowRequestForBinaryView(self.handle, request)) def breakpoint_delete(self, activities): + if isinstance(activities, str): + activities = [activities] request = json.dumps({"command": "breakpoint", "action": "delete", "activities": activities}) if self.is_function_machine: return json.loads(core.BNPostWorkflowRequestForFunction(self.handle, request)) @@ -718,6 +722,8 @@ class WorkflowMachine: return json.loads(core.BNPostWorkflowRequestForBinaryView(self.handle, request)) def breakpoint_set(self, activities): + if isinstance(activities, str): + activities = [activities] request = json.dumps({"command": "breakpoint", "action": "set", "activities": activities}) if self.is_function_machine: return json.loads(core.BNPostWorkflowRequestForFunction(self.handle, request)) |
