Some PEP8 fixes.

This commit is contained in:
Alberto Planas 2014-09-01 09:43:44 +02:00
parent 01a8509b63
commit 49a257cc6a
6 changed files with 23 additions and 23 deletions

View File

@ -94,7 +94,7 @@ def _check_repo_download(self, request):
_errors_printed = set()
def _check_repo_group(self, id_, requests, debug = False):
def _check_repo_group(self, id_, requests, debug=False):
print '> Check group [%s]' % ', '.join(r.str_compact() for r in requests)
if not all(self.checkrepo.is_buildsuccess(r) for r in requests if r.action_type != 'delete'):
@ -227,7 +227,7 @@ def _check_repo_group(self, id_, requests, debug = False):
if not all_good_downloads:
print ' - No matching downloads for disturl found.'
if len(packs) == 1 and packs[0].src_package in ('rpmlint-tests'):
print " - %s known to have no installable rpms, skipped"%packs[0].src_package
print ' - %s known to have no installable rpms, skipped' % packs[0].src_package
return
for project, repo in all_good_downloads:
@ -309,7 +309,7 @@ def _check_repo_group(self, id_, requests, debug = False):
# There are several execution plans, each one can have its own
# error message.
if ret:
print ' - Execution plan for %s failed'%str(project_repo)
print ' - Execution plan for %s failed' % str(project_repo)
else:
print ' - Successful plan', project_repo
@ -400,7 +400,7 @@ def do_check_repo(self, subcmd, opts, *args):
${cmd_option_list}
"""
self.checkrepo = CheckRepo(self.get_api_url(), opts.project, readonly = opts.dry, debug=opts.verbose)
self.checkrepo = CheckRepo(self.get_api_url(), opts.project, readonly=opts.dry, debug=opts.verbose)
if opts.skip:
if not len(args):

View File

@ -28,7 +28,7 @@ class AcceptCommand(object):
for t in targets:
pkgs.append(str(t.get('package')))
rqs.append({ 'id': int(rq.get('id')), 'packages': pkgs })
rqs.append({'id': int(rq.get('id')), 'packages': pkgs})
return rqs
def perform(self, project):
@ -41,7 +41,7 @@ class AcceptCommand(object):
status = self.api.check_project_status(project)
if not status:
print('The project "{0}" is not yet acceptable.'.format(project))
print('The project "{}" is not yet acceptable.'.format(project))
return False
meta = self.api.get_prj_pseudometa(project)
@ -51,7 +51,7 @@ class AcceptCommand(object):
self.api.rm_from_prj(project, request_id=req['id'], msg='ready to accept')
requests.append(req['id'])
packages.append(req['package'])
msg = 'Accepting staging review for {0}'.format(req['package'])
msg = 'Accepting staging review for {}'.format(req['package'])
print(msg)
for req in requests:
@ -60,22 +60,22 @@ class AcceptCommand(object):
# A single comment should be enough to notify everybody, since they are
# already mentioned in the comments created by select/unselect
pkg_list = ", ".join(packages)
cmmt = 'Project "{0}" accepted. The following packages have been submitted to factory: {1}.'.format(project, pkg_list)
cmmt = 'Project "{}" accepted. The following packages have been submitted to factory: {}.'.format(project, pkg_list)
self.comment.add_comment(project_name=project, comment=cmmt)
# XXX CAUTION - AFAIK the 'accept' command is expected to clean the messages here.
self.comment.delete_from(project_name=project)
self.api.build_switch_prj(project, 'disable')
if self.api.project_exists(project + ":DVD"):
self.api.build_switch_prj(project + ":DVD", 'disable')
if self.api.project_exists(project + ':DVD'):
self.api.build_switch_prj(project + ':DVD', 'disable')
return True
def accept_other_new(self):
changed = False
for req in self.find_new_requests('openSUSE:{}'.format(self.api.opensuse)):
print "accepting request %d: %s"%(req['id'], ','.join(req['packages']))
print 'Accepting request %d: %s' % (req['id'], ','.join(req['packages']))
change_request_state(self.api.apiurl, str(req['id']), 'accepted', message='Accept to factory')
changed = True
@ -91,4 +91,4 @@ class AcceptCommand(object):
new_product = re.sub(r'<version>\d{8}</version>', '<version>%s</version>' % curr_version, product)
if product != new_product:
http_PUT(url + "?comment=Update+version", data=new_product)
http_PUT(url + '?comment=Update+version', data=new_product)

View File

@ -119,7 +119,7 @@ class Request(object):
class CheckRepo(object):
def __init__(self, apiurl, opensuse='Factory', readonly = False, debug = False):
def __init__(self, apiurl, opensuse='Factory', readonly=False, debug=False):
"""CheckRepo constructor."""
self.apiurl = apiurl
self.opensuse = opensuse
@ -136,7 +136,7 @@ class CheckRepo(object):
def debug(self, *args):
if not self.debug_enable:
return
print ' '.join([ i if isinstance(i, basestring) else pformat(i) for i in args ])
print ' '.join([i if isinstance(i, basestring) else pformat(i) for i in args])
def _staging(self):
"""Preload the groups of related request associated by the same
@ -196,7 +196,7 @@ class CheckRepo(object):
code = 404
url = makeurl(self.apiurl, ('request', str(request_id)), query=query)
if self.readonly:
print "DRY RUN: POST %s"%url
print 'DRY RUN: POST %s' % url
return 200
try:
root = ET.parse(http_POST(url, data=message)).getroot()
@ -912,14 +912,14 @@ class CheckRepo(object):
if request.is_shadow_devel:
url = makeurl(self.apiurl, ('source', request.shadow_src_project, request.src_package))
if self.readonly:
print "DRY RUN: DELETE %s"%url
print 'DRY RUN: DELETE %s' % url
else:
http_DELETE(url)
for sub_prj, sub_pkg in self.staging.get_sub_packages(request.src_package,
request.shadow_src_project):
url = makeurl(self.apiurl, ('source', sub_prj, sub_pkg))
if self.readonly:
print "DRY RUN: DELETE %s"%url
print 'DRY RUN: DELETE %s' % url
else:
http_DELETE(url)

View File

@ -93,7 +93,7 @@ class FreezeCommand(object):
for result in root.findall('result'):
if result.get('repository') == 'bootstrap_copy':
status = result.find('status')
if status == None:
if status is None:
return False
if not status.get('code') in codes:
return False

View File

@ -321,7 +321,7 @@ class StagingAPI(object):
where = "@by_group='factory-staging'+and+@state='new'"
target = "@project='openSUSE:{}'".format(self.opensuse)
query = "match=state/@name='review'+and+review[{}]+and+target[{}]".format(where,target)
query = "match=state/@name='review'+and+review[{}]+and+target[{}]".format(where, target)
url = self.makeurl(['search', 'request'], query)
f = http_GET(url)
root = ET.parse(f).getroot()