1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

Resolve PEP8 issue E231

* E231 missing whitespace after ':'
This commit is contained in:
Christian Berendt 2014-08-13 11:21:55 +02:00 committed by Marcus Huewe
parent 1b6e2ac745
commit 1751bdc47f
5 changed files with 41 additions and 41 deletions

View File

@ -53,20 +53,20 @@ qemu_can_build = [ 'armv4l', 'armv5el', 'armv5l', 'armv6l', 'armv7l', 'armv6el',
] ]
can_also_build = { can_also_build = {
'aarch64':['aarch64'], # only needed due to used heuristics in build parameter evaluation 'aarch64': ['aarch64'], # only needed due to used heuristics in build parameter evaluation
'armv6l' :[ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], 'armv6l': [ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ],
'armv7l' :[ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv7el' ], 'armv7l': [ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv7el' ],
'armv5el':[ 'armv4l', 'armv5l', 'armv5el' ], # not existing arch, just for compatibility 'armv5el': [ 'armv4l', 'armv5l', 'armv5el' ], # not existing arch, just for compatibility
'armv6el':[ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], # not existing arch, just for compatibility 'armv6el': [ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], # not existing arch, just for compatibility
'armv6hl':[ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ], 'armv6hl': [ 'armv4l', 'armv5l', 'armv6l', 'armv5el', 'armv6el' ],
'armv7el':[ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv7el' ], # not existing arch, just for compatibility 'armv7el': [ 'armv4l', 'armv5l', 'armv6l', 'armv7l', 'armv5el', 'armv6el', 'armv7el' ], # not existing arch, just for compatibility
'armv7hl':[ 'armv7hl' ], # 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 'armv8el': [ 'armv4l', 'armv5el', 'armv6el', 'armv7el', 'armv8el' ], # not existing arch, just for compatibility
'armv8l' :[ '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' ], 'armv5tel': [ 'armv4l', 'armv5el', 'armv5tel' ],
's390x': ['s390' ], 's390x': ['s390' ],
'ppc64': [ 'ppc', 'ppc64', 'ppc64p7', 'ppc64le' ], 'ppc64': [ 'ppc', 'ppc64', 'ppc64p7', 'ppc64le' ],
'ppc64le':[ 'ppc64le' ], 'ppc64le': [ 'ppc64le' ],
'i586': [ 'i386' ], 'i586': [ 'i386' ],
'i686': [ 'i586', 'i386' ], 'i686': [ 'i586', 'i386' ],
'x86_64': ['i686', 'i586', 'i386' ], 'x86_64': ['i686', 'i586', 'i386' ],
@ -386,7 +386,7 @@ def check_trusted_projects(apiurl, projects):
if not prj in trusted: if not prj in trusted:
print("\nThe build root needs packages from project '%s'." % prj) print("\nThe build root needs packages from project '%s'." % prj)
print("Note that malicious packages can compromise the build result or even your system.") 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': if r == '1':
print("adding '%s' to ~/.oscrc: ['%s']['trusted_prj']" % (prj, apiurl)) print("adding '%s' to ~/.oscrc: ['%s']['trusted_prj']" % (prj, apiurl))
trusted.append(prj) trusted.append(prj)
@ -879,7 +879,7 @@ def main(apiurl, opts, argv):
if not m: if not m:
# short path without obs instance name # short path without obs instance name
m = re.match(r"obs://([^/]+)/(.+)", xml.find('source').get('path')) m = re.match(r"obs://([^/]+)/(.+)", xml.find('source').get('path'))
project=m.group(1).replace(":",":/") project=m.group(1).replace(":", ":/")
repo=m.group(2) repo=m.group(2)
buildargs.append('--kiwi-parameter') buildargs.append('--kiwi-parameter')
buildargs.append('--add-repo') buildargs.append('--add-repo')

View File

@ -1263,7 +1263,7 @@ def _format_linedata(linedata, indent, indent_width):
SPACING = 3 SPACING = 3
MAX_NAME_WIDTH = 15 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 DOC_WIDTH = WIDTH - NAME_WIDTH - SPACING
for namestr, doc in linedata: for namestr, doc in linedata:
line = indent + namestr line = indent + namestr

View File

@ -1412,7 +1412,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.diff: if opts.diff:
run_pager(rdiff) run_pager(rdiff)
else: 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) user = conf.get_apiurl_usr(apiurl)
myreqs = [ i for i in reqs if i.state.who == user ] myreqs = [ i for i in reqs if i.state.who == user ]
repl = 'y' repl = 'y'
@ -1561,7 +1561,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
package = """package="%s" """ % (args[2]) package = """package="%s" """ % (args[2])
if user.startswith('group:'): if user.startswith('group:'):
group = user.replace('group:','') group = user.replace('group:', '')
actionxml = """ <action type="set_bugowner"> <target project="%s" %s /> <group name="%s" /> </action> """ % \ actionxml = """ <action type="set_bugowner"> <target project="%s" %s /> <group name="%s" /> </action> """ % \
(project, package, group) (project, package, group)
if get_group(apiurl, group) == None: if get_group(apiurl, group) == None:
@ -1575,7 +1575,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
return actionxml 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') help='specify action type of a request, can be : submit/delete/change_devel/add_role/set_bugowner')
@cmdln.option('-m', '--message', metavar='TEXT', @cmdln.option('-m', '--message', metavar='TEXT',
help='specify message 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: if package is not None:
footer = textwrap.TextWrapper(width = 66).fill( footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to delete package %s of project %s' 'please explain why you like to delete package %s of project %s'
% (package,project)) % (package, project))
else: else:
footer = textwrap.TextWrapper(width = 66).fill( footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to delete project %s' % project) '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 import textwrap
footer = textwrap.TextWrapper(width = 66).fill( footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to change the devel project of %s/%s to %s/%s' '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) opts.message = edit_message(footer)
r = Request() 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'] cmds = ['list', 'log', 'show', 'decline', 'reopen', 'clone', 'accept', 'approvenew', 'wipe', 'setincident', 'supersede', 'revoke', 'checkout', 'co']
if subcmd != 'review' and args[0] not in cmds: if subcmd != 'review' and args[0] not in cmds:
raise oscerr.WrongArgs('Unknown request action %s. Choose one of %s.' \ 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'] cmds = ['show', 'list', 'add', 'decline', 'accept', 'reopen', 'supersede']
if subcmd == 'review' and args[0] not in cmds: if subcmd == 'review' and args[0] not in cmds:
raise oscerr.WrongArgs('Unknown review action %s. Choose one of %s.' \ raise oscerr.WrongArgs('Unknown review action %s. Choose one of %s.' \
% (args[0],', '.join(cmds))) % (args[0], ', '.join(cmds)))
cmd = args[0] cmd = args[0]
del args[0] del args[0]
@ -5684,7 +5684,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
hostprefer = os.path.join( hostprefer = os.path.join(
hostpath, hostpath,
basename, basename,
"%s__" % (long_name.replace('-','_')), "%s__" % (long_name.replace('-', '_')),
os.path.basename(os.path.abspath(pdir))) os.path.basename(os.path.abspath(pdir)))
hostargs.append(long_name) hostargs.append(long_name)
hostargs.append(hostprefer) hostargs.append(hostprefer)
@ -6512,11 +6512,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
requests = [] requests = []
# open reviews # open reviews
u = makeurl(apiurl, ['request'], { u = makeurl(apiurl, ['request'], {
'view' : 'collection', 'view': 'collection',
'states': 'review', 'states': 'review',
'reviewstates': 'new', 'reviewstates': 'new',
'roles': 'reviewer', 'roles': 'reviewer',
'user' : user, 'user': user,
}) })
f = http_GET(u) f = http_GET(u)
root = ET.parse(f).getroot() root = ET.parse(f).getroot()
@ -6529,10 +6529,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print("") print("")
# open requests # open requests
u = makeurl(apiurl, ['request'], { u = makeurl(apiurl, ['request'], {
'view' : 'collection', 'view': 'collection',
'states': 'new', 'states': 'new',
'roles': 'maintainer', 'roles': 'maintainer',
'user' : user, 'user': user,
}) })
f = http_GET(u) f = http_GET(u)
root = ET.parse(f).getroot() root = ET.parse(f).getroot()
@ -6545,10 +6545,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print("") print("")
# declined requests submitted by me # declined requests submitted by me
u = makeurl(apiurl, ['request'], { u = makeurl(apiurl, ['request'], {
'view' : 'collection', 'view': 'collection',
'states': 'declined', 'states': 'declined',
'roles': 'creator', 'roles': 'creator',
'user' : user, 'user': user,
}) })
f = http_GET(u) f = http_GET(u)
root = ET.parse(f).getroot() root = ET.parse(f).getroot()

View File

@ -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, reqs = get_exact_request_list(apiurl, src_project, dst_project,
src_package, dst_package, src_package, dst_package,
req_type='submit', req_type='submit',
req_state=['new','review', 'declined']) req_state=['new', 'review', 'declined'])
repl = '' repl = ''
if reqs: if reqs:
print('There are already the following submit request: %s.' % \ print('There are already the following submit request: %s.' % \
@ -4238,7 +4238,7 @@ def download(url, filename, progress_obj = None, mtime = None):
try: try:
o = os.fdopen(fd, 'wb') o = os.fdopen(fd, 'wb')
for buf in streamfile(url, http_GET, BUFSIZE, progress_obj=progress_obj): 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() o.close()
os.rename(tmpfile, filename) os.rename(tmpfile, filename)
except: except:
@ -5069,12 +5069,12 @@ def get_distibutions(apiurl, discon=False):
for node in root.findall('entry'): for node in root.findall('entry'):
if node.get('name').startswith('DISCONTINUED:'): if node.get('name').startswith('DISCONTINUED:'):
rmap = {} rmap = {}
rmap['name'] = node.get('name').replace('DISCONTINUED:','').replace(':', ' ') rmap['name'] = node.get('name').replace('DISCONTINUED:', '').replace(':', ' ')
rmap['project'] = node.get('name') rmap['project'] = node.get('name')
r.append (result_line_templ % rmap) r.append (result_line_templ % rmap)
r.insert(0,'distribution project') r.insert(0, 'distribution project')
r.insert(1,'------------ -------') r.insert(1, '------------ -------')
else: else:
result_line_templ = '%(name)-25s %(project)-25s %(repository)-25s %(reponame)s' 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 rmap['reponame'] = node5.text
r.append(result_line_templ % rmap) r.append(result_line_templ % rmap)
r.insert(0,'distribution project repository reponame') r.insert(0, 'distribution project repository reponame')
r.insert(1,'------------ ------- ---------- --------') r.insert(1, '------------ ------- ---------- --------')
return r 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. # CAUTION: We have to loop through all rev and find the highest one, if none given.
if revision: if revision:
url = makeurl(apiurl, ['source', project, package, '_history'], {'rev':revision}) url = makeurl(apiurl, ['source', project, package, '_history'], {'rev': revision})
else: else:
url = makeurl(apiurl, ['source', project, package, '_history']) url = makeurl(apiurl, ['source', project, package, '_history'])
f = http_GET(url) 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: elif ent.find('time').text < new.find('time').text:
ent = new ent = new
if not ent: if not ent:
return { 'version': None, 'error':'empty revisionlist: no such package?' } return { 'version': None, 'error': 'empty revisionlist: no such package?' }
e = {} e = {}
for k in ent.keys(): for k in ent.keys():
e[k] = ent.get(k) e[k] = ent.get(k)
@ -6312,7 +6312,7 @@ def setBugowner(apiurl, prj, pac, user=None, group=None):
template_args=None, template_args=None,
create_new=False) create_new=False)
if user.startswith('group:'): if user.startswith('group:'):
group=user.replace('group:','') group=user.replace('group:', '')
user=None user=None
if data: if data:
root = ET.fromstring(''.join(data)) root = ET.fromstring(''.join(data))

View File

@ -64,7 +64,7 @@ class CpioHdr:
self.namesize = namesize self.namesize = namesize
# != 0 indicates CRC format (which we do not support atm) # != 0 indicates CRC format (which we do not support atm)
self.checksum = checksum self.checksum = checksum
for k,v in self.__dict__.items(): for k, v in self.__dict__.items():
self.__dict__[k] = int(v, 16) self.__dict__[k] = int(v, 16)
self.filename = filename self.filename = filename
# data starts at dataoff and ends at dataoff+filesize # data starts at dataoff and ends at dataoff+filesize
@ -82,7 +82,7 @@ class CpioRead:
# supported formats - use name -> mgc mapping to increase readabilty # supported formats - use name -> mgc mapping to increase readabilty
sfmt = { sfmt = {
'newascii' : '070701', 'newascii': '070701',
} }
# header format # header format