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
=== modified file 'database/schema/diagram.py'
--- database/schema/diagram.py 2009-10-17 14:06:03 +0000
+++ database/schema/diagram.py 2010-02-09 01:51:16 +0000
@@ -9,7 +9,6 @@
9import _pythonpath9import _pythonpath
1010
11import psycopg, sys, os, re11import psycopg, sys, os, re
12from sets import Set
13from security import DbSchema, CursorWrapper12from security import DbSchema, CursorWrapper
14from ConfigParser import SafeConfigParser, NoOptionError13from ConfigParser import SafeConfigParser, NoOptionError
1514
@@ -51,8 +50,8 @@
51 '''The universe contains everything'''50 '''The universe contains everything'''
52 return True51 return True
5352
54all_tables = Set()53all_tables = set()
55graphed_tables = Set()54graphed_tables = set()
5655
57def tartup(filename, outfile, section):56def tartup(filename, outfile, section):
58 dot = open(filename).read()57 dot = open(filename).read()
5958
=== modified file 'database/schema/security.py'
--- database/schema/security.py 2010-01-06 12:34:40 +0000
+++ database/schema/security.py 2010-02-09 01:51:16 +0000
@@ -10,7 +10,6 @@
1010
11from itertools import chain11from itertools import chain
12import os12import os
13import sets
14import sys13import sys
1514
16import psycopg215import psycopg2
@@ -291,7 +290,7 @@
291 # Set of all tables we have granted permissions on. After we have assigned290 # Set of all tables we have granted permissions on. After we have assigned
292 # permissions, we can use this to determine what tables have been291 # permissions, we can use this to determine what tables have been
293 # forgotten about.292 # forgotten about.
294 found = sets.Set()293 found = set()
295294
296 # Set permissions as per config file295 # Set permissions as per config file
297 for username in config.sections():296 for username in config.sections():
@@ -383,7 +382,7 @@
383382
384 # Raise an error if we have database objects lying around that have not383 # Raise an error if we have database objects lying around that have not
385 # had permissions assigned.384 # had permissions assigned.
386 forgotten = sets.Set()385 forgotten = set()
387 for obj in schema.values():386 for obj in schema.values():
388 if obj not in found:387 if obj not in found:
389 forgotten.add(obj)388 forgotten.add(obj)
390389
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2010-01-20 05:42:33 +0000
+++ lib/lp/registry/model/product.py 2010-02-09 01:51:16 +0000
@@ -16,7 +16,6 @@
16import datetime16import datetime
17import calendar17import calendar
18import pytz18import pytz
19import sets
20from sqlobject import (19from sqlobject import (
21 BoolCol, ForeignKey, SQLMultipleJoin, SQLObjectNotFound, StringCol)20 BoolCol, ForeignKey, SQLMultipleJoin, SQLObjectNotFound, StringCol)
22from storm.locals import And, Desc, Join, SQL, Store, Unicode21from storm.locals import And, Desc, Join, SQL, Store, Unicode
@@ -1090,7 +1089,7 @@
1090 if registrant is None:1089 if registrant is None:
1091 registrant = owner1090 registrant = owner
1092 if licenses is None:1091 if licenses is None:
1093 licenses = sets.Set()1092 licenses = set()
1094 product = Product(1093 product = Product(
1095 owner=owner, registrant=registrant, name=name,1094 owner=owner, registrant=registrant, name=name,
1096 displayname=displayname, title=title, project=project,1095 displayname=displayname, title=title, project=project,
10971096
=== modified file 'lib/lp/services/mail/sendmail.py'
--- lib/lp/services/mail/sendmail.py 2009-07-23 18:34:25 +0000
+++ lib/lp/services/mail/sendmail.py 2010-02-09 01:51:16 +0000
@@ -26,7 +26,6 @@
2626
27from binascii import b2a_qp27from binascii import b2a_qp
28import sha28import sha
29import sets
30from email.Encoders import encode_base6429from email.Encoders import encode_base64
31from email.Utils import getaddresses, make_msgid, formatdate, formataddr30from email.Utils import getaddresses, make_msgid, formatdate, formataddr
32from email.Message import Message31from email.Message import Message
@@ -80,7 +79,7 @@
80 to header. The to header and envelope_to addresses may vary79 to header. The to header and envelope_to addresses may vary
81 independently, and the to header cannot break Z3.80 independently, and the to header cannot break Z3.
82 """81 """
83 assert (zisinstance(to_addrs, (list, tuple, sets.Set, set))82 assert (zisinstance(to_addrs, (list, tuple, set))
84 and len(to_addrs) > 0), 'Invalid To: %r' % (to_addrs,)83 and len(to_addrs) > 0), 'Invalid To: %r' % (to_addrs,)
85 for addr in to_addrs:84 for addr in to_addrs:
86 assert zisinstance(addr, basestring) and bool(addr), \85 assert zisinstance(addr, basestring) and bool(addr), \
8786
=== modified file 'lib/schoolbell/icalendar.py'
--- lib/schoolbell/icalendar.py 2005-10-31 18:29:12 +0000
+++ lib/schoolbell/icalendar.py 2010-02-09 01:51:16 +0000
@@ -38,7 +38,6 @@
38import re38import re
39import pytz39import pytz
40from cStringIO import StringIO40from cStringIO import StringIO
41from sets import Set
42from schoolbell.simple import SimpleCalendarEvent41from schoolbell.simple import SimpleCalendarEvent
4342
44_utc_tz = pytz.timezone('UTC')43_utc_tz = pytz.timezone('UTC')
@@ -892,7 +891,7 @@
892 'RECUR': parse_recurrence_rule,891 'RECUR': parse_recurrence_rule,
893 }892 }
894893
895 singleton_properties = Set([894 singleton_properties = set([
896 'DTSTAMP',895 'DTSTAMP',
897 'DTSTART',896 'DTSTART',
898 'UID',897 'UID',
@@ -914,8 +913,8 @@
914 'URL',913 'URL',
915 ])914 ])
916915
917 rdate_types = Set(['DATE', 'DATE-TIME', 'PERIOD'])916 rdate_types = set(['DATE', 'DATE-TIME', 'PERIOD'])
918 exdate_types = Set(['DATE', 'DATE-TIME'])917 exdate_types = set(['DATE', 'DATE-TIME'])
919918
920 def __init__(self):919 def __init__(self):
921 self._props = {}920 self._props = {}
@@ -1080,7 +1079,7 @@
1080 del start_set[exdate]1079 del start_set[exdate]
10811080
1082 # Find out the set of all dates1081 # Find out the set of all dates
1083 date_set = Set(start_set)1082 date_set = set(start_set)
1084 duration = self.duration.days1083 duration = self.duration.days
1085 for d in start_set:1084 for d in start_set:
1086 for n in range(1, duration):1085 for n in range(1, duration):
10871086
=== modified file 'utilities/findimports.py'
--- utilities/findimports.py 2009-10-17 14:06:03 +0000
+++ utilities/findimports.py 2010-02-09 01:51:16 +0000
@@ -38,11 +38,9 @@
3838
39import os39import os
40import sys40import sys
41import sets
42import getopt41import getopt
43import compiler42import compiler
44import linecache43import linecache
45from sets import Set
46from compiler import ast44from compiler import ast
47from compiler.visitor import ASTVisitor45from compiler.visitor import ASTVisitor
4846
@@ -165,7 +163,7 @@
165 self.modules = {}163 self.modules = {}
166 self.path = sys.path164 self.path = sys.path
167 self._module_cache = {}165 self._module_cache = {}
168 self._warned_about = sets.Set()166 self._warned_about = set()
169167
170 def parsePathname(self, pathname):168 def parsePathname(self, pathname):
171 if os.path.isdir(pathname):169 if os.path.isdir(pathname):
@@ -188,7 +186,7 @@
188 module.imported_names = find_imports(filename)186 module.imported_names = find_imports(filename)
189 module.unused_names = None187 module.unused_names = None
190 dir = os.path.dirname(filename)188 dir = os.path.dirname(filename)
191 module.imports = Set([self.findModuleOfName(name, filename, dir)189 module.imports = set([self.findModuleOfName(name, filename, dir)
192 for name in module.imported_names])190 for name in module.imported_names])
193191
194 def filenameToModname(self, filename):192 def filenameToModname(self, filename):
@@ -296,7 +294,7 @@
296 def printDot(self):294 def printDot(self):
297 print "digraph ModuleDependencies {"295 print "digraph ModuleDependencies {"
298 print " node[shape=box];"296 print " node[shape=box];"
299 allNames = Set()297 allNames = set()
300 nameDict = {}298 nameDict = {}
301 for n, module in enumerate(self.listModules()):299 for n, module in enumerate(self.listModules()):
302 module._dot_name = "mod%d" % n300 module._dot_name = "mod%d" % n