consistently use dictionary literals

Aside from not using two different idioms for the same thing, it
performs better (not noticeably in our case, but hey).

Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Nils Philippsen 2019-11-25 13:58:02 +01:00
parent 743b3aaca3
commit 247ede734b

View file

@ -181,23 +181,20 @@ class BugzillaProxy:
# Format that bugzilla will understand. Strip None's that
# segment() pads out the final data segment() with
query = [
dict(
product=bz_product_name,
component=p
)
{'product': bz_product_name, 'component': p}
for p in pkg_segment
if p is not None
]
raw_data = self.server._proxy.Component.get(dict(names=query))
raw_data = self.server._proxy.Component.get({'names': query})
for package in raw_data['components']:
# Reformat data to be the same as what's returned from
# getcomponentsdetails
product_info = dict(
initialowner=package['default_assignee'],
description=package['description'],
initialqacontact=package['default_qa_contact'],
initialcclist=package['default_cc']
)
product_info = {
'initialowner': package['default_assignee'],
'description': package['description'],
'initialqacontact': package['default_qa_contact'],
'initialcclist': package['default_cc'],
}
product_info_by_pkg[package['name'].lower()] = product_info
self.product_cache[collection] = product_info_by_pkg
@ -472,10 +469,10 @@ def _get_pdc_branches(session, repo):
:return: a list of the repo's branches
"""
branches_url = '{0}component-branches/'.format(env['pdc_url'])
params = dict(
global_component=repo['name'],
type=env['pdc_types'][repo['namespace']]
)
params = {
'global_component': repo['name'],
'type': env['pdc_types'][repo['namespace']],
}
if config["verbose"]:
print('Querying {0} {1}'.format(branches_url, params))
rv = session.get(branches_url, params=params, timeout=60)
@ -659,12 +656,12 @@ class DistgitBugzillaSync:
for namespace, entries in pagure_namespace_to_poc.items():
for name, poc in entries.items():
if not project_list or (namespace, name) in project_list:
self.pagure_projects.append(dict(
namespace=namespace,
name=name,
poc=poc,
watchers=pagure_namespace_to_cc[namespace][name],
))
self.pagure_projects.append({
'namespace': namespace,
'name': name,
'poc': poc,
'watchers': pagure_namespace_to_cc[namespace][name],
})
@property
def namespace_to_product(self):