From 73dd62135baec5ab3fa726ff095584531073aa91 Mon Sep 17 00:00:00 2001 From: zachary62 Date: Sun, 2 Feb 2025 22:30:18 +0000 Subject: [PATCH] m --- docs/flow.md | 7 +++++++ pocketflow/__init__.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/flow.md b/docs/flow.md index 6ac6208..d8f9959 100644 --- a/docs/flow.md +++ b/docs/flow.md @@ -100,6 +100,13 @@ A **Flow** can act like a Node, which enables powerful composition patterns. Thi 2. Combine multiple smaller Flows into a larger Flow for reuse. 3. Node `params` will be a merging of **all** parents' `params`. +> While **Flow** is also a **Node**, it won't run `exec()`. +> +> It will run `prep()` and `post()`, before and after calling the nodes within the flow. +> +> However, `post()` always receives None for exec_res, and should instead get the flow execution results from the shared store. +{: .warning } + ### Basic Flow Nesting Here's how to connect a flow to another node: diff --git a/pocketflow/__init__.py b/pocketflow/__init__.py index 17271fa..27a76e1 100644 --- a/pocketflow/__init__.py +++ b/pocketflow/__init__.py @@ -34,7 +34,7 @@ class Node(BaseNode): if self.wait>0: time.sleep(self.wait) class BatchNode(Node): - def _exec(self,items): return [super(BatchNode,self)._exec(i) for i in items] + def _exec(self,items): return [super(BatchNode,self)._exec(i) for i in (items or [])] class Flow(BaseNode): def __init__(self,start): super().__init__();self.start=start