Skip to content

Commit

Permalink
Mass PEP8 Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
  • Loading branch information
lmr committed Feb 27, 2015
1 parent c628523 commit 9ccd4b1
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 37 deletions.
3 changes: 2 additions & 1 deletion bonnie/bonnie.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def run_once(self, dir=None, extra_args='', user='root'):
self.results.append(utils.system_output(cmd, retain_output=True))

def postprocess(self):
strip_plus = lambda s: re.sub(r"^\++$", "0", s)
def strip_plus(s):
return re.sub(r"^\++$", "0", s)

keys = ('size', 'chnk', 'seqout_perchr_ksec',
'seqout_perchr_pctcp', 'seqout_perblk_ksec',
Expand Down
2 changes: 1 addition & 1 deletion cgroup/cgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def _stress_cpu(no_cpus):
results_cpu.append(_stress_cpu(no_cpus))

table = utils.matrix_to_string([['results_cpu'] + results_cpu,
['results_find'] + results_find],
['results_find'] + results_find],
['test', '10cgroups', '110cgroups',
'1110cgroups'])
logging.debug("Results matrix for n-cgroups:\n %s" % table)
Expand Down
2 changes: 1 addition & 1 deletion cgroup_tests/cpu_high_load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def cgconfig_file_modify(cgconfig_file, controller_list,
continue
for property in dic_property:
session.sendline("""%s = "%s";""" % (property,
dic_property.get(property)))
dic_property.get(property)))
time.sleep(1)
session.sendline('}')
time.sleep(1)
Expand Down
6 changes: 2 additions & 4 deletions cgroup_tests/memory_migrate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ def test(self):
cgroup_index1 = cgroup.mk_cgroup(cgroup=cgroup_name1)
cgroup_index2 = cgroup.mk_cgroup(cgroup=cgroup_name2)
elif cgroup_create_mode == "cmd":
cgroup_index1 = cgroup.mk_cgroup_cgcreate(cgroup=
cgroup_name1)
cgroup_index2 = cgroup.mk_cgroup_cgcreate(cgroup=
cgroup_name2)
cgroup_index1 = cgroup.mk_cgroup_cgcreate(cgroup=cgroup_name1)
cgroup_index2 = cgroup.mk_cgroup_cgcreate(cgroup=cgroup_name2)

# Set property value
if property_set_mode == "cgset":
Expand Down
2 changes: 1 addition & 1 deletion connectathon/connectathon.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run_once(self, testdir=None, args='', cthon_iterations=1):
args = "-b -t"

self.results = utils.system_output('./runtests -N %s %s %s' %
(cthon_iterations, args, testdir))
(cthon_iterations, args, testdir))
utils.open_write_close(self.results_path, self.results)

except error.CmdError, e:
Expand Down
2 changes: 1 addition & 1 deletion cpuflags/cpuflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def setup(self):
os.makedirs(self.srcdir)
os.chdir(self.srcdir)
utils.system('cp -r %s %s' % (os.path.join(scriptdir, "*"),
self.srcdir))
self.srcdir))
utils.make()
utils.system('sync')

Expand Down
5 changes: 3 additions & 2 deletions ltp/ltp.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ def run_once(self, args='', script='runltp', ignore_tests=[]):
for line in result.stdout.splitlines():
if set(('TFAIL', 'TBROK', 'TWARN')).intersection(line.split()):
test_name = line.strip().split(' ')[0]
if (not test_name in ignore_tests and
not test_name in failed_tests):
if (test_name not in ignore_tests and
test_name not in failed_tests):

failed_tests.append(test_name)

if failed_tests:
Expand Down
12 changes: 6 additions & 6 deletions lvsetup/lvsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ def run_once(self, vg_name='autotest_vg', lv_name='autotest_lv',
else:

# perform normal check policy
if (lv_utils.lv_check(vg_name, lv_snapshot_name)
and lv_utils.lv_check(vg_name, lv_name)):
if (lv_utils.lv_check(vg_name, lv_snapshot_name) and
lv_utils.lv_check(vg_name, lv_name)):
lv_utils.lv_revert(vg_name, lv_name, lv_snapshot_name)
lv_utils.lv_take_snapshot(vg_name, lv_name,
lv_snapshot_name,
lv_snapshot_size)

elif (lv_utils.lv_check(vg_name, lv_snapshot_name)
and not lv_utils.lv_check(vg_name, lv_name)):
elif (lv_utils.lv_check(vg_name, lv_snapshot_name) and
not lv_utils.lv_check(vg_name, lv_name)):
raise error.TestError("Snapshot origin not found")

elif (not lv_utils.lv_check(vg_name, lv_snapshot_name)
and lv_utils.lv_check(vg_name, lv_name)):
elif (not lv_utils.lv_check(vg_name, lv_snapshot_name) and
lv_utils.lv_check(vg_name, lv_name)):
lv_utils.lv_take_snapshot(vg_name, lv_name,
lv_snapshot_name,
lv_snapshot_size)
Expand Down
12 changes: 6 additions & 6 deletions memory_api/memory_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class memory_api(test.test):

def setup(self):
utils.system("%s %s -o %s" %
(utils.get_cc(),
os.path.join(self.bindir, "memory_api.c"),
os.path.join(self.tmpdir, "memory_api")))
(utils.get_cc(),
os.path.join(self.bindir, "memory_api.c"),
os.path.join(self.tmpdir, "memory_api")))
utils.system("%s %s -o %s" %
(utils.get_cc(),
os.path.join(self.bindir, "mremaps.c"),
os.path.join(self.tmpdir, "mremaps")))
(utils.get_cc(),
os.path.join(self.bindir, "mremaps.c"),
os.path.join(self.tmpdir, "mremaps")))

