[dts] [PATCH V1] framework:Fix run dts on python 3.8 SyntaxWarning
Zhou, JunX W
junx.w.zhou at intel.com
Fri Dec 11 08:31:24 CET 2020
Tested-by: Zhou, Jun <junx.w.zhou at intel.com>
-----Original Message-----
From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Xia Yan
Sent: Friday, December 11, 2020 3:13 PM
To: dts at dpdk.org
Cc: Xia, YanX <yanx.xia at intel.com>
Subject: [dts] [PATCH V1] framework:Fix run dts on python 3.8 SyntaxWarning
modify dut,logger,packet,project_dpdk,settings,tester and virt_resource under the framework to run dts python 3.8 SyntaxWarning
Signed-off-by: Xia Yan <yanx.xia at intel.com>
---
framework/dut.py | 2 +-
framework/logger.py | 2 +-
framework/packet.py | 4 ++--
framework/project_dpdk.py | 4 ++--
framework/settings.py | 2 +-
framework/tester.py | 2 +-
framework/virt_resource.py | 4 ++--
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/framework/dut.py b/framework/dut.py index dcf833b4..4c732ec9 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -573,7 +573,7 @@ class Dut(Crb):
"""
Setup Freebsd hugepages.
"""
- if hugepages is -1:
+ if hugepages == -1:
hugepages = 4096
num_buffers = hugepages / 1024
diff --git a/framework/logger.py b/framework/logger.py index 4600c5fc..63e1d831 100644
--- a/framework/logger.py
+++ b/framework/logger.py
@@ -465,7 +465,7 @@ class LogParser(object):
def __dict_log(self, lvl_name, msg):
tmp = {}
- if lvl_name is not '':
+ if lvl_name != '':
tmp[lvl_name] = msg
return tmp
diff --git a/framework/packet.py b/framework/packet.py index 7d974db0..1c325ff2 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -209,7 +209,7 @@ class scapy(object):
def strip_vlan(self, element, p_index=0):
value = None
- if self.pkts[p_index].haslayer('Dot1Q') is 0:
+ if self.pkts[p_index].haslayer('Dot1Q') == 0:
return None
if element == 'vlan':
@@ -227,7 +227,7 @@ class scapy(object):
def strip_etag(self, element, p_index=0):
value = None
- if self.pkts[p_index].haslayer('Dot1BR') is 0:
+ if self.pkts[p_index].haslayer('Dot1BR') == 0:
return None
if element == 'ECIDbase':
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py index 259282f4..583fcd6c 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -308,7 +308,7 @@ class DPDKdut(Dut):
if 'i386' in cur_path:
pkg_path = cur_path
break
- assert(pkg_path is not ''), "please make sure you env have the i386 pkg-config path"
+ assert(pkg_path != ''), "please make sure you env have the i386 pkg-config path"
self.send_expect("export CFLAGS=-m32", "# ")
self.send_expect("export PKG_CONFIG_LIBDIR=%s" % pkg_path, "# ") @@ -545,7 +545,7 @@ class DPDKdut(Dut):
if 'i386' in cur_path:
pkg_path = cur_path
break
- assert(pkg_path is not ''), "please make sure you env have the i386 pkg-config path"
+ assert(pkg_path != ''), "please make sure you env have the i386 pkg-config path"
self.send_expect("export CFLAGS=-m32", "# ", alt_session=True)
self.send_expect("export PKG_CONFIG_LIBDIR=%s" % pkg_path, "# ", alt_session=True) diff --git a/framework/settings.py b/framework/settings.py index 2b6a3ce3..c5edbb7a 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -385,7 +385,7 @@ def accepted_nic(pci_id):
if pci_id not in list(NICS.values()):
return False
- if nic is 'any':
+ if nic == 'any':
return True
else:
diff --git a/framework/tester.py b/framework/tester.py index b2cbdb0d..ec233b8a 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -354,7 +354,7 @@ class Tester(Crb):
try:
for port_info in self.ports_info:
nic_type = port_info.get('type')
- if nic_type is not 'trex':
+ if nic_type != 'trex':
continue
pci_bus = port_info.get('pci')
port_inst = port_info.get('port') diff --git a/framework/virt_resource.py b/framework/virt_resource.py index 4356ee50..6ae2a28b 100644
--- a/framework/virt_resource.py
+++ b/framework/virt_resource.py
@@ -83,7 +83,7 @@ class VirtResource(object):
def __port_on_socket(self, pci, socket):
for port in self.ports_info:
if port['pci'] == pci:
- if socket is -1:
+ if socket == -1:
return True
if port['numa'] == socket:
@@ -118,7 +118,7 @@ class VirtResource(object):
def __core_on_socket(self, core, socket):
for dut_core in self.dut.cores:
if int(dut_core['thread']) == core:
- if socket is -1:
+ if socket == -1:
return True
if int(dut_core['socket']) == socket:
--
2.17.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dts.log
Type: application/octet-stream
Size: 5004 bytes
Desc: dts.log
URL: <http://mails.dpdk.org/archives/dts/attachments/20201211/01b2a3db/attachment.obj>
More information about the dts
mailing list