summaryrefslogtreecommitdiffstats
path: root/testsuites/vstf/vstf_scripts/vstf/common/utils.py
diff options
context:
space:
mode:
authoryuyang <Gabriel.yuyang@huawei.com>2016-10-01 02:21:36 +0800
committeryuyang <Gabriel.yuyang@huawei.com>2016-10-01 02:23:53 +0800
commit6204bfbe6228d5167bdb67c42cac4c884cdcf664 (patch)
treeb67981719c8aa0542e040d70951bdb7aff044aad /testsuites/vstf/vstf_scripts/vstf/common/utils.py
parent3ac496ac711f40f2a4c4fb0837758b4fbade43e4 (diff)
autopep8 fix for flake8
JIRA: BOTTLENECK-101 Using autopep8 to fix the python style scanned by flake8 Change-Id: I74bf28ed4d999dac3dd36e9101f099c9853a49b6 Signed-off-by: yuyang <Gabriel.yuyang@huawei.com>
Diffstat (limited to 'testsuites/vstf/vstf_scripts/vstf/common/utils.py')
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/common/utils.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/testsuites/vstf/vstf_scripts/vstf/common/utils.py b/testsuites/vstf/vstf_scripts/vstf/common/utils.py
index f2e14096..e9ee2791 100644
--- a/testsuites/vstf/vstf_scripts/vstf/common/utils.py
+++ b/testsuites/vstf/vstf_scripts/vstf/common/utils.py
@@ -82,7 +82,7 @@ def my_mkdir(filepath):
try:
LOG.info("mkdir -p %s" % filepath)
os.makedirs(filepath)
- except OSError, e:
+ except OSError as e:
if e.errno == 17:
LOG.info("! %s already exists" % filepath)
else:
@@ -107,7 +107,9 @@ def check_and_kill(process):
def list_mods():
- return check_output("lsmod | sed 1,1d | awk '{print $1}'", shell=True).split()
+ return check_output(
+ "lsmod | sed 1,1d | awk '{print $1}'",
+ shell=True).split()
def check_and_rmmod(mod):
@@ -144,6 +146,7 @@ def randomMAC():
class IPCommandHelper(object):
+
def __init__(self, ns=None):
self.devices = []
self.macs = []
@@ -174,7 +177,10 @@ class IPCommandHelper(object):
cmd = "ip netns exec %s " % ns + cmd
for device in self.devices:
buf = check_output(cmd % device, shell=True)
- bdfs = re.findall(r'^bus-info: \d{4}:(\d{2}:\d{2}\.\d*)$', buf, re.MULTILINE)
+ bdfs = re.findall(
+ r'^bus-info: \d{4}:(\d{2}:\d{2}\.\d*)$',
+ buf,
+ re.MULTILINE)
if bdfs:
self.bdf_device_map[bdfs[0]] = device
self.device_bdf_map[device] = bdfs[0]
@@ -188,7 +194,9 @@ class IPCommandHelper(object):
if ns:
cmd = "ip netns exec %s " % ns + cmd
buf = check_output(cmd, shell=True)
- macs = re.compile(r"[A-F0-9]{2}(?::[A-F0-9]{2}){5}", re.IGNORECASE | re.MULTILINE)
+ macs = re.compile(
+ r"[A-F0-9]{2}(?::[A-F0-9]{2}){5}",
+ re.IGNORECASE | re.MULTILINE)
for mac in macs.findall(buf):
if mac.lower() not in ('00:00:00:00:00:00', 'ff:ff:ff:ff:ff:ff'):
return mac