summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/management/commands/reporead.py4
-rw-r--r--devel/management/commands/reporead_inotify.py2
-rw-r--r--mirrors/views.py11
-rw-r--r--packages/templatetags/package_extras.py2
-rw-r--r--packages/utils.py5
-rw-r--r--packages/views/signoff.py8
-rw-r--r--public/views.py2
-rw-r--r--visualize/views.py4
8 files changed, 16 insertions, 22 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py
index a1e77b49..3d4e6375 100644
--- a/devel/management/commands/reporead.py
+++ b/devel/management/commands/reporead.py
@@ -377,7 +377,7 @@ def db_update(archname, reponame, pkgs, force=False):
# This makes our inner loop where we find packages by name *way* more
# efficient by not having to go to the database for each package to
# SELECT them by name.
- dbdict = dict((dbpkg.pkgname, dbpkg) for dbpkg in dbpkgs)
+ dbdict = {dbpkg.pkgname: dbpkg for dbpkg in dbpkgs}
dbset = set(dbdict.keys())
syncset = set([pkg.name for pkg in pkgs])
@@ -446,7 +446,7 @@ def filesonly_update(archname, reponame, pkgs, force=False):
"""
logger.info('Updating files for %s (%s)', reponame, archname)
dbpkgs = update_common(archname, reponame, pkgs, False)
- dbdict = dict((dbpkg.pkgname, dbpkg) for dbpkg in dbpkgs)
+ dbdict = {dbpkg.pkgname: dbpkg for dbpkg in dbpkgs}
dbset = set(dbdict.keys())
for pkg in (pkg for pkg in pkgs if pkg.name in dbset):
diff --git a/devel/management/commands/reporead_inotify.py b/devel/management/commands/reporead_inotify.py
index c74762eb..16b3869c 100644
--- a/devel/management/commands/reporead_inotify.py
+++ b/devel/management/commands/reporead_inotify.py
@@ -69,7 +69,7 @@ class Command(BaseCommand):
finally builds and returns a notifier object.'''
arches = Arch.objects.filter(agnostic=False)
repos = Repo.objects.all()
- arch_path_map = dict((arch, None) for arch in arches)
+ arch_path_map = {arch: None for arch in arches}
all_paths = set()
total_paths = 0
for arch in arches:
diff --git a/mirrors/views.py b/mirrors/views.py
index 2e1e83b6..d0ce0a97 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -94,7 +94,7 @@ def default_protocol_filter(original_urls):
def status_filter(original_urls):
status_info = get_mirror_statuses()
- scores = dict((u.id, u.score) for u in status_info['urls'])
+ scores = {u.id: u.score for u in status_info['urls']}
urls = []
for u in original_urls:
u.score = scores.get(u.id, None)
@@ -165,7 +165,7 @@ def mirrors(request):
if not request.user.is_authenticated():
mirror_list = mirror_list.filter(public=True, active=True)
protos = protos.filter(mirror__public=True, mirror__active=True)
- protos = dict((k, list(v)) for k, v in groupby(protos, key=itemgetter(0)))
+ protos = {k: list(v) for k, v in groupby(protos, key=itemgetter(0))}
for mirror in mirror_list:
items = protos.get(mirror.id, [])
mirror.protocols = [item[1] for item in items]
@@ -253,8 +253,7 @@ class MirrorStatusJSONEncoder(DjangoJSONEncoder):
# mainly for queryset serialization
return list(obj)
if isinstance(obj, MirrorUrl):
- data = dict((attr, getattr(obj, attr))
- for attr in self.url_attributes)
+ data = {attr: getattr(obj, attr) for attr in self.url_attributes}
# get any override on the country attribute first
country = obj.real_country
data['country'] = unicode(country.name)
@@ -277,9 +276,7 @@ class ExtendedMirrorStatusJSONEncoder(MirrorStatusJSONEncoder):
check_time__gte=cutoff).order_by('check_time')
return data
if isinstance(obj, MirrorLog):
- data = dict((attr, getattr(obj, attr))
- for attr in self.log_attributes)
- return data
+ return {attr: getattr(obj, attr) for attr in self.log_attributes}
return super(ExtendedMirrorStatusJSONEncoder, self).default(obj)
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py
index 994265d8..f3613e69 100644
--- a/packages/templatetags/package_extras.py
+++ b/packages/templatetags/package_extras.py
@@ -13,7 +13,7 @@ register = template.Library()
def link_encode(url, query):
# massage the data into all utf-8 encoded strings first, so urlencode
# doesn't barf at the data we pass it
- query = dict((k, unicode(v).encode('utf-8')) for k, v in query.items())
+ query = {k: unicode(v).encode('utf-8') for k, v in query.items()}
data = urlencode(query).replace('&', '&')
return "%s?%s" % (url, data)
diff --git a/packages/utils.py b/packages/utils.py
index 051fed8e..199e141d 100644
--- a/packages/utils.py
+++ b/packages/utils.py
@@ -385,7 +385,7 @@ SELECT DISTINCT s.id
repo_sql = ','.join(['%s' for r in repos])
sql = sql % (model._meta.db_table, repo_sql, repo_sql)
repo_ids = [r.pk for r in repos]
- # repo_ids are needed twice, so double the array
+ # repo_ids are needed twice, so double the array
cursor.execute(sql, repo_ids * 2)
results = cursor.fetchall()
@@ -474,8 +474,7 @@ class PackageJSONEncoder(DjangoJSONEncoder):
# mainly for queryset serialization
return list(obj)
if isinstance(obj, Package):
- data = dict((attr, getattr(obj, attr))
- for attr in self.pkg_attributes)
+ data = {attr: getattr(obj, attr) for attr in self.pkg_attributes}
for attr in self.pkg_list_attributes:
data[attr] = getattr(obj, attr).all()
return data
diff --git a/packages/views/signoff.py b/packages/views/signoff.py
index 56eb060c..824a9922 100644
--- a/packages/views/signoff.py
+++ b/packages/views/signoff.py
@@ -155,8 +155,8 @@ class SignoffJSONEncoder(DjangoJSONEncoder):
def default(self, obj):
if isinstance(obj, PackageSignoffGroup):
- data = dict((attr, getattr(obj, attr))
- for attr in self.signoff_group_attrs)
+ data = {attr: getattr(obj, attr)
+ for attr in self.signoff_group_attrs}
data['pkgnames'] = [p.pkgname for p in obj.packages]
data['package_count'] = len(obj.packages)
data['approved'] = obj.approved()
@@ -164,9 +164,7 @@ class SignoffJSONEncoder(DjangoJSONEncoder):
for attr in self.signoff_spec_attrs)
return data
elif isinstance(obj, Signoff):
- data = dict((attr, getattr(obj, attr))
- for attr in self.signoff_attrs)
- return data
+ return {attr: getattr(obj, attr) for attr in self.signoff_attrs}
elif isinstance(obj, Arch) or isinstance(obj, Repo):
return unicode(obj)
elif isinstance(obj, User):
diff --git a/public/views.py b/public/views.py
index 96120761..3e15f9df 100644
--- a/public/views.py
+++ b/public/views.py
@@ -118,7 +118,7 @@ def keys(request):
sig_counts = PGPSignature.objects.filter(not_expired, valid=True,
signee__in=user_key_ids).values_list('signer').annotate(
Count('signer'))
- sig_counts = dict((key_id[-16:], ct) for key_id, ct in sig_counts)
+ sig_counts = {key_id[-16:]: ct for key_id, ct in sig_counts}
for key in master_keys:
key.signature_count = sig_counts.get(key.pgp_key[-16:], 0)
diff --git a/visualize/views.py b/visualize/views.py
index 8d878937..48e8f86b 100644
--- a/visualize/views.py
+++ b/visualize/views.py
@@ -33,8 +33,8 @@ def arch_repo_data():
# now transform these results into two mappings: one ordered (repo, arch),
# and one ordered (arch, repo).
- arch_groups = dict((a, build_map(a, a, None)) for a in arches)
- repo_groups = dict((r, build_map(r, None, r)) for r in repos)
+ arch_groups = {a: build_map(a, a, None) for a in arches}
+ repo_groups = {r: build_map(r, None, r) for r in repos}
for row in qs:
arch = row['arch__name']
repo = row['repo__name']