From patchwork Wed Nov 4 06:48:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 83648 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 863C9A04E7; Wed, 4 Nov 2020 07:51:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E0AD2C822; Wed, 4 Nov 2020 07:49:07 +0100 (CET) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by dpdk.org (Postfix) with ESMTP id BBA90C7EE for ; Wed, 4 Nov 2020 07:49:00 +0100 (CET) Received: by mail-pg1-f180.google.com with SMTP id r186so15773879pgr.0 for ; Tue, 03 Nov 2020 22:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IEzcrqI/FlE43beY/YsF9Yfkwk3Z0C6QBFws3VaLCcU=; b=AvZLBz3OykujgWvID1m8DblE2/bHLpr+QCs1hB0VxfpXphjJYVLyAWM6DR1lRjZULu uEcRgWvf+h4KXaNGLBnX4iPz8mYFh/H2Wyn6pb3BV8sljbql0c+pOjtKAq2YATPJdfkz Iz1mk089N4G9zb+1CT6wJWLkwzvyEUoQNYJpxerkf2PDmOo0a0GD9Rlywc7Pud6asit8 8Y1U888Sd05ZFTB9vOCUVjhCf+TfPUk7Ym1SdVzNiOc2qjes9+Lzcan72cTfeHg9yW7N YJz/iX8xMdTF5oo8xPtr6Q7oPqHZVSQpQV7MOdOdj6Micny2H9gpe0cw4jjgqGOD+3uj ok1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IEzcrqI/FlE43beY/YsF9Yfkwk3Z0C6QBFws3VaLCcU=; b=O3BSpETFpq4jwX0o6YAIaH9Ba5sj/kl94EZUt/9vQW6OsLN2B1T9JBltnX+WpbUZG1 QgDJhVCBgffKKbaEV7lc4XfayB+Dt9S2GAdqSt8WGI9wJ6roRUsu/OctGAIWPqmgEg3U EYuu0YpwniGL2Ch8tADVZMEUj5J7Fo+gCzB6flfykb1VWnlDP6iNfFnldOtR0htmxplH Y3MRCFJ4HcJNw/CvEjkXzGMttM1QUToiCqQF17Y0T0j+jJ2829i1mJW89gwO4Xwn3hH/ IrgM7EXkDabJghitz+6RP1/k4JRz6i/xBPa/XlfZX0gLftQh2M3+wbll7dO22//kOIPd XRWQ== X-Gm-Message-State: AOAM531erqebywLux9wINbG/lKGc5S7esGtsz6lysadxtYz59vxMMSY/ f54MG5noFak+EN6duue+dMtziA== X-Google-Smtp-Source: ABdhPJzmesxP1id0qf5JBDkJkQhR+T1JzGcNvdYXEOzd6RmIAeWqZv7ON7ZnT9EpngL8rFt2WGzl7g== X-Received: by 2002:a17:90a:d590:: with SMTP id v16mr3027899pju.88.1604472540094; Tue, 03 Nov 2020 22:49:00 -0800 (PST) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id c12sm1144137pgi.14.2020.11.03.22.48.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 22:48:59 -0800 (PST) From: Stephen Hemminger To: nhorman@tuxdriver.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 3 Nov 2020 22:48:42 -0800 Message-Id: <20201104064842.25832-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201104064842.25832-1-stephen@networkplumber.org> References: <20200906013133.26360-3-stephen@networkplumber.org> <20201104064842.25832-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 7/7] dpdk-pmdinfo: do not use len(x) to test for empty X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This fixes the following python lint warnings. usertools/dpdk-pmdinfo.py:188:11: C1801: Do not use `len(SEQUENCE)` to determine if a sequence is empty (len-as-condition) usertools/dpdk-pmdinfo.py:196:21: C1801: Do not use `len(SEQUENCE)` to determine if a sequence is empty (len-as-condition) usertools/dpdk-pmdinfo.py:302:11: C1801: Do not use `len(SEQUENCE)` to determine if a sequence is empty (len-as-condition) Signed-off-by: Stephen Hemminger --- usertools/dpdk-pmdinfo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py index 1c2c3d05fea6..2bead75da238 100755 --- a/usertools/dpdk-pmdinfo.py +++ b/usertools/dpdk-pmdinfo.py @@ -185,7 +185,7 @@ def findDate(self, content): return None def parse(self): - if len(self.contents) < 1: + if not self.contents: print("data/%s-pci.ids not found" % self.date) else: vendorID = "" @@ -193,7 +193,7 @@ def parse(self): for l in self.contents: if l[0] == "#": continue - elif len(l.strip()) == 0: + elif not l.strip(): continue else: if l.find("\t\t") == 0: @@ -307,7 +307,7 @@ def parse_pmd_info_string(self, mystring): except KeyError: continue - if len(pmdinfo["pci_ids"]) != 0: + if pmdinfo["pci_ids"]: print("PMD HW SUPPORT:") if pcidb is not None: self.pretty_print_pmdinfo(pmdinfo)