summaryrefslogtreecommitdiff
path: root/packages/utils.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-11-16 16:20:11 -0600
committerDan McGee <dan@archlinux.org>2012-11-16 16:37:52 -0600
commit6dd4d54bb0adbbb0f8c2b1beaa92b7a58971cf88 (patch)
treece20ff9bf1118c8d383eed352bcdcbf064cb5269 /packages/utils.py
parentb3979dd2315ce1aef779abdb646562d7bba7a44f (diff)
Use Python 2.7 dictionary comprehension syntax
Rather than the old idiom of dict((k, v) for <> in <>). Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/utils.py')
-rw-r--r--packages/utils.py5
1 files changed, 2 insertions, 3 deletions
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