Skip to content

Commit

Permalink
Resolve PEP8 issue E231
Browse files Browse the repository at this point in the history
* E231 missing whitespace after ':'
  • Loading branch information
berendt committed Aug 13, 2014
1 parent 902adde commit b4d23f8
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 41 deletions.
28 changes: 14 additions & 14 deletions osc/build.py
Expand Up @@ -53,20 +53,20 @@
]

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' ],
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -879,7 +879,7 @@ def __str__(self):
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')
Expand Down
2 changes: 1 addition & 1 deletion osc/cmdln.py
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions osc/commandline.py
Expand Up @@ -1414,7 +1414,7 @@ def _submit_request(self, args, opts, options_block):
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'
Expand Down Expand Up @@ -1563,7 +1563,7 @@ def _set_bugowner(self, args, opts):
package = """package="%s" """ % (args[2])

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> """ % \
(project, package, group)
if get_group(apiurl, group) == None:
Expand All @@ -1577,7 +1577,7 @@ def _set_bugowner(self, args, opts):

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')
Expand Down Expand Up @@ -1806,7 +1806,7 @@ def do_deleterequest(self, subcmd, opts, *args):
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)
Expand Down Expand Up @@ -1858,7 +1858,7 @@ def do_changedevelrequest(self, subcmd, opts, *args):
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()
Expand Down Expand Up @@ -2017,11 +2017,11 @@ def do_request(self, subcmd, opts, *args):
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]
Expand Down Expand Up @@ -5686,7 +5686,7 @@ def rsync_dirs_2host(hostargs, short_name, long_name, dirs):
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)
Expand Down Expand Up @@ -6514,11 +6514,11 @@ def do_my(self, subcmd, opts, *args):
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()
Expand All @@ -6531,10 +6531,10 @@ def do_my(self, subcmd, opts, *args):
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()
Expand All @@ -6547,10 +6547,10 @@ def do_my(self, subcmd, opts, *args):
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()
Expand Down
20 changes: 10 additions & 10 deletions osc/core.py
Expand Up @@ -4169,7 +4169,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.' % \
Expand Down Expand Up @@ -4236,7 +4236,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:
Expand Down Expand Up @@ -5067,12 +5067,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'
Expand All @@ -5091,8 +5091,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

Expand Down Expand Up @@ -5604,7 +5604,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)
Expand All @@ -5617,7 +5617,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)
Expand Down Expand Up @@ -6310,7 +6310,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))
Expand Down
4 changes: 2 additions & 2 deletions osc/util/cpio.py
Expand Up @@ -64,7 +64,7 @@ def __init__(self, mgc, ino, mode, uid, gid, nlink, mtime, filesize,
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
Expand All @@ -82,7 +82,7 @@ class CpioRead:

# supported formats - use name -> mgc mapping to increase readabilty
sfmt = {
'newascii' : '070701',
'newascii': '070701',
}

# header format
Expand Down

0 comments on commit b4d23f8

Please sign in to comment.