From 57f5b8cea4961cb9a82e04378755ef88a08b9810 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 4 Oct 2013 18:22:21 -0700 Subject: [PATCH] Allow access by index Since a linear flow is a linear set of tasks or subflows we can easily add in an accessor that can fetch these items by index which is useful for indexing for any post-add operations. Change-Id: Ib1690584a08e24fae29285225e6c519b06ce2ddd --- taskflow/patterns/linear_flow.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/taskflow/patterns/linear_flow.py b/taskflow/patterns/linear_flow.py index 03f4380c..c8ebe636 100644 --- a/taskflow/patterns/linear_flow.py +++ b/taskflow/patterns/linear_flow.py @@ -60,6 +60,9 @@ class Flow(flow.Flow): for child in self._children: yield child + def __getitem__(self, index): + return self._children[index] + @property def provides(self): provides = set()