[CalendarServer-changes] [715] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Dec 5 20:10:15 PST 2006
Revision: 715
http://trac.macosforge.org/projects/calendarserver/changeset/715
Author: wsanchez at apple.com
Date: 2006-12-05 20:10:15 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
Use Py 2.4 sorted() builtin because it's zippy.
Modified Paths:
--------------
CalendarServer/trunk/caladmin/formatters.py
CalendarServer/trunk/caladmin/options.py
CalendarServer/trunk/caladmin/script.py
CalendarServer/trunk/twistedcaldav/extensions.py
CalendarServer/trunk/twistedcaldav/ical.py
CalendarServer/trunk/twistedcaldav/instance.py
CalendarServer/trunk/twistedcaldav/py/plistlib.py
CalendarServer/trunk/twistedcaldav/schedule.py
Modified: CalendarServer/trunk/caladmin/formatters.py
===================================================================
--- CalendarServer/trunk/caladmin/formatters.py 2006-12-06 04:01:00 UTC (rev 714)
+++ CalendarServer/trunk/caladmin/formatters.py 2006-12-06 04:10:15 UTC (rev 715)
@@ -203,8 +203,7 @@
def report_stats(self, report):
if 'fieldnames' not in self.options:
- self.options['fieldnames'] = report['data'].keys()
- self.options['fieldnames'].sort()
+ self.options['fieldnames'] = sorted(report['data'].keys())
self.writeList(self.options['fieldnames'],
[report['data']])
Modified: CalendarServer/trunk/caladmin/options.py
===================================================================
--- CalendarServer/trunk/caladmin/options.py 2006-12-06 04:01:00 UTC (rev 714)
+++ CalendarServer/trunk/caladmin/options.py 2006-12-06 04:10:15 UTC (rev 715)
@@ -30,10 +30,7 @@
return COMMANDS.keys()
def genSubCommandsDef():
- sc = listCommands()
- sc.sort()
-
- for name in sc:
+ for name in sorted(listCommands()):
command = COMMANDS[name]
yield [command.name, command.shortcut, command, command.help]
Modified: CalendarServer/trunk/caladmin/script.py
===================================================================
--- CalendarServer/trunk/caladmin/script.py 2006-12-06 04:01:00 UTC (rev 714)
+++ CalendarServer/trunk/caladmin/script.py 2006-12-06 04:10:15 UTC (rev 715)
@@ -98,10 +98,7 @@
self.calendarCollection = self.root.child('calendars')
self.principalCollection = self.root.child('principals')
- lf = formatters.listFormatters()
- lf.sort()
-
- if self['format'] in lf:
+ if self['format'] in sorted(formatters.listFormatters()):
self.formatter = formatters.getFormatter(self['format'])
self.formatter = self.formatter(options=self.format_options)
else:
@@ -109,18 +106,13 @@
', '.join(lf)))
sc = options.listCommands()
- sc.sort()
+ if self.subCommand not in sc:
+ raise usage.UsageError("Please select one of: %s" % (
+ ', '.join(sorted(sc))))
self.subCommands = options.genSubCommandsDef()
-
self.recursing = 1
-
self.parseOptions(self.params)
-
- if self.subCommand not in sc:
- raise usage.UsageError("Please select one of: %s" % (
- ', '.join(sc)))
-
def run():
config = AdminOptions()
Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py 2006-12-06 04:01:00 UTC (rev 714)
+++ CalendarServer/trunk/twistedcaldav/extensions.py 2006-12-06 04:10:15 UTC (rev 715)
@@ -144,9 +144,7 @@
""" % { "title": urllib.unquote(request.uri) }]
even = False
- children = list(self.listChildren())
- children.sort()
- for name in children:
+ for name in sorted(self.listChildren()):
child = self.getChild(name)
url = urllib.quote(name, '/')
Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py 2006-12-06 04:01:00 UTC (rev 714)
+++ CalendarServer/trunk/twistedcaldav/ical.py 2006-12-06 04:10:15 UTC (rev 715)
@@ -235,9 +235,7 @@
def __repr__(self): return "<%s: %r>" % (self.__class__.__name__, str(self._vobject))
def __hash__(self):
- properties = list(self.properties())
- properties.sort()
- return hash(tuple(properties))
+ return hash(tuple(sorted(self.properties())))
def __ne__(self, other): return not self.__eq__(other)
def __eq__(self, other):
Modified: CalendarServer/trunk/twistedcaldav/instance.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/instance.py 2006-12-06 04:01:00 UTC (rev 714)
+++ CalendarServer/trunk/twistedcaldav/instance.py 2006-12-06 04:10:15 UTC (rev 715)
@@ -96,10 +96,9 @@
def __iter__(self):
# Return keys in sorted order via iterator
- keys = self.instances.keys()
- keys.sort()
- for i in keys: yield i
-
+ for i in sorted(self.instances.keys()):
+ yield i
+
def __getitem__(self, key):
return self.instances[key]
@@ -302,9 +301,7 @@
newDuration = end - start
# First get sorted instance keys greater than the current components R-ID
- keys = [x for x in self.instances.keys() if x > str(rid)]
- keys.sort()
- for key in keys:
+ for key in sorted(x for x in self.instances.keys() if x > str(rid)):
oldinstance = self.instances[key]
# Do not override instance that is alreday overridden
Modified: CalendarServer/trunk/twistedcaldav/py/plistlib.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/py/plistlib.py 2006-12-06 04:01:00 UTC (rev 714)
+++ CalendarServer/trunk/twistedcaldav/py/plistlib.py 2006-12-06 04:10:15 UTC (rev 715)
@@ -268,9 +268,7 @@
def writeDict(self, d):
self.beginElement("dict")
- items = d.items()
- items.sort()
- for key, value in items:
+ for key, value in sorted(d.items()):
if not isinstance(key, (str, unicode)):
raise TypeError("keys must be strings")
self.simpleElement("key", key)
Modified: CalendarServer/trunk/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/schedule.py 2006-12-06 04:01:00 UTC (rev 714)
+++ CalendarServer/trunk/twistedcaldav/schedule.py 2006-12-06 04:10:15 UTC (rev 715)
@@ -261,7 +261,7 @@
d = waitForDeferred(
maybeDeferred(
storeCalendarObjectResource,
- request=request,
+ request = request,
sourcecal = False,
destination = child,
destination_uri = childURL,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061205/5232cb69/attachment.html
More information about the calendarserver-changes
mailing list