def initialize(self):
self.job.require_gcc()
Expand Down
6 changes: 3 additions & 3 deletions netperf2/netperf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ def client(self, server_ip, test, test_time, num_streams,
Looking for 'within' is probably not the best way to do this but
works for now"""

if ('within' in e.additional_text
or 'non-zero' in e.additional_text):
if ('within' in e.additional_text or
'non-zero' in e.additional_text):
logging.debug(e.additional_text)
self.results.append(None)
self.actual_times.append(1)
Expand All @@ -197,7 +197,7 @@ def postprocess(self):
if self.role == 'client':
# if profilers are enabled, the test gets runs twice
if (len(self.stream_list) != len(self.results) and
2 * len(self.stream_list) != len(self.results)):
2 * len(self.stream_list) != len(self.results)):
raise error.TestError('Mismatched number of results')

function = None
Expand Down
4 changes: 2 additions & 2 deletions netpipe/netpipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def client(self, server_ip, args):
Looking for 'within' is probably not the best way to do this but
works for now"""

if ('within' in e.additional_text
or 'non-zero' in e.additional_text):
if ('within' in e.additional_text or
'non-zero' in e.additional_text):
logging.debug(e.additional_text)
else:
raise
Expand Down
8 changes: 4 additions & 4 deletions regression/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def execute(self, old, new, compare_list):
logging.info('========= Comparison table for %30s '
'=========' % self.tagged_testname)
logging.info("%20s | %10s | %10s | %10s | %10s | %s" %
('field name', 'old value', 'new value',
'cmp res', 'status', 'cmp function'))
('field name', 'old value', 'new value',
'cmp res', 'status', 'cmp function'))
for field, cmpfn in compare_list:
if not field in kv_old:
if field not in kv_old:
raise error.TestError('Cant not find field:%s in %s'
% (field, old + '/keyval'))
if not field in kv_new:
if field not in kv_new:
raise error.TestError('Cant not find field:%s in %s'
% (field, new + '/keyval'))
res = cmpfn(kv_old[field], kv_new[field])
Expand Down
4 changes: 2 additions & 2 deletions stress/stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def run_once(self, args='', stress_length=60):
# Sometimes the default memory used by each memory worker (256 M)
# might make our machine go OOM and then funny things might start to
# happen. Let's avoid that.
mb = (utils_memory.freememtotal()
+ utils_memory.read_from_meminfo('SwapFree') / 2)
mb = (utils_memory.freememtotal() +
utils_memory.read_from_meminfo('SwapFree') / 2)
memory_per_thread = (mb * 1024) / threads

# Even though unlikely, it's good to prevent from allocating more
Expand Down
2 changes: 1 addition & 1 deletion systemtap/systemtap.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def run_once(self):
dejagnu_dir = os.path.join(self.autodir, 'deps/dejagnu/dejagnu')

utils.system('PATH=%s/bin:%s/bin:$PATH make installcheck' %
(self.systemtap_dir, dejagnu_dir))
(self.systemtap_dir, dejagnu_dir))

# After we are done with this iteration, we move the log files to
# the results dir
Expand Down
2 changes: 1 addition & 1 deletion unixbench/unixbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setup(self, tarball='unixbench-4.1.0.tar.bz2'):

def run_once(self, args='', stepsecs=0):
vars = ('TMPDIR=\"%s\" RESULTDIR=\"%s\"' %
(self.tmpdir, self.resultsdir))
(self.tmpdir, self.resultsdir))
if stepsecs:
# change time per subtest from unixbench's defaults of
# 10 secs for small tests, 30 secs for bigger tests
Expand Down
2 changes: 1 addition & 1 deletion wb_kupdate/wb_kupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def run_once(self, mount_point, file_count, write_size,
logging.debug('Flush cache between iterations.')
utils_memory.drop_caches()

# Update the result map.
# Update the result map.
self.result_map[counter] = time_taken.seconds

# Increment the counter.
Expand Down

0 comments on commit 9ccd4b1

Please sign in to comment.