test suite reviews and discussions
 help / color / mirror / Atom feed
* [PATCH] framework/flow: Fix circular import
@ 2022-01-31 22:09 ohilyard
  2022-02-07  8:53 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: ohilyard @ 2022-01-31 22:09 UTC (permalink / raw)
  To: dts; +Cc: lijuan.tu, Owen Hilyard

From: Owen Hilyard <ohilyard@iol.unh.edu>

Some of the re-organization to DTS caused a previously ok circular
import to make the flow generator crash. Moving to local imports has
fixed this.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
 framework/flow/flow_items.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/framework/flow/flow_items.py b/framework/flow/flow_items.py
index 49684381..cce20b51 100644
--- a/framework/flow/flow_items.py
+++ b/framework/flow/flow_items.py
@@ -37,8 +37,6 @@ import itertools
 from functools import reduce
 from typing import Any, Dict, FrozenSet, Hashable, Iterable, Set, Tuple, Union
-import framework.flow.flow_action_items as flow_action_items
-import framework.flow.flow_pattern_items as flow_pattern_items
 from .enums import FlowActionType, FlowItemType
 from .exceptions import InvalidFlowItemException
@@ -90,15 +88,17 @@ class FlowItem(object):
         if type(self) != type(other):
             raise InvalidFlowItemException(self, other)
         elif other.type in self.valid_next_items:
-            # This import is in here so there is no circular import
+            # These imports are in here so there is no circular import
             from .flow import Flow
-            if isinstance(self, flow_pattern_items.PatternFlowItem):
+            from framework.flow.flow_pattern_items import PatternFlowItem
+            from framework.flow.flow_action_items import ActionFlowItem
+            if isinstance(self, PatternFlowItem):
                 return Flow(pattern_items=[self, other])
-            elif isinstance(self, flow_action_items.ActionFlowItem):
+            elif isinstance(self, ActionFlowItem):
                 return Flow(action_items=[self, other])
                 raise TypeError(
-                    f"{type(self):s} is not one of {flow_pattern_items.PatternFlowItem:s}, {flow_action_items.ActionFlowItem:s}.")
+                    f"{type(self):s} is not one of {PatternFlowItem:s}, {ActionFlowItem:s}.")
             raise InvalidFlowItemException(self, other)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-07  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 22:09 [PATCH] framework/flow: Fix circular import ohilyard
2022-02-07  8:53 ` Tu, Lijuan

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git