summaryrefslogtreecommitdiff
path: root/python/workflow.py
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2025-04-07 16:00:53 -0400
committerBrian Potchik <brian@vector35.com>2025-04-07 16:00:53 -0400
commit7fe42b552795f441f01a9cabb04599dc68bfbb7e (patch)
treee0c7d946db7a54ba78483b344a4432dc7b75051f /python/workflow.py
parentbb2b80d9b09f67859081ff3cd30d118c9d0372f5 (diff)
Support string arguments to workflow functions that expect activity lists. (skip-ci)
Diffstat (limited to 'python/workflow.py')
-rw-r--r--python/workflow.py12
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))