Merge lp:~maxb/launchpad/stop-using-deprecated-sets into lp:launchpad

Proposed by Max Bowsher
Status: Merged
Approved by: Graham Binns
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~maxb/launchpad/stop-using-deprecated-sets
Merge into: lp:launchpad
Diff against target: 178 lines (+13/-20)
6 files modified
database/schema/diagram.py (+2/-3)
database/schema/security.py (+2/-3)
lib/lp/registry/model/product.py (+1/-2)
lib/lp/services/mail/sendmail.py (+1/-2)
lib/schoolbell/icalendar.py (+4/-5)
utilities/findimports.py (+3/-5)
To merge this branch: bzr merge lp:~maxb/launchpad/stop-using-deprecated-sets
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+18896@code.launchpad.net

Commit message

Remove use of the deprecated sets module.

To post a comment you must log in.
Revision history for this message
Max Bowsher (maxb) wrote :

The sets module is deprecated as of Python 2.6 in favour of the built-in set type, introduced in Python 2.4.

Revision history for this message
Graham Binns (gmb) :
review: Approve (code)
Revision history for this message
Max Bowsher (maxb) wrote :

On hold for merging, as it will require conflict resolution with another branch which is inbound.

Revision history for this message
Max Bowsher (maxb) wrote :

As the mutually conflicting branch has encountered prob;ems and is back to work-in-progress, this is clear to land as soon as someone can submit it for me.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/schema/diagram.py'
2--- database/schema/diagram.py 2009-10-17 14:06:03 +0000
3+++ database/schema/diagram.py 2010-02-09 01:51:16 +0000
4@@ -9,7 +9,6 @@
5 import _pythonpath
6
7 import psycopg, sys, os, re
8-from sets import Set
9 from security import DbSchema, CursorWrapper
10 from ConfigParser import SafeConfigParser, NoOptionError
11
12@@ -51,8 +50,8 @@
13 '''The universe contains everything'''
14 return True
15
16-all_tables = Set()
17-graphed_tables = Set()
18+all_tables = set()
19+graphed_tables = set()
20
21 def tartup(filename, outfile, section):
22 dot = open(filename).read()
23
24=== modified file 'database/schema/security.py'
25--- database/schema/security.py 2010-01-06 12:34:40 +0000
26+++ database/schema/security.py 2010-02-09 01:51:16 +0000
27@@ -10,7 +10,6 @@
28
29 from itertools import chain
30 import os
31-import sets
32 import sys
33
34 import psycopg2
35@@ -291,7 +290,7 @@
36 # Set of all tables we have granted permissions on. After we have assigned
37 # permissions, we can use this to determine what tables have been
38 # forgotten about.
39- found = sets.Set()
40+ found = set()
41
42 # Set permissions as per config file
43 for username in config.sections():
44@@ -383,7 +382,7 @@
45
46 # Raise an error if we have database objects lying around that have not
47 # had permissions assigned.
48- forgotten = sets.Set()
49+ forgotten = set()
50 for obj in schema.values():
51 if obj not in found:
52 forgotten.add(obj)
53
54=== modified file 'lib/lp/registry/model/product.py'
55--- lib/lp/registry/model/product.py 2010-01-20 05:42:33 +0000
56+++ lib/lp/registry/model/product.py 2010-02-09 01:51:16 +0000
57@@ -16,7 +16,6 @@
58 import datetime
59 import calendar
60 import pytz
61-import sets
62 from sqlobject import (
63 BoolCol, ForeignKey, SQLMultipleJoin, SQLObjectNotFound, StringCol)
64 from storm.locals import And, Desc, Join, SQL, Store, Unicode
65@@ -1090,7 +1089,7 @@
66 if registrant is None:
67 registrant = owner
68 if licenses is None:
69- licenses = sets.Set()
70+ licenses = set()
71 product = Product(
72 owner=owner, registrant=registrant, name=name,
73 displayname=displayname, title=title, project=project,
74
75=== modified file 'lib/lp/services/mail/sendmail.py'
76--- lib/lp/services/mail/sendmail.py 2009-07-23 18:34:25 +0000
77+++ lib/lp/services/mail/sendmail.py 2010-02-09 01:51:16 +0000
78@@ -26,7 +26,6 @@
79
80 from binascii import b2a_qp
81 import sha
82-import sets
83 from email.Encoders import encode_base64
84 from email.Utils import getaddresses, make_msgid, formatdate, formataddr
85 from email.Message import Message
86@@ -80,7 +79,7 @@
87 to header. The to header and envelope_to addresses may vary
88 independently, and the to header cannot break Z3.
89 """
90- assert (zisinstance(to_addrs, (list, tuple, sets.Set, set))
91+ assert (zisinstance(to_addrs, (list, tuple, set))
92 and len(to_addrs) > 0), 'Invalid To: %r' % (to_addrs,)
93 for addr in to_addrs:
94 assert zisinstance(addr, basestring) and bool(addr), \
95
96=== modified file 'lib/schoolbell/icalendar.py'
97--- lib/schoolbell/icalendar.py 2005-10-31 18:29:12 +0000
98+++ lib/schoolbell/icalendar.py 2010-02-09 01:51:16 +0000
99@@ -38,7 +38,6 @@
100 import re
101 import pytz
102 from cStringIO import StringIO
103-from sets import Set
104 from schoolbell.simple import SimpleCalendarEvent
105
106 _utc_tz = pytz.timezone('UTC')
107@@ -892,7 +891,7 @@
108 'RECUR': parse_recurrence_rule,
109 }
110
111- singleton_properties = Set([
112+ singleton_properties = set([
113 'DTSTAMP',
114 'DTSTART',
115 'UID',
116@@ -914,8 +913,8 @@
117 'URL',
118 ])
119
120- rdate_types = Set(['DATE', 'DATE-TIME', 'PERIOD'])
121- exdate_types = Set(['DATE', 'DATE-TIME'])
122+ rdate_types = set(['DATE', 'DATE-TIME', 'PERIOD'])
123+ exdate_types = set(['DATE', 'DATE-TIME'])
124
125 def __init__(self):
126 self._props = {}
127@@ -1080,7 +1079,7 @@
128 del start_set[exdate]
129
130 # Find out the set of all dates
131- date_set = Set(start_set)
132+ date_set = set(start_set)
133 duration = self.duration.days
134 for d in start_set:
135 for n in range(1, duration):
136
137=== modified file 'utilities/findimports.py'
138--- utilities/findimports.py 2009-10-17 14:06:03 +0000
139+++ utilities/findimports.py 2010-02-09 01:51:16 +0000
140@@ -38,11 +38,9 @@
141
142 import os
143 import sys
144-import sets
145 import getopt
146 import compiler
147 import linecache
148-from sets import Set
149 from compiler import ast
150 from compiler.visitor import ASTVisitor
151
152@@ -165,7 +163,7 @@
153 self.modules = {}
154 self.path = sys.path
155 self._module_cache = {}
156- self._warned_about = sets.Set()
157+ self._warned_about = set()
158
159 def parsePathname(self, pathname):
160 if os.path.isdir(pathname):
161@@ -188,7 +186,7 @@
162 module.imported_names = find_imports(filename)
163 module.unused_names = None
164 dir = os.path.dirname(filename)
165- module.imports = Set([self.findModuleOfName(name, filename, dir)
166+ module.imports = set([self.findModuleOfName(name, filename, dir)
167 for name in module.imported_names])
168
169 def filenameToModname(self, filename):
170@@ -296,7 +294,7 @@
171 def printDot(self):
172 print "digraph ModuleDependencies {"
173 print " node[shape=box];"
174- allNames = Set()
175+ allNames = set()
176 nameDict = {}
177 for n, module in enumerate(self.listModules()):
178 module._dot_name = "mod%d" % n