[v2,7/7] dpdk-pmdinfo: do not use len(x) to test for empty
diff mbox series

Message ID 20201104064842.25832-8-stephen@networkplumber.org
State Accepted
Delegated to: Thomas Monjalon
Headers show
Series
  • dpdk-pmdinfo: python lint cleanups
Related show

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Nov. 4, 2020, 6:48 a.m. UTC
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 <stephen@networkplumber.org>
---
 usertools/dpdk-pmdinfo.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch
diff mbox series

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)