flake8: apply E70x rule

This commit is contained in:
Yuming Zhu 2020-02-26 04:20:48 +08:00
parent 6dd77e0fa4
commit fa69c4904e
6 changed files with 41 additions and 21 deletions

View file

@ -1,5 +1,5 @@
[flake8]
select = I,C,F,E1,E2,E3,E4,E502
select = I,C,F,E1,E2,E3,E4,E502,E70
ignore = E266
exclude =
.git,

View file

@ -3164,17 +3164,23 @@ class LiveCDTask(ImageTask):
# image metadata
id = iso.get_application_id()
if id is not None: fd.write("Application ID: %s\n" % id)
if id is not None:
fd.write("Application ID: %s\n" % id)
id = iso.get_preparer_id()
if id is not None: fd.write("Preparer ID: %s\n" % id)
if id is not None:
fd.write("Preparer ID: %s\n" % id)
id = iso.get_publisher_id()
if id is not None: fd.write("Publisher ID: %s\n" % id)
if id is not None:
fd.write("Publisher ID: %s\n" % id)
id = iso.get_system_id()
if id is not None: fd.write("System ID: %s\n" % id)
if id is not None:
fd.write("System ID: %s\n" % id)
id = iso.get_volume_id()
if id is not None: fd.write("Volume ID: %s\n" % id)
if id is not None:
fd.write("Volume ID: %s\n" % id)
id = iso.get_volumeset_id()
if id is not None: fd.write("Volumeset ID: %s\n" % id)
if id is not None:
fd.write("Volumeset ID: %s\n" % id)
fd.write('\nSize(bytes) File Name\n')
manifest = self.listISODir(iso, '/')
@ -3344,17 +3350,23 @@ class LiveMediaTask(ImageTask):
# image metadata
id = iso.get_application_id()
if id is not None: fd.write("Application ID: %s\n" % id)
if id is not None:
fd.write("Application ID: %s\n" % id)
id = iso.get_preparer_id()
if id is not None: fd.write("Preparer ID: %s\n" % id)
if id is not None:
fd.write("Preparer ID: %s\n" % id)
id = iso.get_publisher_id()
if id is not None: fd.write("Publisher ID: %s\n" % id)
if id is not None:
fd.write("Publisher ID: %s\n" % id)
id = iso.get_system_id()
if id is not None: fd.write("System ID: %s\n" % id)
if id is not None:
fd.write("System ID: %s\n" % id)
id = iso.get_volume_id()
if id is not None: fd.write("Volume ID: %s\n" % id)
if id is not None:
fd.write("Volume ID: %s\n" % id)
id = iso.get_volumeset_id()
if id is not None: fd.write("Volumeset ID: %s\n" % id)
if id is not None:
fd.write("Volumeset ID: %s\n" % id)
fd.write('\nSize(bytes) File Name\n')
manifest = self.listISODir(iso, '/')

View file

@ -2799,8 +2799,10 @@ def anon_handle_list_hosts(goptions, session, args):
hosts = [x[1] for x in tmp_list]
def yesno(x):
if x: return 'Y'
else: return 'N'
if x:
return 'Y'
else:
return 'N'
# pull in the last update using multicall to speed it up a bit
session.multicall = True

View file

@ -10093,7 +10093,8 @@ class RootExports(object):
sum_cls = get_verify_class(verify)
if offset != -1:
if size is not None:
if size != len(contents): return False
if size != len(contents):
return False
if verify is not None:
if digest != sum_cls(contents).hexdigest():
return False
@ -10153,7 +10154,8 @@ class RootExports(object):
os.lseek(fd, 0, 0)
while True:
block = os.read(fd, 819200)
if not block: break
if not block:
break
chksum.update(block)
if digest != chksum.hexdigest():
return False

View file

@ -187,8 +187,10 @@ class Rpmdiff:
oldflags = old[name[:-1] + 'FLAGS']
newflags = new[name[:-1] + 'FLAGS']
# fix buggy rpm binding not returning list for single entries
if not isinstance(oldflags, list): oldflags = [oldflags]
if not isinstance(newflags, list): newflags = [newflags]
if not isinstance(oldflags, list):
oldflags = [oldflags]
if not isinstance(newflags, list):
newflags = [newflags]
o = list(zip(old[name], oldflags, old[name[:-1] + 'VERSION']))
n = list(zip(new[name], newflags, new[name[:-1] + 'VERSION']))

View file

@ -756,7 +756,8 @@ class TaskResultLine(object):
if length is None:
line_text += fragment.composer()
else:
if size >= length: break
if size >= length:
break
remainder_size = length - size
line_text += fragment.composer(remainder_size)
size += fragment.size
@ -864,7 +865,8 @@ def task_result_to_html(result=None, exc_class=None,
line.end_tag)
first_part_len = len('%s = ') + key_fragment.size
remainder_len = length - first_part_len
if remainder_len < 0: remainder_len = 0
if remainder_len < 0:
remainder_len = 0
return '%s%s = %s%s%s' % (
line.begin_tag, key_fragment.composer(),