summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-11-16 16:37:31 -0600
committerDan McGee <dan@archlinux.org>2012-11-16 16:37:53 -0600
commit9e9157d0a8cbf9ea076231e438fb30f58bff8e29 (patch)
tree5c9a9711003d6eb4e5396c1c730a912bbbfc2204
parent6dd4d54bb0adbbb0f8c2b1beaa92b7a58971cf88 (diff)
downloadarchweb-9e9157d0a8cbf9ea076231e438fb30f58bff8e29.tar.gz
archweb-9e9157d0a8cbf9ea076231e438fb30f58bff8e29.zip
Use python set comprehension syntax supported in 2.7
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--devel/management/commands/import_signatures.py4
-rw-r--r--devel/management/commands/reporead.py2
-rw-r--r--devel/management/commands/reporead_inotify.py2
-rw-r--r--devel/views.py4
-rw-r--r--main/models.py2
-rw-r--r--packages/models.py2
-rw-r--r--packages/utils.py10
-rw-r--r--packages/views/signoff.py2
-rw-r--r--todolists/views.py8
9 files changed, 18 insertions, 18 deletions
diff --git a/devel/management/commands/import_signatures.py b/devel/management/commands/import_signatures.py
index ce1aba90..da1397ca 100644
--- a/devel/management/commands/import_signatures.py
+++ b/devel/management/commands/import_signatures.py
@@ -98,8 +98,8 @@ def import_signatures(keyring):
# now prune the data down to what we actually want.
# prune edges not in nodes, remove duplicates, and self-sigs
- pruned_edges = set(edge for edge in edges
- if edge.signer in nodes and edge.signer != edge.signee)
+ pruned_edges = {edge for edge in edges
+ if edge.signer in nodes and edge.signer != edge.signee}
logger.info("creating or finding %d signatures", len(pruned_edges))
created_ct = updated_ct = 0
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py
index 3d4e6375..981c4dce 100644
--- a/devel/management/commands/reporead.py
+++ b/devel/management/commands/reporead.py
@@ -380,7 +380,7 @@ def db_update(archname, reponame, pkgs, force=False):
dbdict = {dbpkg.pkgname: dbpkg for dbpkg in dbpkgs}
dbset = set(dbdict.keys())
- syncset = set([pkg.name for pkg in pkgs])
+ syncset = {pkg.name for pkg in pkgs}
in_sync_not_db = syncset - dbset
logger.info("%d packages in sync not db", len(in_sync_not_db))
diff --git a/devel/management/commands/reporead_inotify.py b/devel/management/commands/reporead_inotify.py
index 16b3869c..04f65764 100644
--- a/devel/management/commands/reporead_inotify.py
+++ b/devel/management/commands/reporead_inotify.py
@@ -77,7 +77,7 @@ class Command(BaseCommand):
for repo in repos)
# take a python format string and generate all unique combinations
# of directories from it; using set() ensures we filter it down
- paths = set(self.path_template % values for values in combos)
+ paths = {self.path_template % values for values in combos}
total_paths += len(paths)
all_paths |= paths
arch_path_map[arch] = paths
diff --git a/devel/views.py b/devel/views.py
index 083665d9..7d5947d1 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -277,8 +277,8 @@ def report(request, report_name, username=None):
else:
raise Http404
- arches = set(pkg.arch for pkg in packages)
- repos = set(pkg.repo for pkg in packages)
+ arches = {pkg.arch for pkg in packages}
+ repos = {pkg.repo for pkg in packages}
context = {
'all_maintainers': maints,
'title': title,
diff --git a/main/models.py b/main/models.py
index 5700cdf1..cc81637c 100644
--- a/main/models.py
+++ b/main/models.py
@@ -197,7 +197,7 @@ class Package(models.Model):
"""
from packages.models import Depend
provides = self.provides.all()
- provide_names = set(provide.name for provide in provides)
+ provide_names = {provide.name for provide in provides}
provide_names.add(self.pkgname)
requiredby = Depend.objects.select_related('pkg',
'pkg__arch', 'pkg__repo').filter(
diff --git a/packages/models.py b/packages/models.py
index 0d0fbdf2..ede8c275 100644
--- a/packages/models.py
+++ b/packages/models.py
@@ -33,7 +33,7 @@ class PackageRelation(models.Model):
def repositories(self):
packages = self.get_associated_packages()
- return sorted(set([p.repo for p in packages]))
+ return sorted({p.repo for p in packages})
def __unicode__(self):
return u'%s: %s (%s)' % (
diff --git a/packages/utils.py b/packages/utils.py
index 199e141d..5adc8637 100644
--- a/packages/utils.py
+++ b/packages/utils.py
@@ -79,8 +79,8 @@ def get_split_packages_info():
split_pkgs = Package.objects.exclude(pkgname=F('pkgbase')).exclude(
pkgbase__in=pkgnames).values('pkgbase', 'repo', 'arch').annotate(
last_update=Max('last_update'))
- all_arches = Arch.objects.in_bulk(set(s['arch'] for s in split_pkgs))
- all_repos = Repo.objects.in_bulk(set(s['repo'] for s in split_pkgs))
+ all_arches = Arch.objects.in_bulk({s['arch'] for s in split_pkgs})
+ all_repos = Repo.objects.in_bulk({s['repo'] for s in split_pkgs})
for split in split_pkgs:
split['arch'] = all_arches[split['arch']]
split['repo'] = all_repos[split['repo']]
@@ -143,7 +143,7 @@ SELECT p.id, q.id
cursor.execute(sql, [arch_a.id, arch_b.id])
results = cursor.fetchall()
# column A will always have a value, column B might be NULL
- to_fetch = set(row[0] for row in results)
+ to_fetch = {row[0] for row in results}
# fetch all of the necessary packages
pkgs = Package.objects.normal().in_bulk(to_fetch)
# now build a list of tuples containing differences
@@ -249,13 +249,13 @@ def attach_maintainers(packages):
the maintainers and attach them to the packages to prevent N+1 query
cascading.'''
packages = list(packages)
- pkgbases = set(p.pkgbase for p in packages)
+ pkgbases = {p.pkgbase for p in packages}
rels = PackageRelation.objects.filter(type=PackageRelation.MAINTAINER,
pkgbase__in=pkgbases).values_list(
'pkgbase', 'user_id').order_by().distinct()
# get all the user objects we will need
- user_ids = set(rel[1] for rel in rels)
+ user_ids = {rel[1] for rel in rels}
users = User.objects.in_bulk(user_ids)
# now build a pkgbase -> [maintainers...] map
diff --git a/packages/views/signoff.py b/packages/views/signoff.py
index 824a9922..340b2311 100644
--- a/packages/views/signoff.py
+++ b/packages/views/signoff.py
@@ -25,7 +25,7 @@ def signoffs(request):
context = {
'signoff_groups': signoff_groups,
'arches': Arch.objects.all(),
- 'repo_names': sorted(set(g.target_repo for g in signoff_groups)),
+ 'repo_names': sorted({g.target_repo for g in signoff_groups}),
}
return render(request, 'packages/signoffs.html', context)
diff --git a/todolists/views.py b/todolists/views.py
index b8d1dae1..9984ef9a 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -53,8 +53,8 @@ def view(request, list_id):
# we don't hold onto the result, but the objects are the same here,
# so accessing maintainers in the template is now cheap
attach_maintainers(tp.pkg for tp in todolist.packages)
- arches = set(tp.pkg.arch for tp in todolist.packages)
- repos = set(tp.pkg.repo for tp in todolist.packages)
+ arches = {tp.pkg.arch for tp in todolist.packages}
+ repos = {tp.pkg.repo for tp in todolist.packages}
return render(request, 'todolists/view.html', {
'list': todolist,
'svn_roots': svn_roots,
@@ -67,8 +67,8 @@ def list_pkgbases(request, list_id, svn_root):
'''Used to make bulk moves of packages a lot easier.'''
todolist = get_object_or_404(Todolist, id=list_id)
repos = get_list_or_404(Repo, svn_root=svn_root)
- pkgbases = set(tp.pkg.pkgbase for tp in todolist.packages
- if tp.pkg.repo in repos)
+ pkgbases = {tp.pkg.pkgbase for tp in todolist.packages
+ if tp.pkg.repo in repos}
return HttpResponse('\n'.join(sorted(pkgbases)),
mimetype='text/plain')