From 1751bdc47f4469b03b60e3e4d73e2b8bf2643240 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 13 Aug 2014 11:21:55 +0200 Subject: [PATCH] Resolve PEP8 issue E231 * E231 missing whitespace after ':' --- osc/build.py | 28 ++++++++++++++-------------- osc/cmdln.py | 2 +- osc/commandline.py | 28 ++++++++++++++-------------- osc/core.py | 20 ++++++++++---------- osc/util/cpio.py | 4 ++-- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/osc/build.py b/osc/build.py index 8a327e1c..d2efc4a2 100644 --- a/osc/build.py +++ b/osc/build.py @@ -53,20 +53,20 @@ qemu_can_build = [ 'armv4l', 'armv5el', 'armv5l', 'armv6l', 'armv7l', 'armv6el', ] can_also_build = { - 'aarch64':['aarch64'], # only needed due to used heuristics in build parameter evaluation - 'armv6l' :[ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], - 'armv7l' :[ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv7el' ], - 'armv5el':[ 'armv4l', 'armv5l', 'armv5el' ], # not existing arch, just for compatibility - 'armv6el':[ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], # not existing arch, just for compatibility - 'armv6hl':[ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], - 'armv7el':[ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv7el' ], # not existing arch, just for compatibility - 'armv7hl':[ 'armv7hl' ], # not existing arch, just for compatibility - 'armv8el':[ 'armv4l', 'armv5el', 'armv6el', 'armv7el', 'armv8el' ], # not existing arch, just for compatibility - 'armv8l' :[ 'armv4l', 'armv5el', 'armv6el', 'armv7el', 'armv8el' ], # not existing arch, just for compatibility - 'armv5tel':[ 'armv4l', 'armv5el', 'armv5tel' ], + 'aarch64': ['aarch64'], # only needed due to used heuristics in build parameter evaluation + 'armv6l': [ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], + 'armv7l': [ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv7el' ], + 'armv5el': [ 'armv4l', 'armv5l', 'armv5el' ], # not existing arch, just for compatibility + 'armv6el': [ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], # not existing arch, just for compatibility + 'armv6hl': [ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], + 'armv7el': [ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv7el' ], # not existing arch, just for compatibility + 'armv7hl': [ 'armv7hl' ], # not existing arch, just for compatibility + 'armv8el': [ 'armv4l', 'armv5el', 'armv6el', 'armv7el', 'armv8el' ], # not existing arch, just for compatibility + 'armv8l': [ 'armv4l', 'armv5el', 'armv6el', 'armv7el', 'armv8el' ], # not existing arch, just for compatibility + 'armv5tel': [ 'armv4l', 'armv5el', 'armv5tel' ], 's390x': ['s390' ], 'ppc64': [ 'ppc', 'ppc64', 'ppc64p7', 'ppc64le' ], - 'ppc64le':[ 'ppc64le' ], + 'ppc64le': [ 'ppc64le' ], 'i586': [ 'i386' ], 'i686': [ 'i586', 'i386' ], 'x86_64': ['i686', 'i586', 'i386' ], @@ -386,7 +386,7 @@ def check_trusted_projects(apiurl, projects): if not prj in trusted: print("\nThe build root needs packages from project '%s'." % prj) print("Note that malicious packages can compromise the build result or even your system.") - r = raw_input(trustprompt % { 'project':prj }) + r = raw_input(trustprompt % { 'project': prj }) if r == '1': print("adding '%s' to ~/.oscrc: ['%s']['trusted_prj']" % (prj, apiurl)) trusted.append(prj) @@ -879,7 +879,7 @@ def main(apiurl, opts, argv): if not m: # short path without obs instance name m = re.match(r"obs://([^/]+)/(.+)", xml.find('source').get('path')) - project=m.group(1).replace(":",":/") + project=m.group(1).replace(":", ":/") repo=m.group(2) buildargs.append('--kiwi-parameter') buildargs.append('--add-repo') diff --git a/osc/cmdln.py b/osc/cmdln.py index 8fa2cc03..71984e62 100644 --- a/osc/cmdln.py +++ b/osc/cmdln.py @@ -1263,7 +1263,7 @@ def _format_linedata(linedata, indent, indent_width): SPACING = 3 MAX_NAME_WIDTH = 15 - NAME_WIDTH = min(max([len(s) for s,d in linedata]), MAX_NAME_WIDTH) + NAME_WIDTH = min(max([len(s) for s, d in linedata]), MAX_NAME_WIDTH) DOC_WIDTH = WIDTH - NAME_WIDTH - SPACING for namestr, doc in linedata: line = indent + namestr diff --git a/osc/commandline.py b/osc/commandline.py index 53d3f325..a9e034de 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -1412,7 +1412,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. if opts.diff: run_pager(rdiff) else: - reqs = get_request_list(apiurl, dst_project, dst_package, req_type='submit', req_state=['new','review']) + reqs = get_request_list(apiurl, dst_project, dst_package, req_type='submit', req_state=['new', 'review']) user = conf.get_apiurl_usr(apiurl) myreqs = [ i for i in reqs if i.state.who == user ] repl = 'y' @@ -1561,7 +1561,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. package = """package="%s" """ % (args[2]) if user.startswith('group:'): - group = user.replace('group:','') + group = user.replace('group:', '') actionxml = """ """ % \ (project, package, group) if get_group(apiurl, group) == None: @@ -1575,7 +1575,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. return actionxml - @cmdln.option('-a', '--action', action='callback', callback = _actionparser,dest = 'actions', + @cmdln.option('-a', '--action', action='callback', callback = _actionparser, dest = 'actions', help='specify action type of a request, can be : submit/delete/change_devel/add_role/set_bugowner') @cmdln.option('-m', '--message', metavar='TEXT', help='specify message TEXT') @@ -1804,7 +1804,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. if package is not None: footer = textwrap.TextWrapper(width = 66).fill( 'please explain why you like to delete package %s of project %s' - % (package,project)) + % (package, project)) else: footer = textwrap.TextWrapper(width = 66).fill( 'please explain why you like to delete project %s' % project) @@ -1856,7 +1856,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. import textwrap footer = textwrap.TextWrapper(width = 66).fill( 'please explain why you like to change the devel project of %s/%s to %s/%s' - % (project,package,devel_project,devel_package)) + % (project, package, devel_project, devel_package)) opts.message = edit_message(footer) r = Request() @@ -2015,11 +2015,11 @@ Please submit there instead, or use --nodevelproject to force direct submission. cmds = ['list', 'log', 'show', 'decline', 'reopen', 'clone', 'accept', 'approvenew', 'wipe', 'setincident', 'supersede', 'revoke', 'checkout', 'co'] if subcmd != 'review' and args[0] not in cmds: raise oscerr.WrongArgs('Unknown request action %s. Choose one of %s.' \ - % (args[0],', '.join(cmds))) + % (args[0], ', '.join(cmds))) cmds = ['show', 'list', 'add', 'decline', 'accept', 'reopen', 'supersede'] if subcmd == 'review' and args[0] not in cmds: raise oscerr.WrongArgs('Unknown review action %s. Choose one of %s.' \ - % (args[0],', '.join(cmds))) + % (args[0], ', '.join(cmds))) cmd = args[0] del args[0] @@ -5684,7 +5684,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. hostprefer = os.path.join( hostpath, basename, - "%s__" % (long_name.replace('-','_')), + "%s__" % (long_name.replace('-', '_')), os.path.basename(os.path.abspath(pdir))) hostargs.append(long_name) hostargs.append(hostprefer) @@ -6512,11 +6512,11 @@ Please submit there instead, or use --nodevelproject to force direct submission. requests = [] # open reviews u = makeurl(apiurl, ['request'], { - 'view' : 'collection', + 'view': 'collection', 'states': 'review', 'reviewstates': 'new', 'roles': 'reviewer', - 'user' : user, + 'user': user, }) f = http_GET(u) root = ET.parse(f).getroot() @@ -6529,10 +6529,10 @@ Please submit there instead, or use --nodevelproject to force direct submission. print("") # open requests u = makeurl(apiurl, ['request'], { - 'view' : 'collection', + 'view': 'collection', 'states': 'new', 'roles': 'maintainer', - 'user' : user, + 'user': user, }) f = http_GET(u) root = ET.parse(f).getroot() @@ -6545,10 +6545,10 @@ Please submit there instead, or use --nodevelproject to force direct submission. print("") # declined requests submitted by me u = makeurl(apiurl, ['request'], { - 'view' : 'collection', + 'view': 'collection', 'states': 'declined', 'roles': 'creator', - 'user' : user, + 'user': user, }) f = http_GET(u) root = ET.parse(f).getroot() diff --git a/osc/core.py b/osc/core.py index 31fa0174..e60813ce 100644 --- a/osc/core.py +++ b/osc/core.py @@ -4171,7 +4171,7 @@ def check_existing_requests(apiurl, src_project, src_package, dst_project, reqs = get_exact_request_list(apiurl, src_project, dst_project, src_package, dst_package, req_type='submit', - req_state=['new','review', 'declined']) + req_state=['new', 'review', 'declined']) repl = '' if reqs: print('There are already the following submit request: %s.' % \ @@ -4238,7 +4238,7 @@ def download(url, filename, progress_obj = None, mtime = None): try: o = os.fdopen(fd, 'wb') for buf in streamfile(url, http_GET, BUFSIZE, progress_obj=progress_obj): - o.write(bytes(buf,"utf-8")) + o.write(bytes(buf, "utf-8")) o.close() os.rename(tmpfile, filename) except: @@ -5069,12 +5069,12 @@ def get_distibutions(apiurl, discon=False): for node in root.findall('entry'): if node.get('name').startswith('DISCONTINUED:'): rmap = {} - rmap['name'] = node.get('name').replace('DISCONTINUED:','').replace(':', ' ') + rmap['name'] = node.get('name').replace('DISCONTINUED:', '').replace(':', ' ') rmap['project'] = node.get('name') r.append (result_line_templ % rmap) - r.insert(0,'distribution project') - r.insert(1,'------------ -------') + r.insert(0, 'distribution project') + r.insert(1, '------------ -------') else: result_line_templ = '%(name)-25s %(project)-25s %(repository)-25s %(reponame)s' @@ -5093,8 +5093,8 @@ def get_distibutions(apiurl, discon=False): rmap['reponame'] = node5.text r.append(result_line_templ % rmap) - r.insert(0,'distribution project repository reponame') - r.insert(1,'------------ ------- ---------- --------') + r.insert(0, 'distribution project repository reponame') + r.insert(1, '------------ ------- ---------- --------') return r @@ -5606,7 +5606,7 @@ def get_source_rev(apiurl, project, package, revision=None): # CAUTION: We have to loop through all rev and find the highest one, if none given. if revision: - url = makeurl(apiurl, ['source', project, package, '_history'], {'rev':revision}) + url = makeurl(apiurl, ['source', project, package, '_history'], {'rev': revision}) else: url = makeurl(apiurl, ['source', project, package, '_history']) f = http_GET(url) @@ -5619,7 +5619,7 @@ def get_source_rev(apiurl, project, package, revision=None): elif ent.find('time').text < new.find('time').text: ent = new if not ent: - return { 'version': None, 'error':'empty revisionlist: no such package?' } + return { 'version': None, 'error': 'empty revisionlist: no such package?' } e = {} for k in ent.keys(): e[k] = ent.get(k) @@ -6312,7 +6312,7 @@ def setBugowner(apiurl, prj, pac, user=None, group=None): template_args=None, create_new=False) if user.startswith('group:'): - group=user.replace('group:','') + group=user.replace('group:', '') user=None if data: root = ET.fromstring(''.join(data)) diff --git a/osc/util/cpio.py b/osc/util/cpio.py index 44351ead..cd3c4065 100644 --- a/osc/util/cpio.py +++ b/osc/util/cpio.py @@ -64,7 +64,7 @@ class CpioHdr: self.namesize = namesize # != 0 indicates CRC format (which we do not support atm) self.checksum = checksum - for k,v in self.__dict__.items(): + for k, v in self.__dict__.items(): self.__dict__[k] = int(v, 16) self.filename = filename # data starts at dataoff and ends at dataoff+filesize @@ -82,7 +82,7 @@ class CpioRead: # supported formats - use name -> mgc mapping to increase readabilty sfmt = { - 'newascii' : '070701', + 'newascii': '070701', } # header format