From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 40882A00BE; Mon, 31 Jan 2022 23:09:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0FAA841190; Mon, 31 Jan 2022 23:09:41 +0100 (CET) Received: from mail-ua1-f97.google.com (mail-ua1-f97.google.com [209.85.222.97]) by mails.dpdk.org (Postfix) with ESMTP id 3C87140042 for ; Mon, 31 Jan 2022 23:09:39 +0100 (CET) Received: by mail-ua1-f97.google.com with SMTP id n15so12726798uaq.5 for ; Mon, 31 Jan 2022 14:09:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Yck1CRTd3FdQlrO++s8RLgIVqlGuI2O/RvhnEir0Zrw=; b=bF6ugMO9ZfSMqvmCepMEBseRFH0UUGZYH4R1UZzcx+DpJIYkniRdhr1nOw3p0h4utz cSCHDTjTMXA0t50MZfqT/qOGertZo5aHcOVFvzxXFE8ll/+DZbmew9hHiYkzaC7TLHfZ DUe+co0YXGsdFsxFqhxPXmAU3KWDUv5m4MOrU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Yck1CRTd3FdQlrO++s8RLgIVqlGuI2O/RvhnEir0Zrw=; b=RK2gjLJkjI9sjvHmuDvA+Ugz533tBwVBMQwuDYeNlY78vGE2CODFWDGuVndZvQCq/a 0nsGKyXIPQWl/S5zTaUU9brT9cxatGMJUIfT3LZPp7x9R4S7vO27eAfaQjkKyA9td4cM zdTZ2N8bpgnmZsvbPOBQ5BA5tQkMlDvYVHO63RdzJFWM5ZV+U5akeP+BgPyPIfNasRy9 0In8dcXUWDqLK34TJod4CLy3QoIzEugGNtiQAwRjEMQS5VtSGg2eYyoy5tcmfy7MppXW HKkYZUCHjZaMTm2x2UHs/g+JAvf3BjOtDVdQWOqoilGCErsFXlHQf9tIYUYq08eJG1Cn V1aA== X-Gm-Message-State: AOAM531GAxJdCueDTv4HH6WcmsqVK4nA4TGBO+iQHaTBj+j0lBnGf4sx gSUqJ74uvO71HkNGI5o3mR9MroUgLKVv+y9AxUQGu6eLCAQaBVm+Rm88kE1AgnDt2gHDYCyrUjk oGaQxa9F1MwZ4YAsiKkd5ZurikZWrmYEyh2ME/yt1rIMt5RF+fZfp1Uj7bDt8nilSBTupvtE6hN 2zMsYPFWEGkkmKpA== X-Google-Smtp-Source: ABdhPJyID7QZGRsHK8eC58zSrhutPvsWUzfiS10mC4jQFhTbqsX+YwDSul1WYVvAOJ/VEY5qXpUkOlLC0icS X-Received: by 2002:a9f:24a4:: with SMTP id 33mr8971914uar.42.1643666978525; Mon, 31 Jan 2022 14:09:38 -0800 (PST) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id z18sm2402304uam.2.2022.01.31.14.09.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Jan 2022 14:09:38 -0800 (PST) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::105d]) by postal.iol.unh.edu (Postfix) with ESMTP id 101F8605246B; Mon, 31 Jan 2022 17:09:38 -0500 (EST) From: ohilyard@iol.unh.edu To: dts@dpdk.org Cc: lijuan.tu@intel.com, Owen Hilyard Subject: [PATCH] framework/flow: Fix circular import Date: Mon, 31 Jan 2022 17:09:37 -0500 Message-Id: <20220131220937.38772-1-ohilyard@iol.unh.edu> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org From: Owen Hilyard 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 --- 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]) else: 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}.") else: raise InvalidFlowItemException(self, other) -- 2.30.2