[CalendarServer-changes] [13818] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 1 10:59:51 PDT 2014


Revision: 13818
          http://trac.calendarserver.org//changeset/13818
Author:   cdaboo at apple.com
Date:     2014-08-01 10:59:51 -0700 (Fri, 01 Aug 2014)
Log Message:
-----------
Whitespace.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/caldav.py
    CalendarServer/trunk/calendarserver/tap/test/test_caldav.py
    CalendarServer/trunk/twistedcaldav/backup.py
    CalendarServer/trunk/twistedcaldav/client/geturl.py
    CalendarServer/trunk/twistedcaldav/client/pool.py
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/database.py
    CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py
    CalendarServer/trunk/twistedcaldav/directory/augment.py
    CalendarServer/trunk/twistedcaldav/directory/principal.py
    CalendarServer/trunk/twistedcaldav/directory/test/test_digest.py
    CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py
    CalendarServer/trunk/twistedcaldav/directory/test/test_proxyprincipaldb.py
    CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py
    CalendarServer/trunk/twistedcaldav/extensions.py
    CalendarServer/trunk/twistedcaldav/instance.py
    CalendarServer/trunk/twistedcaldav/localization.py
    CalendarServer/trunk/twistedcaldav/memcacheclient.py
    CalendarServer/trunk/twistedcaldav/memcacheprops.py
    CalendarServer/trunk/twistedcaldav/memcacher.py
    CalendarServer/trunk/twistedcaldav/method/mkcol.py
    CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py
    CalendarServer/trunk/twistedcaldav/method/report_common.py
    CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py
    CalendarServer/trunk/twistedcaldav/notifications.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/resource.py
    CalendarServer/trunk/twistedcaldav/storebridge.py
    CalendarServer/trunk/twistedcaldav/test/test_addressbookmultiget.py
    CalendarServer/trunk/twistedcaldav/test/test_cache.py
    CalendarServer/trunk/twistedcaldav/test/test_config.py
    CalendarServer/trunk/twistedcaldav/test/test_icalendar.py
    CalendarServer/trunk/twistedcaldav/test/test_localization.py
    CalendarServer/trunk/twistedcaldav/test/test_memcacheprops.py
    CalendarServer/trunk/twistedcaldav/test/test_mkcalendar.py
    CalendarServer/trunk/twistedcaldav/test/test_multiget.py
    CalendarServer/trunk/twistedcaldav/test/test_wrapping.py
    CalendarServer/trunk/twistedcaldav/vcard.py

Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -735,6 +735,7 @@
     """
 
 
+
 class CalDAVServiceMaker (object):
     log = Logger()
 

Modified: CalendarServer/trunk/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/test/test_caldav.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/calendarserver/tap/test/test_caldav.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -1505,6 +1505,7 @@
         )
 
 
+
 class StubStorageService(object):
 
     def __init__(self):

Modified: CalendarServer/trunk/twistedcaldav/backup.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/backup.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/backup.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -108,9 +108,10 @@
 @logFuncCall
 def serveradmin(action, service):
     cmd = ' '.join((
-            SERVERADMIN,
-            action,
-            service))
+        SERVERADMIN,
+        action,
+        service
+    ))
 
     status, output = commands.getstatusoutput(cmd)
 
@@ -124,9 +125,10 @@
 @logFuncCall
 def isRunning(service):
     cmd = ' '.join((
-            SERVERADMIN,
-            'status',
-            service))
+        SERVERADMIN,
+        'status',
+        service
+    ))
 
     debug(cmd)
 

Modified: CalendarServer/trunk/twistedcaldav/client/geturl.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/client/geturl.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/client/geturl.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -56,8 +56,10 @@
 
     def connectionMade(self):
         self.made = 1
-        if (self.factory is not None and
-            self.factory.protocolConnectionMade is not None):
+        if (
+            self.factory is not None and
+            self.factory.protocolConnectionMade is not None
+        ):
             d = self.factory.protocolConnectionMade
             self.factory.protocolConnectionMade = None
             d.callback(self)

Modified: CalendarServer/trunk/twistedcaldav/client/pool.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/client/pool.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/client/pool.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -178,7 +178,7 @@
         self._pendingConnects += 1
 
         self.log.debug("Initating new client connection to: %r" % (
-                self._endpoint,))
+            self._endpoint,))
         self._logClientStats()
 
         factory = self.clientFactory(self._reactor)
@@ -318,12 +318,14 @@
 
 
     def _logClientStats(self):
-        self.log.debug("Clients #free: %d, #busy: %d, "
-                       "#pending: %d, #queued: %d" % (
+        self.log.debug(
+            "Clients #free: %d, #busy: %d, #pending: %d, #queued: %d" % (
                 len(self._freeClients),
                 len(self._busyClients),
                 self._pendingConnects,
-                len(self._pendingRequests)))
+                len(self._pendingRequests)
+            )
+        )
 
 
     def clientGone(self, client):
@@ -385,7 +387,7 @@
             d, request, args, kwargs = self._pendingRequests.pop(0)
 
             self.log.debug("Performing Queued Request: %s, %r, %r" % (
-                    request, args, kwargs))
+                request, args, kwargs))
             self._logClientStats()
 
             _ign_d = self._submitRequest(request, *args, **kwargs)

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/config.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -195,7 +195,7 @@
         parts = attr.split(".")
         lastDict = self._data
         for part in parts[:-1]:
-            if not part in lastDict:
+            if part not in lastDict:
                 lastDict[attr] = ConfigDict()
             lastDict = lastDict.__getattr__(part)
         configItem = parts[-1]
@@ -289,7 +289,8 @@
                 self._afterResetHook(self._data, preserved)
             self.update(configDict, reloading=True)
         else:
-            raise ConfigurationError("Invalid configuration in %s"
+            raise ConfigurationError(
+                "Invalid configuration in %s"
                 % (self._provider.getConfigFileName(), ))
 
 

Modified: CalendarServer/trunk/twistedcaldav/database.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/database.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/database.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -20,7 +20,7 @@
     import pgdb
 except:
     pgdb = None
-#pgdb = None
+# pgdb = None
 
 from twisted.enterprise.adbapi import ConnectionPool
 from twisted.internet.defer import inlineCallbacks, returnValue

Modified: CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -194,7 +194,7 @@
     def _defaultFilter(self, ical):
         """
         There is no per-user component. Instead apply default properties to the data for this user.
-    
+
         @param ical: the iCalendar object to process
         @type ical: L{Component}
         """

Modified: CalendarServer/trunk/twistedcaldav/directory/augment.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/augment.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/directory/augment.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -206,7 +206,7 @@
         @return: L{Deferred}
         """
 
-        if not uid in self.cachedRecords:
+        if uid not in self.cachedRecords:
             result = (yield self._lookupAugmentRecord(uid))
             self.cachedRecords[uid] = result
         returnValue(self.cachedRecords[uid])

Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -134,8 +134,10 @@
             return "recordName", id
 
     else:
-        raise ValueError("Invalid calendar user address format: %s" %
-            (origCUAddr,))
+        raise ValueError(
+            "Invalid calendar user address format: %s" %
+            (origCUAddr,)
+        )
 
 
 
@@ -228,18 +230,15 @@
         ("DAV:" , "displayname") :
             ("fullNames", None, "Display Name", davxml.DisplayName),
         ("urn:ietf:params:xml:ns:caldav" , "calendar-user-type") :
-            ("", cuTypeConverter, "Calendar User Type",
-            caldavxml.CalendarUserType),
+            ("", cuTypeConverter, "Calendar User Type", caldavxml.CalendarUserType),
         ("urn:ietf:params:xml:ns:caldav" , "calendar-user-address-set") :
-            ("", cuAddressConverter, "Calendar User Address Set",
-            caldavxml.CalendarUserAddressSet),
+            ("", cuAddressConverter, "Calendar User Address Set", caldavxml.CalendarUserAddressSet),
         (_cs_ns, "first-name") :
             ("firstName", None, "First Name", customxml.FirstNameProperty),
         (_cs_ns, "last-name") :
             ("lastName", None, "Last Name", customxml.LastNameProperty),
         (_cs_ns, "email-address-set") :
-            ("emailAddresses", None, "Email Addresses",
-            customxml.EmailAddressSet),
+            ("emailAddresses", None, "Email Addresses", customxml.EmailAddressSet),
     }
     _fieldList = [v for _ignore_k, v in sorted(_fieldMap.iteritems(), key=lambda x:x[0])]
 
@@ -342,8 +341,10 @@
             else:
                 port = int(netloc[1])
 
-            if (host != config.ServerHostName and
-                host not in config.Scheduling.Options.PrincipalHostAliases):
+            if (
+                host != config.ServerHostName and
+                host not in config.Scheduling.Options.PrincipalHostAliases
+            ):
                 returnValue(None)
 
             if port != {
@@ -1057,7 +1058,8 @@
                         relatives.add(found)
 
                     if infinity:
-                        yield self._getRelatives(method, relative, relatives, records,
+                        yield self._getRelatives(
+                            method, relative, relatives, records,
                             infinity=infinity)
 
         returnValue(relatives)
@@ -1416,7 +1418,7 @@
         if config.EnableProxyPrincipals and name in (
             "calendar-proxy-read", "calendar-proxy-write",
             "calendar-proxy-read-for", "calendar-proxy-write-for",
-            ):
+        ):
             # name is required to be str
             from twistedcaldav.directory.calendaruserproxy import (
                 CalendarUserProxyPrincipalResource

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_digest.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_digest.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_digest.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -52,36 +52,61 @@
 
 challengeNonce = '178288758716122392881254770685'
 
-challengeResponse = ('digest',
-                     {'nonce': challengeNonce,
-                      'qop': 'auth', 'realm': 'test realm',
-                      'algorithm': 'md5', })
+challengeResponse = (
+    'digest',
+    {
+        'nonce': challengeNonce,
+        'qop': 'auth',
+        'realm': 'test realm',
+        'algorithm': 'md5',
+    }
+)
 
 cnonce = "29fc54aa1641c6fa0e151419361c8f23"
 
-authRequest1 = (('username="username", realm="test realm", nonce="%s", '
-                 'uri="/write/", response="%s", algorithm="md5", '
-                 'cnonce="29fc54aa1641c6fa0e151419361c8f23", nc=00000001, '
-                 'qop="auth"'),
-                ('username="username", realm="test realm", nonce="%s", '
-                 'uri="/write/", response="%s", algorithm="md5"'))
+authRequest1 = (
+    (
+        'username="username", realm="test realm", nonce="%s", '
+        'uri="/write/", response="%s", algorithm="md5", '
+        'cnonce="29fc54aa1641c6fa0e151419361c8f23", nc=00000001, '
+        'qop="auth"'
+    ),
+    (
+        'username="username", realm="test realm", nonce="%s", '
+        'uri="/write/", response="%s", algorithm="md5"'
+    )
+)
 
-authRequest2 = (('username="username", realm="test realm", nonce="%s", '
-                 'uri="/write/", response="%s", algorithm="md5", '
-                 'cnonce="29fc54aa1641c6fa0e151419361c8f23", nc=00000002, '
-                 'qop="auth"'),
-                ('username="username", realm="test realm", nonce="%s", '
-                 'uri="/write/", response="%s", algorithm="md5"'))
+authRequest2 = (
+    (
+        'username="username", realm="test realm", nonce="%s", '
+        'uri="/write/", response="%s", algorithm="md5", '
+        'cnonce="29fc54aa1641c6fa0e151419361c8f23", nc=00000002, '
+        'qop="auth"'
+    ),
+    (
+        'username="username", realm="test realm", nonce="%s", '
+        'uri="/write/", response="%s", algorithm="md5"'
+    )
+)
 
-authRequest3 = ('username="username", realm="test realm", nonce="%s", '
-                'uri="/write/", response="%s", algorithm="md5"')
+authRequest3 = (
+    'username="username", realm="test realm", nonce="%s", '
+    'uri="/write/", response="%s", algorithm="md5"'
+)
 
-authRequestComma = (('username="user,name", realm="test realm", nonce="%s", '
-                 'uri="/write/1,2.txt", response="%s", algorithm="md5", '
-                 'cnonce="29fc54aa1641c6fa0e151419361c8f23", nc=00000001, '
-                 'qop="auth"'),
-                ('username="user,name", realm="test realm", nonce="%s", '
-                 'uri="/write/1,2.txt", response="%s", algorithm="md5"'))
+authRequestComma = (
+    (
+        'username="user,name", realm="test realm", nonce="%s", '
+        'uri="/write/1,2.txt", response="%s", algorithm="md5", '
+        'cnonce="29fc54aa1641c6fa0e151419361c8f23", nc=00000001, '
+        'qop="auth"'
+    ),
+    (
+        'username="user,name", realm="test realm", nonce="%s", '
+        'uri="/write/1,2.txt", response="%s", algorithm="md5"'
+    )
+)
 
 namelessAuthRequest = 'realm="test realm",nonce="doesn\'t matter"'
 
@@ -103,18 +128,20 @@
         self.namespace1 = "DIGEST1"
         self.namespace2 = "DIGEST2"
 
-        self.credentialFactories = (QopDigestCredentialFactory(
-                                          'md5',
-                                          'auth',
-                                          'test realm',
-                                          self.namespace1
-                                      ),
-                                      QopDigestCredentialFactory(
-                                          'md5',
-                                          '',
-                                          'test realm',
-                                          self.namespace2
-                                      ))
+        self.credentialFactories = (
+            QopDigestCredentialFactory(
+                'md5',
+                'auth',
+                'test realm',
+                self.namespace1
+            ),
+            QopDigestCredentialFactory(
+                'md5',
+                '',
+                'test realm',
+                self.namespace2
+            )
+        )
 
 
     def getDigestResponse(self, challenge, ncount):
@@ -127,24 +154,28 @@
 
         if qop:
             expected = digest.calcResponse(
-                digest.calcHA1(algo,
-                               "username",
-                               "test realm",
-                               "password",
-                               nonce,
-                               cnonce),
+                digest.calcHA1(
+                    algo,
+                    "username",
+                    "test realm",
+                    "password",
+                    nonce,
+                    cnonce
+                ),
                 algo, nonce, ncount, cnonce, qop, "GET", "/write/", None
-                )
+            )
         else:
             expected = digest.calcResponse(
-                digest.calcHA1(algo,
-                               "username",
-                               "test realm",
-                               "password",
-                               nonce,
-                               cnonce),
+                digest.calcHA1(
+                    algo,
+                    "username",
+                    "test realm",
+                    "password",
+                    nonce,
+                    cnonce
+                ),
                 algo, nonce, None, None, None, "GET", "/write/", None
-                )
+            )
         return expected
 
 
@@ -158,24 +189,28 @@
 
         if qop:
             expected = digest.calcResponse(
-                digest.calcHA1(algo,
-                               "user,name",
-                               "test realm",
-                               "password",
-                               nonce,
-                               cnonce),
+                digest.calcHA1(
+                    algo,
+                    "user,name",
+                    "test realm",
+                    "password",
+                    nonce,
+                    cnonce
+                ),
                 algo, nonce, ncount, cnonce, qop, "GET", "/write/1,2.txt", None
-                )
+            )
         else:
             expected = digest.calcResponse(
-                digest.calcHA1(algo,
-                               "user,name",
-                               "test realm",
-                               "password",
-                               nonce,
-                               cnonce),
+                digest.calcHA1(
+                    algo,
+                    "user,name",
+                    "test realm",
+                    "password",
+                    nonce,
+                    cnonce
+                ),
                 algo, nonce, None, None, None, "GET", "/write/1,2.txt", None
-                )
+            )
         return expected
 
 
@@ -276,8 +311,10 @@
                 self.getDigestResponse(challenge, "00000001"),
             )
 
-            creds = (yield factory.decode(clientResponse,
-                                                  SimpleRequest(None, 'POST', '/')))
+            creds = (yield factory.decode(
+                clientResponse,
+                SimpleRequest(None, 'POST', '/')
+            ))
             self.failIf(creds.checkPassword('password'))
 
 
@@ -290,17 +327,21 @@
 
         # Check for no username
         for factory in self.credentialFactories:
-            e = (yield self.assertRaisesDeferred(error.LoginFailed,
-                                  factory.decode,
-                                  namelessAuthRequest,
-                                  _trivial_GET()))
+            e = (yield self.assertRaisesDeferred(
+                error.LoginFailed,
+                factory.decode,
+                namelessAuthRequest,
+                _trivial_GET()
+            ))
             self.assertEquals(str(e), "Invalid response, no username given.")
 
             # Check for an empty username
-            e = (yield self.assertRaisesDeferred(error.LoginFailed,
-                                  factory.decode,
-                                  namelessAuthRequest + ',username=""',
-                                  _trivial_GET()))
+            e = (yield self.assertRaisesDeferred(
+                error.LoginFailed,
+                factory.decode,
+                namelessAuthRequest + ',username=""',
+                _trivial_GET()
+            ))
             self.assertEquals(str(e), "Invalid response, no username given.")
 
 
@@ -311,10 +352,12 @@
         """
 
         for factory in self.credentialFactories:
-            e = (yield self.assertRaisesDeferred(error.LoginFailed,
-                                  factory.decode,
-                                  'realm="Test",username="Foo",opaque="bar"',
-                                  _trivial_GET()))
+            e = (yield self.assertRaisesDeferred(
+                error.LoginFailed,
+                factory.decode,
+                'realm="Test",username="Foo",opaque="bar"',
+                _trivial_GET()
+            ))
             self.assertEquals(str(e), "Invalid response, no nonce given.")
 
 
@@ -327,10 +370,12 @@
 
         # Check for no username
         for factory in self.credentialFactories:
-            e = (yield self.assertRaisesDeferred(error.LoginFailed,
-                                  factory.decode,
-                                  emtpyAttributeAuthRequest,
-                                  _trivial_GET()))
+            e = (yield self.assertRaisesDeferred(
+                error.LoginFailed,
+                factory.decode,
+                emtpyAttributeAuthRequest,
+                _trivial_GET()
+            ))
             self.assertEquals(str(e), "Invalid response, no username given.")
 
 
@@ -352,10 +397,10 @@
             creds = (yield factory.decode(clientResponse, _trivial_GET()))
 
             self.failUnless(creds.checkHash(
-                    md5('username:test realm:password').hexdigest()))
+                md5('username:test realm:password').hexdigest()))
 
             self.failIf(creds.checkHash(
-                    md5('username:test realm:bogus').hexdigest()))
+                md5('username:test realm:bogus').hexdigest()))
 
 
     @inlineCallbacks
@@ -500,7 +545,7 @@
             ("user", "realm", "password", "preHA1"),
             (None, "realm", None, "preHA1"),
             (None, None, "password", "preHA1"),
-            )
+        )
 
         for pszUsername, pszRealm, pszPassword, preHA1 in arguments:
             self.assertRaises(
@@ -513,7 +558,7 @@
                 "nonce",
                 "cnonce",
                 preHA1=preHA1
-                )
+            )
 
 
     @inlineCallbacks

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -140,7 +140,7 @@
             self.assertEquals(shortNames, set(expected))
 
             for shortName in shortNames:
-                #print("     -> %s" % (shortName,))
+                # print("     -> %s" % (shortName,))
                 recordResource = yield typeResource.getChild(shortName)
                 self.failUnless(
                     isinstance(recordResource, DirectoryPrincipalResource)
@@ -861,7 +861,7 @@
             yield self._checkPrivileges(*args)
 
         for recordType in (yield provisioningResource.listChildren()):
-            #print("   -> %s" % (recordType,))
+            # print("   -> %s" % (recordType,))
             typeResource = yield provisioningResource.getChild(recordType)
 
             for args in (
@@ -992,7 +992,7 @@
             if allowed:
                 def onError(f):
                     f.trap(AccessDeniedError)
-                    #print(resource.readDeadProperty(davxml.ACL))
+                    # print(resource.readDeadProperty(davxml.ACL))
                     self.fail(
                         "%s should have %s privilege on %r"
                         % (principal.sname(), privilege.sname(), resource)
@@ -1003,7 +1003,7 @@
                     f.trap(AccessDeniedError)
 
                 def onSuccess(_):
-                    #print(resource.readDeadProperty(davxml.ACL))
+                    # print(resource.readDeadProperty(davxml.ACL))
                     self.fail(
                         "%s should not have %s privilege on %r"
                         % (principal.sname(), privilege.sname(), resource)

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_proxyprincipaldb.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_proxyprincipaldb.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_proxyprincipaldb.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -334,7 +334,6 @@
             yield db.clean()
 
 
-
     @inlineCallbacks
     def test_cachingDBInsertUncached(self):
 

Modified: CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -102,10 +102,10 @@
                     davxml.Grant(
                         davxml.Privilege(davxml.Read()),
                         davxml.Privilege(davxml.ReadCurrentUserPrivilegeSet())
-                                    ),
+                    ),
                     davxml.Protected(),
                     TwistedACLInheritable(),
-               ),
+                ),
             )
         )
 
@@ -174,9 +174,9 @@
             "EMAIL": FieldName.emailAddresses,
             "UID": FieldName.uid,
             "ADR": (
-                    CalFieldName.streetAddress,
-                    CalFieldName.floor,
-                    ),
+                CalFieldName.streetAddress,
+                CalFieldName.floor,
+            ),
             "KIND": FieldName.recordType,
             # LATER "X-ADDRESSBOOKSERVER-MEMBER": FieldName.membersUIDs,
         }
@@ -252,7 +252,7 @@
                     else:
                         log.debug("doAddressBookDirectoryQuery: vCard did not match filter:\n{vcard}", vcard=vCardResult.vCard())
 
-                #no more results
+                # no more results
                 if not queryLimited:
                     break
 
@@ -338,20 +338,20 @@
                 if addedExpressions is True:
                     if not allOf:
                         expressionList = True  # expressionList or True is True
-                    #else  expressionList and True is expressionList
+                    # else  expressionList and True is expressionList
                 elif addedExpressions is False:
                     if allOf:
                         expressionList = False  # expressionList and False is False
-                    #else expressionList or False is expressionList
+                    # else expressionList or False is expressionList
                 else:
                     if expressionList is False:
                         if not allOf:
                             expressionList = addedExpressions  # False or addedExpressions is addedExpressions
-                        #else False and addedExpressions is False
+                        # else False and addedExpressions is False
                     elif expressionList is True:
                         if allOf:
                             expressionList = addedExpressions  # False or addedExpressions is addedExpressions
-                        #else False and addedExpressions is False
+                        # else False and addedExpressions is False
                     else:
                         expressionList.extend(addedExpressions)
             return expressionList
@@ -432,7 +432,7 @@
                         rawString = matchString
                         matchString = ""
                         for c in rawString:
-                            if not c in "TZ-:":
+                            if c not in "TZ-:":
                                 matchString += c
                     elif propFilter.filter_name == "GEO":
                         matchString = ",".join(matchString.split(";"))
@@ -440,10 +440,10 @@
                     if propFilter.filter_name in ("N" , "ADR", "ORG",):
                         # for structured properties, change into multiple strings for ds query
                         if propFilter.filter_name == "ADR":
-                            #split by newline and comma
+                            # split by newline and comma
                             rawStrings = ",".join(matchString.split("\n")).split(",")
                         else:
-                            #split by space
+                            # split by space
                             rawStrings = matchString.split(" ")
 
                         # remove empty strings
@@ -460,7 +460,7 @@
                     # end getMatchStrings
 
                 if constant:
-                    #FIXME: match is not implemented in twisteddaldav.query.Filter.TextMatch so use _match for now
+                    # FIXME: match is not implemented in twisteddaldav.query.Filter.TextMatch so use _match for now
                     return textMatchElement._match([constant, ])
                 else:
 
@@ -502,7 +502,7 @@
 
                 # attribute exists search
                 return definedExpression(True, propFilterAllOf)
-                #end textMatchElementExpression()
+                # end textMatchElementExpression()
 
             # searchablePropFilterAttrNames are attributes to be used by this propfilter's expression
             searchableFields = vcardPropToSearchableFieldMap.get(propFilter.filter_name, [])
@@ -515,7 +515,7 @@
                 # return None to try to match all items if this is the only property filter
                 return None
 
-            #create a textMatchElement for the IsNotDefined qualifier
+            # create a textMatchElement for the IsNotDefined qualifier
             if isinstance(propFilter.qualifier, IsNotDefined):
                 textMatchElement = TextMatch(carddavxml.TextMatch.fromString(""))
                 textMatchElement.negate = True
@@ -544,7 +544,7 @@
                     propFilterExpressions = [CompoundExpression(propFilterExpressions, Operand.AND if propFilterAllOf else Operand.OR)]
 
             return propFilterExpressions
-            #end propFilterExpression
+            # end propFilterExpression
 
         expressions = None
         for propFilter in propFilters:
@@ -586,7 +586,7 @@
         else:
             expression = not filterAllOf
 
-    #log.debug("expressionFromABFilter: expression={q!r}, properties={pn}", q=expression, pn=properties)
+    # log.debug("expressionFromABFilter: expression={q!r}, properties={pn}", q=expression, pn=properties)
     return((properties, expression))
 
 
@@ -599,7 +599,7 @@
     def __init__(self, directoryBackedAddressBook,):
 
         self._directoryBackedAddressBook = directoryBackedAddressBook
-        #self._vCard = None
+        # self._vCard = None
 
 
     def __repr__(self):
@@ -637,7 +637,7 @@
 
 
     def hRef(self, parentURI=None):
-        return davxml.HRef.fromString(joinURL(parentURI if parentURI else  self._directoryBackedAddressBook.uri, self.uri()))
+        return davxml.HRef.fromString(joinURL(parentURI if parentURI else self._directoryBackedAddressBook.uri, self.uri()))
 
 
     def readProperty(self, property, request):
@@ -668,7 +668,7 @@
                 else:
                     modDatetime = datetime.datetime.utcnow()
 
-                #strip time zone because time zones are unimplemented in davxml.GETLastModified.fromDate
+                # strip time zone because time zones are unimplemented in davxml.GETLastModified.fromDate
                 d = modDatetime.date()
                 t = modDatetime.time()
                 modDatetimeNoTZ = datetime.datetime(d.year, d.month, d.day, t.hour, t.minute, t.second, t.microsecond, None)

Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/extensions.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -76,8 +76,10 @@
 class DirectoryPrincipalPropertySearchMixIn(object):
 
     @inlineCallbacks
-    def report_DAV__principal_property_search(self, request,
-        principal_property_search):
+    def report_DAV__principal_property_search(
+        self, request,
+        principal_property_search
+    ):
         """
         Generate a principal-property-search REPORT. (RFC 3744, section 9.4)
         Overrides twisted implementation, targeting only directory-enabled
@@ -123,8 +125,10 @@
                 propertiesForResource = prop_common.propertyListForResource
                 propElement = child
 
-            elif child.qname() == (dav_namespace,
-                "apply-to-principal-collection-set"):
+            elif child.qname() == (
+                dav_namespace,
+                "apply-to-principal-collection-set"
+            ):
                 applyTo = True
 
             elif child.qname() == (dav_namespace, "property-search"):
@@ -203,8 +207,10 @@
                 else:
                     nonDirectoryProps.append(prop)
             if nonDirectoryProps:
-                nonDirectorySearches.append((nonDirectoryProps, match,
-                    matchFlags, matchType))
+                nonDirectorySearches.append((
+                    nonDirectoryProps, match,
+                    matchFlags, matchType
+                ))
 
         matchingResources = []
         matchcount = 0
@@ -212,8 +218,10 @@
         # nonDirectorySearches are ignored
         if fields:
 
-            records = (yield dir.recordsMatchingFieldsWithCUType(fields,
-                operand=operand, cuType=cuType))
+            records = (yield dir.recordsMatchingFieldsWithCUType(
+                fields,
+                operand=operand, cuType=cuType
+            ))
 
             for record in records:
                 resource = yield principalCollection.principalForRecord(record)
@@ -251,15 +259,19 @@
                     responsecode.INSUFFICIENT_STORAGE_SPACE
                 ),
                 element.Error(element.NumberOfMatchesWithinLimits()),
-                element.ResponseDescription("Results limited by %s at %d"
-                                           % resultsWereLimited),
+                element.ResponseDescription(
+                    "Results limited by %s at %d"
+                    % resultsWereLimited
+                ),
             ))
         returnValue(MultiStatusResponse(responses))
 
 
     @inlineCallbacks
-    def report_http___calendarserver_org_ns__calendarserver_principal_search(self, request,
-        calendarserver_principal_search):
+    def report_http___calendarserver_org_ns__calendarserver_principal_search(
+        self, request,
+        calendarserver_principal_search
+    ):
         """
         Generate a calendarserver-principal-search REPORT.
 
@@ -282,8 +294,10 @@
         tokens, context, applyTo, clientLimit, propElement = extractCalendarServerPrincipalSearchData(calendarserver_principal_search)
 
         if not validateTokens(tokens):
-            raise HTTPError(StatusResponse(responsecode.FORBIDDEN,
-                "Insufficient search token length"))
+            raise HTTPError(StatusResponse(
+                responsecode.FORBIDDEN,
+                "Insufficient search token length"
+            ))
 
         # Run report
         resultsWereLimited = None
@@ -342,8 +356,10 @@
                     responsecode.INSUFFICIENT_STORAGE_SPACE
                 ),
                 element.Error(element.NumberOfMatchesWithinLimits()),
-                element.ResponseDescription("Results limited by %s at %d"
-                                           % resultsWereLimited),
+                element.ResponseDescription(
+                    "Results limited by %s at %d"
+                    % resultsWereLimited
+                ),
             ))
         returnValue(MultiStatusResponse(responses))
 
@@ -868,7 +884,8 @@
 
 class PropertyNotFoundError (HTTPError):
     def __init__(self, qname):
-        HTTPError.__init__(self,
+        HTTPError.__init__(
+            self,
             StatusResponse(
                 responsecode.NOT_FOUND,
                 "No such property: %s" % encodeXMLName(*qname)
@@ -890,7 +907,7 @@
 
 
     def get(self, qname, uid=None):
-        #self.log.debug("Get: %r, %r" % (self.resource.fp.path, qname))
+        # self.log.debug("Get: %r, %r" % (self.resource.fp.path, qname))
 
         cache = self._cache()
 
@@ -913,7 +930,7 @@
 
 
     def set(self, property, uid=None):
-        #self.log.debug("Set: %r, %r" % (self.resource.fp.path, property))
+        # self.log.debug("Set: %r, %r" % (self.resource.fp.path, property))
 
         cache = self._cache()
 
@@ -925,7 +942,7 @@
 
 
     def contains(self, qname, uid=None):
-        #self.log.debug("Contains: %r, %r" % (self.resource.fp.path, qname))
+        # self.log.debug("Contains: %r, %r" % (self.resource.fp.path, qname))
 
         cachedQname = qname + (uid,)
 
@@ -938,14 +955,14 @@
                 raise
 
         if cachedQname in cache:
-            #self.log.debug("Contains cache hit: %r, %r, %r" % (self, self.resource.fp.path, qname))
+            # self.log.debug("Contains cache hit: %r, %r, %r" % (self, self.resource.fp.path, qname))
             return True
         else:
             return False
 
 
     def delete(self, qname, uid=None):
-        #self.log.debug("Delete: %r, %r" % (self.resource.fp.path, qname))
+        # self.log.debug("Delete: %r, %r" % (self.resource.fp.path, qname))
 
         cachedQname = qname + (uid,)
 
@@ -956,7 +973,7 @@
 
 
     def list(self, uid=None, filterByUID=True):
-        #self.log.debug("List: %r" % (self.resource.fp.path,))
+        # self.log.debug("List: %r" % (self.resource.fp.path,))
         keys = self._cache().iterkeys()
         if filterByUID:
             return [
@@ -970,7 +987,7 @@
 
     def _cache(self):
         if not hasattr(self, "_data"):
-            #self.log.debug("Cache init: %r" % (self.resource.fp.path,))
+            # self.log.debug("Cache init: %r" % (self.resource.fp.path,))
             self._data = dict(
                 (name, None)
                 for name in self.propertyStore.list(filterByUID=False)
@@ -999,8 +1016,10 @@
         if child.qname() == (dav_namespace, "prop"):
             propElement = child
 
-        elif child.qname() == (dav_namespace,
-            "apply-to-principal-collection-set"):
+        elif child.qname() == (
+            dav_namespace,
+            "apply-to-principal-collection-set"
+        ):
             applyTo = True
 
         elif child.qname() == (calendarserver_namespace, "search-token"):

Modified: CalendarServer/trunk/twistedcaldav/instance.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/instance.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/instance.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -155,7 +155,7 @@
                     self._addMasterToDoComponent(component, lowerLimit, limit)
                     master = component
             elif component.name() == "VJOURNAL":
-                #TODO: VJOURNAL
+                # TODO: VJOURNAL
                 raise NotImplementedError("VJOURNAL recurrence expansion not supported yet")
             elif component.name() == "VFREEBUSY":
                 self._addFreeBusyComponent(component, lowerLimit, limit)
@@ -175,7 +175,7 @@
             elif component.name() == "VTODO":
                 self._addOverrideToDoComponent(component, lowerLimit, limit, master)
             elif component.name() == "VJOURNAL":
-                #TODO: VJOURNAL
+                # TODO: VJOURNAL
                 raise NotImplementedError("VJOURNAL recurrence expansion not supported yet")
             elif component.name() == "AVAILABLE":
                 # AVAILABLE components are just like VEVENT components
@@ -268,7 +268,7 @@
         @param master: the master component which has already been expanded, or C{None}.
         """
 
-        #TODO: This does not take into account THISANDPRIOR - only THISANDFUTURE
+        # TODO: This does not take into account THISANDPRIOR - only THISANDFUTURE
 
         details = self._getMasterEventDetails(component)
         if details is None:
@@ -349,7 +349,7 @@
         @param master: the master component which has already been expanded, or C{None}.
         """
 
-        #TODO: This does not take into account THISANDPRIOR - only THISANDFUTURE
+        # TODO: This does not take into account THISANDPRIOR - only THISANDFUTURE
 
         details = self._getMasterToDoDetails(component)
         if details is None:
@@ -369,8 +369,11 @@
             # Begin expansion far in the past because there may be RDATEs earlier
             # than the master DTSTART, and if we exclude those, the associated
             # overridden instances will cause an InvalidOverriddenInstance.
-            limited = rrules.expand(rulestart,
-                Period(DateTime(1900, 1, 1), upperlimit), expanded)
+            limited = rrules.expand(
+                rulestart,
+                Period(DateTime(1900, 1, 1), upperlimit),
+                expanded
+            )
             for startDate in expanded:
                 startDate = self.normalizeFunction(startDate)
                 endDate = startDate + duration

Modified: CalendarServer/trunk/twistedcaldav/localization.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/localization.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/localization.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -120,7 +120,8 @@
         key = (lang, domain, localeDir)
         self.translation = self.translations.get(key, None)
         if self.translation is None:
-            self.translation = gettext.translation(domain=domain,
+            self.translation = gettext.translation(
+                domain=domain,
                 localedir=localeDir, languages=[lang, 'en'], fallback=True)
             self.translations[key] = self.translation
 
@@ -208,9 +209,11 @@
         return (
             _("%(startTime)s to %(endTime)s")
             % {
-                'startTime'      : self.dtTime(dtStart,
-                                    includeTimezone=(tzStart != tzEnd)),
-                'endTime'        : self.dtTime(dtEnd),
+                'startTime' : self.dtTime(
+                    dtStart,
+                    includeTimezone=(tzStart != tzEnd)
+                ),
+                'endTime' : self.dtTime(dtEnd),
             },
             self.dtDuration(duration)
         )
@@ -271,8 +274,10 @@
         if days == 1:
             parts.append(_("1 day"))
         elif days > 1:
-            parts.append(_("%(dayCount)d days") %
-                {'dayCount' : days})
+            parts.append(
+                _("%(dayCount)d days") %
+                {'dayCount' : days}
+            )
 
         hours = divmod(total / 3600, 24)[1]
         minutes = divmod(total / 60, 60)[1]
@@ -281,20 +286,26 @@
         if hours == 1:
             parts.append(_("1 hour"))
         elif hours > 1:
-            parts.append(_("%(hourCount)d hours") %
-                {'hourCount' : hours})
+            parts.append(
+                _("%(hourCount)d hours") %
+                {'hourCount' : hours}
+            )
 
         if minutes == 1:
             parts.append(_("1 minute"))
         elif minutes > 1:
-            parts.append(_("%(minuteCount)d minutes") %
-                {'minuteCount' : minutes})
+            parts.append(
+                _("%(minuteCount)d minutes") %
+                {'minuteCount' : minutes}
+            )
 
         if seconds == 1:
             parts.append(_("1 second"))
         elif seconds > 1:
-            parts.append(_("%(secondCount)d seconds") %
-                {'secondCount' : seconds})
+            parts.append(
+                _("%(secondCount)d seconds") %
+                {'secondCount' : seconds}
+            )
 
         return " ".join(parts)
 
@@ -380,28 +391,37 @@
             try:
                 os.mkdir(gnuRoot)
             except OSError:
-                log.warn("Could not create gnuttext translation directory: %s"
+                log.warn(
+                    "Could not create gnuttext translation directory: %s"
                     % (gnuRoot,))
                 return
 
         # Scan for Apple translations (directories ending in .lproj)
         for item in os.listdir(lprojRoot):
             if item.endswith(".lproj"):
-                stringsFile = os.path.join(lprojRoot, item,
-                    'calendarserver.strings')
+                stringsFile = os.path.join(
+                    lprojRoot, item,
+                    'calendarserver.strings'
+                )
                 localeName = normalize(item[:-6])
-                moFile = os.path.join(gnuRoot, localeName, 'LC_MESSAGES',
-                    'calendarserver.mo')
+                moFile = os.path.join(
+                    gnuRoot, localeName, 'LC_MESSAGES',
+                    'calendarserver.mo'
+                )
                 if os.path.exists(stringsFile):
-                    if (not os.path.exists(moFile) or
+                    if (
+                        not os.path.exists(moFile) or
                         os.stat(stringsFile).st_mtime >
-                        os.stat(moFile).st_mtime):
+                        os.stat(moFile).st_mtime
+                    ):
                         log.info("Converting %s to %s" % (stringsFile, moFile))
                         try:
                             convertStringsFile(stringsFile, moFile)
                         except Exception, e:
-                            log.error("Failed to convert %s to %s: %s" %
-                                (stringsFile, moFile, e))
+                            log.error(
+                                "Failed to convert %s to %s: %s" %
+                                (stringsFile, moFile, e)
+                            )
                     else:
                         log.info("%s is up to date" % (moFile,))
 
@@ -447,8 +467,12 @@
         origStr = original.encode("UTF-8")
         transStr = translation.encode("UTF-8")
 
-        descriptors.append((len(keys), len(origStr), len(values),
-            len(transStr)))
+        descriptors.append(
+            (
+                len(keys), len(origStr), len(values),
+                len(transStr)
+            )
+        )
         keys += origStr + '\0' # <NUL> terminated
         values += transStr + '\0'
 

Modified: CalendarServer/trunk/twistedcaldav/memcacheclient.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/memcacheclient.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/memcacheclient.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -80,30 +80,36 @@
 from binascii import crc32   # zlib version is not cross-platform
 serverHashFunction = crc32
 
-__author__    = "Evan Martin <martine at danga.com>"
+__author__ = "Evan Martin <martine at danga.com>"
 __version__ = "1.44"
 __copyright__ = "Copyright (C) 2003 Danga Interactive"
-__license__   = "Python"
+__license__ = "Python"
 
 SERVER_MAX_KEY_LENGTH = 250
 #  Storing values larger than 1MB requires recompiling memcached.  If you do,
 #  this value can be changed by doing "memcacheclient.SERVER_MAX_VALUE_LENGTH = N"
 #  after importing this module.
-SERVER_MAX_VALUE_LENGTH = 1024*1024
+SERVER_MAX_VALUE_LENGTH = 1024 * 1024
 
 class _Error(Exception):
     pass
 
+
+
 class MemcacheError(_Error):
     """
     Memcache connection error
     """
 
+
+
 class NotFoundError(MemcacheError):
     """
     NOT_FOUND error
     """
 
+
+
 class TokenMismatchError(MemcacheError):
     """
     Check-and-set token mismatch
@@ -117,27 +123,34 @@
     class local(object):
         pass
 
+
+
 class ClientFactory(object):
 
     # unit tests should set this to True to enable the fake test cache
     allowTestCache = False
 
     @classmethod
-    def getClient(cls, servers, debug=0, pickleProtocol=0,
-                 pickler=pickle.Pickler, unpickler=pickle.Unpickler,
-                 pload=None, pid=None):
+    def getClient(
+        cls, servers, debug=0, pickleProtocol=0,
+        pickler=pickle.Pickler, unpickler=pickle.Unpickler,
+        pload=None, pid=None
+    ):
 
         if cls.allowTestCache:
-            return TestClient(servers, debug=debug,
+            return TestClient(
+                servers, debug=debug,
                 pickleProtocol=pickleProtocol, pickler=pickler,
                 unpickler=unpickler, pload=pload, pid=pid)
         elif config.Memcached.Pools.Default.ClientEnabled:
-            return Client(servers, debug=debug, pickleProtocol=pickleProtocol,
+            return Client(
+                servers, debug=debug, pickleProtocol=pickleProtocol,
                 pickler=pickler, unpickler=unpickler, pload=pload, pid=pid)
         else:
             return None
 
 
+
 class Client(local):
     """
     Object representing a pool of memcache servers.
@@ -159,27 +172,38 @@
     @sort: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog,\
            set, set_multi, add, replace, get, get_multi, incr, decr, delete, delete_multi
     """
-    _FLAG_PICKLE  = 1<<0
-    _FLAG_INTEGER = 1<<1
-    _FLAG_LONG    = 1<<2
-    _FLAG_COMPRESSED = 1<<3
+    _FLAG_PICKLE = 1 << 0
+    _FLAG_INTEGER = 1 << 1
+    _FLAG_LONG = 1 << 2
+    _FLAG_COMPRESSED = 1 << 3
 
     _SERVER_RETRIES = 10  # how many times to try finding a free server.
 
     # exceptions for Client
     class MemcachedKeyError(Exception):
         pass
+
+
     class MemcachedKeyLengthError(MemcachedKeyError):
         pass
+
+
     class MemcachedKeyCharacterError(MemcachedKeyError):
         pass
+
+
     class MemcachedKeyNoneError(MemcachedKeyError):
         pass
+
+
     class MemcachedKeyTypeError(MemcachedKeyError):
         pass
+
+
     class MemcachedStringEncodingError(Exception):
         pass
 
+
     def __init__(self, servers, debug=0, pickleProtocol=0,
                  pickler=pickle.Pickler, unpickler=pickle.Unpickler,
                  pload=None, pid=None):
@@ -212,11 +236,12 @@
         #  figure out the pickler style
         file = StringIO()
         try:
-            pickler = self.pickler(file, protocol = self.pickleProtocol)
+            pickler = self.pickler(file, protocol=self.pickleProtocol)
             self.picklerIsKeyword = True
         except TypeError:
             self.picklerIsKeyword = False
 
+
     def set_servers(self, servers):
         """
         Set the pool of servers used by this client.
@@ -230,6 +255,7 @@
         self.servers = [_Host(s, self.debuglog) for s in servers]
         self._init_buckets()
 
+
     def get_stats(self):
         '''Get statistics from each of the servers.
 
@@ -240,64 +266,74 @@
         '''
         data = []
         for s in self.servers:
-            if not s.connect(): continue
+            if not s.connect():
+                continue
             if s.family == socket.AF_INET:
-                name = '%s:%s (%s)' % ( s.ip, s.port, s.weight )
+                name = '%s:%s (%s)' % (s.ip, s.port, s.weight)
             else:
-                name = 'unix:%s (%s)' % ( s.address, s.weight )
+                name = 'unix:%s (%s)' % (s.address, s.weight)
             s.send_cmd('stats')
             serverData = {}
-            data.append(( name, serverData ))
+            data.append((name, serverData))
             readline = s.readline
             while 1:
                 line = readline()
-                if not line or line.strip() == 'END': break
+                if not line or line.strip() == 'END':
+                    break
                 stats = line.split(' ', 2)
                 serverData[stats[1]] = stats[2]
 
         return(data)
 
+
     def get_slabs(self):
         data = []
         for s in self.servers:
-            if not s.connect(): continue
+            if not s.connect():
+                continue
             if s.family == socket.AF_INET:
-                name = '%s:%s (%s)' % ( s.ip, s.port, s.weight )
+                name = '%s:%s (%s)' % (s.ip, s.port, s.weight)
             else:
-                name = 'unix:%s (%s)' % ( s.address, s.weight )
+                name = 'unix:%s (%s)' % (s.address, s.weight)
             serverData = {}
-            data.append(( name, serverData ))
+            data.append((name, serverData))
             s.send_cmd('stats items')
             readline = s.readline
             while 1:
                 line = readline()
-                if not line or line.strip() == 'END': break
+                if not line or line.strip() == 'END':
+                    break
                 item = line.split(' ', 2)
-                #0 = STAT, 1 = ITEM, 2 = Value
+                # 0 = STAT, 1 = ITEM, 2 = Value
                 slab = item[1].split(':', 2)
-                #0 = items, 1 = Slab #, 2 = Name
-                if not serverData.has_key(slab[1]):
+                # 0 = items, 1 = Slab #, 2 = Name
+                if slab[1] not in serverData:
                     serverData[slab[1]] = {}
                 serverData[slab[1]][slab[2]] = item[2]
         return data
 
+
     def flush_all(self):
         'Expire all data currently in the memcache servers.'
         for s in self.servers:
-            if not s.connect(): continue
+            if not s.connect():
+                continue
             s.send_cmd('flush_all')
             s.expect("OK")
 
+
     def debuglog(self, str):
         if self.debug:
             sys.stderr.write("MemCached: %s\n" % str)
 
+
     def _statlog(self, func):
-        if not self.stats.has_key(func):
+        if func not in self.stats:
             self.stats[func] = 1
         else:
             self.stats[func] += 1
 
+
     def forget_dead_hosts(self):
         """
         Reset every host in the pool to an "alive" state.
@@ -305,14 +341,16 @@
         for s in self.servers:
             s.deaduntil = 0
 
+
     def _init_buckets(self):
         self.buckets = []
         for server in self.servers:
-            for i in range(server.weight):
+            for _ignroe_i in range(server.weight):
                 self.buckets.append(server)
 
+
     def _get_server(self, key):
-        if type(key) == types.TupleType:
+        if isinstance(key, tuple):
             serverhash, key = key
         else:
             serverhash = serverHashFunction(key)
@@ -320,16 +358,18 @@
         for i in range(Client._SERVER_RETRIES):
             server = self.buckets[serverhash % len(self.buckets)]
             if server.connect():
-                #print("(using server %s)" % server, end="")
+                # print("(using server %s)" % server, end="")
                 return server, key
             serverhash = serverHashFunction(str(serverhash) + str(i))
         log.error("Memcacheclient _get_server( ) failed to connect")
         return None, None
 
+
     def disconnect_all(self):
         for s in self.servers:
             s.close_socket()
 
+
     def delete_multi(self, keys, time=0, key_prefix=''):
         '''
         Delete multiple keys in the memcache doing just one query.
@@ -359,7 +399,7 @@
 
         self._statlog('delete_multi')
 
-        server_keys, prefixed_to_orig_key = self._map_and_prefix_keys(keys, key_prefix)
+        server_keys, _ignore_prefixed_to_orig_key = self._map_and_prefix_keys(keys, key_prefix)
 
         # send out all requests on each server before reading anything
         dead_servers = []
@@ -369,16 +409,17 @@
             bigcmd = []
             write = bigcmd.append
             if time != None:
-                 for key in server_keys[server]: # These are mangled keys
-                     write("delete %s %d\r\n" % (key, time))
+                for key in server_keys[server]: # These are mangled keys
+                    write("delete %s %d\r\n" % (key, time))
             else:
                 for key in server_keys[server]: # These are mangled keys
-                  write("delete %s\r\n" % key)
+                    write("delete %s\r\n" % key)
             try:
                 server.send_cmds(''.join(bigcmd))
             except socket.error, msg:
                 rc = 0
-                if type(msg) is types.TupleType: msg = msg[1]
+                if isinstance(msg, tuple):
+                    msg = msg[1]
                 server.mark_dead(msg)
                 dead_servers.append(server)
 
@@ -391,11 +432,13 @@
                 for key in keys:
                     server.expect("DELETED")
             except socket.error, msg:
-                if type(msg) is types.TupleType: msg = msg[1]
+                if isinstance(msg, tuple):
+                    msg = msg[1]
                 server.mark_dead(msg)
                 rc = 0
         return rc
 
+
     def delete(self, key, time=0):
         '''Deletes a key from the memcache.
 
@@ -417,11 +460,13 @@
             server.send_cmd(cmd)
             server.expect("DELETED")
         except socket.error, msg:
-            if type(msg) is types.TupleType: msg = msg[1]
+            if isinstance(msg, tuple):
+                msg = msg[1]
             server.mark_dead(msg)
             return 0
         return 1
 
+
     def incr(self, key, delta=1):
         """
         Sends a command to the server to atomically increment the value for C{key} by
@@ -447,6 +492,7 @@
         """
         return self._incrdecr("incr", key, delta)
 
+
     def decr(self, key, delta=1):
         """
         Like L{incr}, but decrements.  Unlike L{incr}, underflow is checked and
@@ -459,6 +505,7 @@
         """
         return self._incrdecr("decr", key, delta)
 
+
     def _incrdecr(self, cmd, key, delta):
         check_key(key)
         server, key = self._get_server(key)
@@ -471,11 +518,13 @@
             line = server.readline()
             return int(line)
         except socket.error, msg:
-            if type(msg) is types.TupleType: msg = msg[1]
+            if isinstance(msg, tuple):
+                msg = msg[1]
             server.mark_dead(msg)
             return None
 
-    def add(self, key, val, time = 0, min_compress_len = 0):
+
+    def add(self, key, val, time=0, min_compress_len=0):
         '''
         Add new key with value.
 
@@ -486,6 +535,7 @@
         '''
         return self._set("add", key, val, time, min_compress_len)
 
+
     def append(self, key, val, time=0, min_compress_len=0):
         '''Append the value to the end of the existing key's value.
 
@@ -497,6 +547,7 @@
         '''
         return self._set("append", key, val, time, min_compress_len)
 
+
     def prepend(self, key, val, time=0, min_compress_len=0):
         '''Prepend the value to the beginning of the existing key's value.
 
@@ -508,6 +559,7 @@
         '''
         return self._set("prepend", key, val, time, min_compress_len)
 
+
     def replace(self, key, val, time=0, min_compress_len=0):
         '''Replace existing key with value.
 
@@ -519,6 +571,7 @@
         '''
         return self._set("replace", key, val, time, min_compress_len)
 
+
     def set(self, key, val, time=0, min_compress_len=0, token=None):
         '''Unconditionally sets a key to a given value in the memcache.
 
@@ -553,7 +606,7 @@
 
         """
         # Check it just once ...
-        key_extra_len=len(key_prefix)
+        key_extra_len = len(key_prefix)
         if key_prefix:
             check_key(key_prefix)
 
@@ -563,7 +616,7 @@
         prefixed_to_orig_key = {}
         # build up a list for each server of all the keys we want.
         for orig_key in key_iterable:
-            if type(orig_key) is types.TupleType:
+            if isinstance(orig_key, tuple):
                 # Tuple of hashvalue, key ala _get_server(). Caller is essentially telling us what server to stuff this on.
                 # Ensure call to _get_server gets a Tuple as well.
                 str_orig_key = str(orig_key[1])
@@ -578,13 +631,14 @@
             if not server:
                 continue
 
-            if not server_keys.has_key(server):
+            if server not in server_keys:
                 server_keys[server] = []
             server_keys[server].append(key)
             prefixed_to_orig_key[key] = orig_key
 
         return (server_keys, prefixed_to_orig_key)
 
+
     def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
         '''
         Sets multiple keys in the memcache doing just one query.
@@ -628,8 +682,6 @@
 
         self._statlog('set_multi')
 
-
-
         server_keys, prefixed_to_orig_key = self._map_and_prefix_keys(mapping.iterkeys(), key_prefix)
 
         # send out all requests on each server before reading anything
@@ -644,7 +696,8 @@
                     write("set %s %d %d %d\r\n%s\r\n" % (key, store_info[0], time, store_info[1], store_info[2]))
                 server.send_cmds(''.join(bigcmd))
             except socket.error, msg:
-                if type(msg) is types.TupleType: msg = msg[1]
+                if isinstance(msg, tuple):
+                    msg = msg[1]
                 server.mark_dead(msg)
                 dead_servers.append(server)
 
@@ -653,7 +706,8 @@
             del server_keys[server]
 
         #  short-circuit if there are no servers, just return all keys
-        if not server_keys: return(mapping.keys())
+        if not server_keys:
+            return(mapping.keys())
 
         notstored = [] # original keys.
         for server, keys in server_keys.iteritems():
@@ -663,12 +717,14 @@
                     if line == 'STORED':
                         continue
                     else:
-                        notstored.append(prefixed_to_orig_key[key]) #un-mangle.
+                        notstored.append(prefixed_to_orig_key[key]) # un-mangle.
             except (_Error, socket.error), msg:
-                if type(msg) is types.TupleType: msg = msg[1]
+                if isinstance(msg, tuple):
+                    msg = msg[1]
                 server.mark_dead(msg)
         return notstored
 
+
     def _val_to_store_info(self, val, min_compress_len):
         """
            Transform val to a storable representation, returning a tuple of the flags, the length of the new value, and the new value itself.
@@ -690,7 +746,7 @@
             flags |= Client._FLAG_PICKLE
             file = StringIO()
             if self.picklerIsKeyword:
-                pickler = self.pickler(file, protocol = self.pickleProtocol)
+                pickler = self.pickler(file, protocol=self.pickleProtocol)
             else:
                 pickler = self.pickler(file, self.pickleProtocol)
             if self.persistent_id:
@@ -710,11 +766,13 @@
                 val = comp_val
 
         #  silently do not store if value length exceeds maximum
-        if len(val) >= SERVER_MAX_VALUE_LENGTH: return(0)
+        if len(val) >= SERVER_MAX_VALUE_LENGTH:
+            return(0)
 
         return (flags, len(val), val)
 
-    def _set(self, cmd, key, val, time, min_compress_len = 0, token=None):
+
+    def _set(self, cmd, key, val, time, min_compress_len=0, token=None):
         check_key(key)
         server, key = self._get_server(key)
         if not server:
@@ -723,7 +781,8 @@
         self._statlog(cmd)
 
         store_info = self._val_to_store_info(val, min_compress_len)
-        if not store_info: return(0)
+        if not store_info:
+            return(0)
 
         if token is not None:
             cmd = "cas"
@@ -744,16 +803,17 @@
                 log.debug("Memcacheclient check-and-set failed")
                 raise TokenMismatchError(key)
 
-            log.error("Memcacheclient %s command failed with result (%s)" %
-                (cmd, result))
+            log.error("Memcacheclient %s command failed with result (%s)" % (cmd, result))
 
             return False
 
         except socket.error, msg:
-            if type(msg) is types.TupleType: msg = msg[1]
+            if isinstance(msg, tuple):
+                msg = msg[1]
             server.mark_dead(msg)
         return 0
 
+
     def get(self, key):
         '''Retrieves a key from the memcache.
 
@@ -774,11 +834,13 @@
             value = self._recv_value(server, flags, rlen)
             server.expect("END")
         except (_Error, socket.error), msg:
-            if type(msg) is types.TupleType: msg = msg[1]
+            if isinstance(msg, tuple):
+                msg = msg[1]
             server.mark_dead(msg)
             raise MemcacheError("Memcache connection error")
         return value
 
+
     def gets(self, key):
         '''Retrieves a key from the memcache.
 
@@ -799,11 +861,13 @@
             value = self._recv_value(server, flags, rlen)
             server.expect("END")
         except (_Error, socket.error), msg:
-            if type(msg) is types.TupleType: msg = msg[1]
+            if isinstance(msg, tuple):
+                msg = msg[1]
             server.mark_dead(msg)
             raise MemcacheError("Memcache connection error")
         return (value, cas_token)
 
+
     def get_multi(self, keys, key_prefix=''):
         '''
         Retrieves multiple keys from the memcache doing just one query.
@@ -852,7 +916,8 @@
             try:
                 server.send_cmd("get %s" % " ".join(server_keys[server]))
             except socket.error, msg:
-                if type(msg) is types.TupleType: msg = msg[1]
+                if isinstance(msg, tuple):
+                    msg = msg[1]
                 server.mark_dead(msg)
                 dead_servers.append(server)
 
@@ -875,10 +940,12 @@
                             pass
                     line = server.readline()
             except (_Error, socket.error), msg:
-                if type(msg) is types.TupleType: msg = msg[1]
+                if isinstance(msg, tuple):
+                    msg = msg[1]
                 server.mark_dead(msg)
         return retvals
 
+
     def gets_multi(self, keys, key_prefix=''):
         '''
         Retrieves multiple keys from the memcache doing just one query.
@@ -895,7 +962,8 @@
             try:
                 server.send_cmd("gets %s" % " ".join(server_keys[server]))
             except socket.error, msg:
-                if type(msg) is types.TupleType: msg = msg[1]
+                if isinstance(msg, tuple):
+                    msg = msg[1]
                 server.mark_dead(msg)
                 dead_servers.append(server)
 
@@ -918,34 +986,38 @@
                             pass
                     line = server.readline()
             except (_Error, socket.error), msg:
-                if type(msg) is types.TupleType: msg = msg[1]
+                if isinstance(msg, tuple):
+                    msg = msg[1]
                 server.mark_dead(msg)
         return retvals
 
+
     def _expectvalue(self, server, line=None):
         if not line:
             line = server.readline()
 
         if line[:5] == 'VALUE':
-            resp, rkey, flags, len = line.split()
+            _ignore_resp, rkey, flags, len = line.split()
             flags = int(flags)
             rlen = int(len)
             return (rkey, flags, rlen)
         else:
             return (None, None, None)
 
+
     def _expectvalue_cas(self, server, line=None):
         if not line:
             line = server.readline()
 
         if line[:5] == 'VALUE':
-            resp, rkey, flags, len, rtoken = line.split()
+            _ignore_resp, rkey, flags, len, rtoken = line.split()
             flags = int(flags)
             rlen = int(len)
             return (rkey, flags, rlen, rtoken)
         else:
             return (None, None, None, None)
 
+
     def _recv_value(self, server, flags, rlen):
         rlen += 2 # include \r\n
         buf = server.recv(rlen)
@@ -958,8 +1030,7 @@
         if flags & Client._FLAG_COMPRESSED:
             buf = decompress(buf)
 
-
-        if  flags == 0 or flags == Client._FLAG_COMPRESSED:
+        if flags == 0 or flags == Client._FLAG_COMPRESSED:
             # Either a bare string or a compressed string now decompressed...
             val = buf
         elif flags & Client._FLAG_INTEGER:
@@ -995,7 +1066,8 @@
 
         local.__init__(self)
 
-        super(TestClient, self).__init__(servers, debug=debug,
+        super(TestClient, self).__init__(
+            servers, debug=debug,
             pickleProtocol=pickleProtocol, pickler=pickler, unpickler=unpickler,
             pload=pload, pid=pid)
 
@@ -1003,19 +1075,22 @@
         self.token = 0
 
 
-
     def get_stats(self):
         raise NotImplementedError()
 
+
     def get_slabs(self):
         raise NotImplementedError()
 
+
     def flush_all(self):
         raise NotImplementedError()
 
+
     def forget_dead_hosts(self):
         raise NotImplementedError()
 
+
     def delete_multi(self, keys, time=0, key_prefix=''):
         '''
         Delete multiple keys in the memcache doing just one query.
@@ -1035,6 +1110,7 @@
             del self.data[key]
         return 1
 
+
     def delete(self, key, time=0):
         '''Deletes a key from the memcache.
 
@@ -1050,25 +1126,32 @@
     def incr(self, key, delta=1):
         raise NotImplementedError()
 
+
     def decr(self, key, delta=1):
         raise NotImplementedError()
 
-    def add(self, key, val, time = 0, min_compress_len = 0):
+
+    def add(self, key, val, time=0, min_compress_len=0):
         raise NotImplementedError()
 
+
     def append(self, key, val, time=0, min_compress_len=0):
         raise NotImplementedError()
 
+
     def prepend(self, key, val, time=0, min_compress_len=0):
         raise NotImplementedError()
 
+
     def replace(self, key, val, time=0, min_compress_len=0):
         raise NotImplementedError()
 
+
     def set(self, key, val, time=0, min_compress_len=0, token=None):
         self._statlog('set')
         return self._set("set", key, val, time, min_compress_len, token=token)
 
+
     def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
         self._statlog('set_multi')
         for key, val in mapping.iteritems():
@@ -1076,15 +1159,16 @@
             self._set("set", key, val, time, min_compress_len)
         return []
 
-    def _set(self, cmd, key, val, time, min_compress_len = 0, token=None):
+
+    def _set(self, cmd, key, val, time, min_compress_len=0, token=None):
         check_key(key)
         self._statlog(cmd)
 
         serialized = pickle.dumps(val, pickle.HIGHEST_PROTOCOL)
 
         if token is not None:
-            if self.data.has_key(key):
-                stored_val, stored_token = self.data[key]
+            if key in self.data:
+                _ignore_stored_val, stored_token = self.data[key]
                 if token != stored_token:
                     raise TokenMismatchError(key)
 
@@ -1093,12 +1177,13 @@
 
         return True
 
+
     def get(self, key):
         check_key(key)
 
         self._statlog('get')
-        if self.data.has_key(key):
-            stored_val, stored_token = self.data[key]
+        if key in self.data:
+            stored_val, _ignore_stored_token = self.data[key]
             val = pickle.loads(stored_val)
             return val
         return None
@@ -1106,12 +1191,13 @@
 
     def gets(self, key):
         check_key(key)
-        if self.data.has_key(key):
+        if key in self.data:
             stored_val, stored_token = self.data[key]
             val = pickle.loads(stored_val)
             return (val, stored_token)
         return (None, None)
 
+
     def get_multi(self, keys, key_prefix=''):
         self._statlog('get_multi')
 
@@ -1122,6 +1208,7 @@
             results[key] = val
         return results
 
+
     def gets_multi(self, keys, key_prefix=''):
         self._statlog('gets_multi')
         results = {}
@@ -1133,6 +1220,7 @@
         return results
 
 
+
 class _Host:
     _DEAD_RETRY = 1  # number of seconds before retrying a dead server.
     _SOCKET_TIMEOUT = 3  #  number of seconds before sockets timeout.
@@ -1146,10 +1234,12 @@
         #  parse the connection string
         m = re.match(r'^(?P<proto>unix):(?P<path>.*)$', host)
         if not m:
-            m = re.match(r'^(?P<proto>inet):'
-                    r'(?P<host>[^:]+)(:(?P<port>[0-9]+))?$', host)
-        if not m: m = re.match(r'^(?P<host>[^:]+):(?P<port>[0-9]+)$', host)
+            m = re.match(
+                r'^(?P<proto>inet):'
+                r'(?P<host>[^:]+)(:(?P<port>[0-9]+))?$', host)
         if not m:
+            m = re.match(r'^(?P<host>[^:]+):(?P<port>[0-9]+)$', host)
+        if not m:
             raise ValueError('Unable to parse connection string: "%s"' % host)
 
         hostData = m.groupdict()
@@ -1160,7 +1250,7 @@
             self.family = socket.AF_INET
             self.ip = hostData['host']
             self.port = int(hostData.get('port', 11211))
-            self.address = ( self.ip, self.port )
+            self.address = (self.ip, self.port)
 
         if not debugfunc:
             debugfunc = lambda x: x
@@ -1171,23 +1261,27 @@
 
         self.buffer = ''
 
+
     def _check_dead(self):
         if self.deaduntil and self.deaduntil > time.time():
             return 1
         self.deaduntil = 0
         return 0
 
+
     def connect(self):
         if self._get_socket():
             return 1
         return 0
 
+
     def mark_dead(self, reason):
         log.error("Memcacheclient socket marked dead (%s)" % (reason,))
         self.debuglog("MemCache: %s: %s.  Marking dead." % (self, reason))
         self.deaduntil = time.time() + _Host._DEAD_RETRY
         self.close_socket()
 
+
     def _get_socket(self):
         if self._check_dead():
             log.error("Memcacheclient _get_socket() found dead socket")
@@ -1195,36 +1289,40 @@
         if self.socket:
             return self.socket
         s = socket.socket(self.family, socket.SOCK_STREAM)
-        if hasattr(s, 'settimeout'): s.settimeout(self._SOCKET_TIMEOUT)
+        if hasattr(s, 'settimeout'):
+            s.settimeout(self._SOCKET_TIMEOUT)
         try:
             s.connect(self.address)
         except socket.timeout, msg:
-            log.error("Memcacheclient _get_socket() connection timed out (%s)" %
-                (msg,))
+            log.error("Memcacheclient _get_socket() connection timed out (%s)" % (msg,))
             self.mark_dead("connect: %s" % msg)
             return None
         except socket.error, msg:
-            if type(msg) is types.TupleType: msg = msg[1]
-            log.error("Memcacheclient _get_socket() connection error (%s)" %
-                (msg,))
+            if isinstance(msg, tuple):
+                msg = msg[1]
+            log.error("Memcacheclient _get_socket() connection error (%s)" % (msg,))
             self.mark_dead("connect: %s" % msg[1])
             return None
         self.socket = s
         self.buffer = ''
         return s
 
+
     def close_socket(self):
         if self.socket:
             self.socket.close()
             self.socket = None
 
+
     def send_cmd(self, cmd):
         self.socket.sendall(cmd + '\r\n')
 
+
     def send_cmds(self, cmds):
         """ cmds already has trailing \r\n's applied """
         self.socket.sendall(cmds)
 
+
     def readline(self):
         buf = self.buffer
         recv = self.socket.recv
@@ -1234,23 +1332,24 @@
                 break
             data = recv(4096)
             if not data:
-                self.mark_dead('Connection closed while reading from %s'
-                        % repr(self))
+                self.mark_dead('Connection closed while reading from %s' % repr(self))
                 break
             buf += data
         if index >= 0:
-            self.buffer = buf[index+2:]
+            self.buffer = buf[index + 2:]
             buf = buf[:index]
         else:
             self.buffer = ''
         return buf
 
+
     def expect(self, text):
         line = self.readline()
         if line != text:
             self.debuglog("while expecting '%s', got unexpected response '%s'" % (text, line))
         return line
 
+
     def recv(self, rlen):
         self_socket_recv = self.socket.recv
         buf = self.buffer
@@ -1258,11 +1357,13 @@
             foo = self_socket_recv(4096)
             buf += foo
             if len(foo) == 0:
-                raise _Error, ( 'Read %d bytes, expecting %d, '
-                        'read returned 0 length bytes' % ( len(buf), rlen ))
+                raise _Error, (
+                    'Read %d bytes, expecting %d, '
+                    'read returned 0 length bytes' % (len(buf), rlen))
         self.buffer = buf[rlen:]
         return buf[:rlen]
 
+
     def __str__(self):
         d = ''
         if self.deaduntil:
@@ -1273,6 +1374,8 @@
         else:
             return "unix:%s%s" % (self.address, d)
 
+
+
 def check_key(key, key_extra_len=0):
     """Checks sanity of key.  Fails if:
         Key length is > SERVER_MAX_KEY_LENGTH (Raises MemcachedKeyLength).
@@ -1285,26 +1388,32 @@
 
     return # Short-circuit this expensive method
 
-    if type(key) == types.TupleType: key = key[1]
+    if isinstance(key, tuple):
+        key = key[1]
     if not key:
         raise Client.MemcachedKeyNoneError, ("Key is None")
     if isinstance(key, unicode):
-        raise Client.MemcachedStringEncodingError, ("Keys must be str()'s, not "
-                "unicode.  Convert your unicode strings using "
-                "mystring.encode(charset)!")
+        raise Client.MemcachedStringEncodingError, (
+            "Keys must be str()'s, not "
+            "unicode.  Convert your unicode strings using "
+            "mystring.encode(charset)!")
     if not isinstance(key, str):
         raise Client.MemcachedKeyTypeError, ("Key must be str()'s")
 
     if isinstance(key, basestring):
         if len(key) + key_extra_len > SERVER_MAX_KEY_LENGTH:
-             raise Client.MemcachedKeyLengthError, ("Key length is > %s"
-                     % SERVER_MAX_KEY_LENGTH)
+            raise Client.MemcachedKeyLengthError, (
+                "Key length is > %s"
+                % SERVER_MAX_KEY_LENGTH)
         for char in key:
             if ord(char) < 32 or ord(char) == 127:
                 raise Client.MemcachedKeyCharacterError, "Control characters not allowed"
 
+
+
 def _doctest():
-    import doctest, memcacheclient
+    import doctest
+    from twistedcaldav import memcacheclient
     servers = ["127.0.0.1:11211"]
     mc = Client(servers, debug=1)
     globs = {"mc": mc}
@@ -1350,7 +1459,7 @@
 
         test_setget("a_string", "some random string")
         test_setget("an_integer", 42)
-        if test_setget("long", long(1<<30)):
+        if test_setget("long", long(1 << 30)):
             print("Testing delete ...", end="")
             if mc.delete("long"):
                 print("OK")
@@ -1398,7 +1507,7 @@
 
         print("Testing using insanely long key...", end="")
         try:
-            x = mc.set('a'*SERVER_MAX_KEY_LENGTH + 'aaaa', 1)
+            x = mc.set('a' * SERVER_MAX_KEY_LENGTH + 'aaaa', 1)
         except Client.MemcachedKeyLengthError, msg:
             print("OK")
         else:
@@ -1412,26 +1521,26 @@
         else:
             print("FAIL", end="")
         try:
-            x = mc.set((u'a'*SERVER_MAX_KEY_LENGTH).encode('utf-8'), 1)
+            x = mc.set((u'a' * SERVER_MAX_KEY_LENGTH).encode('utf-8'), 1)
         except:
             print("FAIL", end="")
         else:
             print("OK", end="")
         s = pickle.loads('V\\u4f1a\np0\n.')
         try:
-            x = mc.set((s*SERVER_MAX_KEY_LENGTH).encode('utf-8'), 1)
+            x = mc.set((s * SERVER_MAX_KEY_LENGTH).encode('utf-8'), 1)
         except Client.MemcachedKeyLengthError:
             print("OK")
         else:
             print("FAIL")
 
         print("Testing using a value larger than the memcached value limit...", end="")
-        x = mc.set('keyhere', 'a'*SERVER_MAX_VALUE_LENGTH)
+        x = mc.set('keyhere', 'a' * SERVER_MAX_VALUE_LENGTH)
         if mc.get('keyhere') == None:
             print("OK", end="")
         else:
             print("FAIL", end="")
-        x = mc.set('keyhere', 'a'*SERVER_MAX_VALUE_LENGTH + 'aaa')
+        x = mc.set('keyhere', 'a' * SERVER_MAX_VALUE_LENGTH + 'aaa')
         if mc.get('keyhere') == None:
             print("OK")
         else:
@@ -1451,6 +1560,6 @@
         if ret != 1:
             print("FAIL")
         else:
-          print("OK")
+            print("OK")
 
 # vim: ts=4 sw=4 et :

Modified: CalendarServer/trunk/twistedcaldav/memcacheprops.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/memcacheprops.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/memcacheprops.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -66,7 +66,8 @@
 
             cls.log.info("Instantiating memcache connection for MemcachePropertyCollection")
 
-            MemcachePropertyCollection._memcacheClient = ClientFactory.getClient([
+            MemcachePropertyCollection._memcacheClient = ClientFactory.getClient(
+                [
                     "%s:%s" % (config.Memcached.Pools.Default.BindAddress, config.Memcached.Pools.Default.Port)
                 ],
                 debug=0,
@@ -106,9 +107,9 @@
             self.log.debug("No child property cache for %s" % (child,))
             childCache, token = ({}, None)
 
-            #message = "No child property cache for %s" % (child,)
-            #self.log.error(message)
-            #raise AssertionError(message)
+            # message = "No child property cache for %s" % (child,)
+            # self.log.error(message)
+            # raise AssertionError(message)
 
         return propertyCache, key, childCache, token
 
@@ -143,8 +144,10 @@
             for childName in childNames
         ))
 
-        result = self._split_gets_multi((key for key, _ignore_name in keys),
-            client.gets_multi)
+        result = self._split_gets_multi(
+            (key for key, _ignore_name in keys),
+            client.gets_multi
+        )
 
         if abortIfMissing:
             missing = "missing "
@@ -227,8 +230,10 @@
 
         client = self.memcacheClient()
         if client is not None:
-            self._split_set_multi(values, client.set_multi,
-                time=self.cacheTimeout)
+            self._split_set_multi(
+                values, client.set_multi,
+                time=self.cacheTimeout
+            )
 
 
     def _buildCache(self, childNames=None):
@@ -277,8 +282,10 @@
             retries = 10
             while retries:
                 try:
-                    if client.set(key, childCache, time=self.cacheTimeout,
-                        token=token):
+                    if client.set(
+                        key, childCache, time=self.cacheTimeout,
+                        token=token
+                    ):
                         # Success
                         break
 

Modified: CalendarServer/trunk/twistedcaldav/memcacher.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/memcacher.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/memcacher.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -154,7 +154,7 @@
             self._clock += seconds
 
 
-    #TODO: an sqlite based cacher that can be used for multiple instance servers
+    # TODO: an sqlite based cacher that can be used for multiple instance servers
     # in the absence of memcached. This is not ideal and we may want to not implement
     # this, but it is being documented for completeness.
     #

Modified: CalendarServer/trunk/twistedcaldav/method/mkcol.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/mkcol.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/method/mkcol.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -154,8 +154,10 @@
                 raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
             # Make sure feature is enabled
-            if (rtype == "calendar" and not config.EnableCalDAV or
-                rtype == "addressbook" and not config.EnableCardDAV):
+            if (
+                rtype == "calendar" and not config.EnableCalDAV or
+                rtype == "addressbook" and not config.EnableCardDAV
+            ):
                 error = "{DAV:}resourcetype property in MKCOL request body not supported: %s" % (mkcol,)
                 log.error("Error: {err}", err=error)
                 raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
@@ -184,8 +186,8 @@
             # Clean up
             errors.error()
             raise HTTPError(Response(
-                    code=responsecode.FORBIDDEN,
-                    stream=mkcolxml.MakeCollectionResponse(errors.response()).toxml()
+                code=responsecode.FORBIDDEN,
+                stream=mkcolxml.MakeCollectionResponse(errors.response()).toxml()
             ))
 
         # When calendar collections are single component only, default MKCALENDAR is VEVENT only

Modified: CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -178,18 +178,18 @@
 
         if not addrresource.isAddressBookCollection():
 
-            #do UID lookup on last part of uri
+            # do UID lookup on last part of uri
             resource_name = urllib.unquote(uri[uri.rfind("/") + 1:])
             if resource_name.endswith(".vcf") and len(resource_name) > 4:
 
                 # see if parent is directory backed address book
-                parent = (yield  addrresource.locateParent(request, uri))
+                parent = (yield addrresource.locateParent(request, uri))
 
         # Check whether supplied resource is an address book or an address book object resource
         if addrresource.isAddressBookCollection():
 
             if addrresource.isDirectoryBackedAddressBookCollection():
-                yield  maybeDeferred(queryDirectoryBackedAddressBook, addrresource, filter)
+                yield maybeDeferred(queryDirectoryBackedAddressBook, addrresource, filter)
 
             else:
 
@@ -240,17 +240,17 @@
             if resource_name.endswith(".vcf") and len(resource_name) > 4:
 
                 # see if parent is directory backed address book
-                parent = (yield  addrresource.locateParent(request, uri))
+                parent = (yield addrresource.locateParent(request, uri))
 
                 if parent.isDirectoryBackedAddressBookCollection():
 
                     vCardFilter = carddavxml.Filter(*[carddavxml.PropertyFilter(
-                                                carddavxml.TextMatch.fromString(resource_name[:-4]),
-                                                name="UID", # attributes
-                                                ), ])
+                        carddavxml.TextMatch.fromString(resource_name[:-4]),
+                        name="UID", # attributes
+                    ), ])
                     vCardFilter = Filter(vCardFilter)
 
-                    yield  maybeDeferred(queryDirectoryBackedAddressBook, parent, vCardFilter)
+                    yield maybeDeferred(queryDirectoryBackedAddressBook, parent, vCardFilter)
                     handled = True
 
             if not handled:
@@ -267,11 +267,11 @@
     except NumberOfMatchesWithinLimits, e:
         self.log.info("Too many matching components in addressbook-query report. Limited to {limit} items", limit=e.maxLimit())
         responses.append(davxml.StatusResponse(
-                        davxml.HRef.fromString(request.uri),
-                        davxml.Status.fromResponseCode(responsecode.INSUFFICIENT_STORAGE_SPACE),
-                        davxml.Error(davxml.NumberOfMatchesWithinLimits()),
-                        davxml.ResponseDescription("Results limited to {limit} items".format(limit=e.maxLimit())),
-                    ))
+            davxml.HRef.fromString(request.uri),
+            davxml.Status.fromResponseCode(responsecode.INSUFFICIENT_STORAGE_SPACE),
+            davxml.Error(davxml.NumberOfMatchesWithinLimits()),
+            davxml.ResponseDescription("Results limited to {limit} items".format(limit=e.maxLimit())),
+        ))
 
     if not hasattr(request, "extendedLogItems"):
         request.extendedLogItems = {}

Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_common.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/method/report_common.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -574,14 +574,14 @@
 
         # Create fake filter element to match time-range
         filter = caldavxml.Filter(
-                      caldavxml.ComponentFilter(
-                          caldavxml.ComponentFilter(
-                              cache_timerange if caching else timerange,
-                              name=("VEVENT", "VFREEBUSY", "VAVAILABILITY"),
-                          ),
-                          name="VCALENDAR",
-                       )
-                  )
+            caldavxml.ComponentFilter(
+                caldavxml.ComponentFilter(
+                    cache_timerange if caching else timerange,
+                    name=("VEVENT", "VFREEBUSY", "VAVAILABILITY"),
+                ),
+                name="VCALENDAR",
+            )
+        )
         filter = Filter(filter)
         tzinfo = filter.settimezone(tz)
 

Modified: CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -252,9 +252,9 @@
                         textMatchElement = carddavxml.TextMatch.fromString(resource_name[:-4])
                         textMatchElement.attributes["match-type"] = "equals" # do equals compare. Default is "contains"
                         vCardFilters.append(carddavxml.PropertyFilter(
-                                                textMatchElement,
-                                                name="UID", # attributes
-                                            ))
+                            textMatchElement,
+                            name="UID", # attributes
+                        ))
                     else:
                         responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_FOUND)))
 
@@ -265,7 +265,7 @@
                 addressBookFilter = carddavxml.Filter(*vCardFilters)
                 addressBookFilter = Filter(addressBookFilter)
 
-                #get vCards and filter
+                # get vCards and filter
                 limit = config.DirectoryAddressBook.MaxQueryResults
                 results, limited = (yield self.doAddressBookDirectoryQuery(addressBookFilter, propertyreq, limit, defaultKind=None))
                 if limited:

Modified: CalendarServer/trunk/twistedcaldav/notifications.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/notifications.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/notifications.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -37,7 +37,6 @@
 
 import json
 import os
-import types
 
 log = Logger()
 
@@ -172,7 +171,8 @@
 
     def addOrUpdateRecord(self, record):
 
-        self._db_execute("""insert or replace into NOTIFICATIONS (UID, NAME, TYPE)
+        self._db_execute(
+            """insert or replace into NOTIFICATIONS (UID, NAME, TYPE)
             values (:1, :2, :3)
             """, record.uid, record.name, json.dumps(record.notificationtype),
         )
@@ -328,4 +328,6 @@
 
     def _makeRecord(self, row):
 
-        return NotificationRecord(*[str(item) if type(item) == types.UnicodeType else item for item in row])
+        return NotificationRecord(
+            *[str(item) if isinstance(item, unicode) else item for item in row]
+        )

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -425,10 +425,10 @@
                 # These are "live" properties in the sense of WebDAV, however "live" for twext actually means
                 # ones that are also always present, but the default alarm properties are allowed to be absent
                 # and are in fact stored in the property store.
-                #caldavxml.DefaultAlarmVEventDateTime.qname(),
-                #caldavxml.DefaultAlarmVEventDate.qname(),
-                #caldavxml.DefaultAlarmVToDoDateTime.qname(),
-                #caldavxml.DefaultAlarmVToDoDate.qname(),
+                # caldavxml.DefaultAlarmVEventDateTime.qname(),
+                # caldavxml.DefaultAlarmVEventDate.qname(),
+                # caldavxml.DefaultAlarmVToDoDateTime.qname(),
+                # caldavxml.DefaultAlarmVToDoDate.qname(),
 
                 customxml.PubSubXMPPPushKeyProperty.qname(),
             )
@@ -1414,9 +1414,9 @@
             raise HTTPError(StatusResponse(responsecode.NOT_ALLOWED, "File exists"))
 
         # newStore guarantees that we always have a parent calendar home
-        #if not self.fp.parent().isdir():
-        #    log.error("Attempt to create collection with no parent: %s" % (self.fp.path,))
-        #    raise HTTPError(StatusResponse(responsecode.CONFLICT, "No parent collection"))
+        # if not self.fp.parent().isdir():
+        #     log.error("Attempt to create collection with no parent: %s" % (self.fp.path,))
+        #     raise HTTPError(StatusResponse(responsecode.CONFLICT, "No parent collection"))
 
         #
         # Verify that no parent collection is a calendar also
@@ -1503,9 +1503,9 @@
             raise HTTPError(StatusResponse(responsecode.NOT_ALLOWED, "File exists"))
 
         # newStore guarantees that we always have a parent calendar home
-        #if not os.path.isdir(os.path.dirname(self.fp.path)):
-        #    log.error("Attempt to create collection with no parent: %s" % (self.fp.path,))
-        #    raise HTTPError(StatusResponse(responsecode.CONFLICT, "No parent collection"))
+        # if not os.path.isdir(os.path.dirname(self.fp.path)):
+        #     log.error("Attempt to create collection with no parent: %s" % (self.fp.path,))
+        #     raise HTTPError(StatusResponse(responsecode.CONFLICT, "No parent collection"))
 
         #
         # Verify that no parent collection is a calendar also
@@ -1881,7 +1881,7 @@
             if name == "addressbook-home-set":
                 returnValue(carddavxml.AddressBookHomeSet(
                     *[element.HRef(abhome_url) for abhome_url in self.addressBookHomeURLs()]
-                 ))
+                ))
             elif name == "directory-gateway" and self.directoryAddressBookEnabled():
                 returnValue(carddavxml.DirectoryGateway(
                     element.HRef.fromString(joinURL("/", config.DirectoryAddressBook.name, "/"))
@@ -2289,8 +2289,10 @@
             returnValue(None)
 
         elif qname == (customxml.calendarserver_namespace, "pushkey"):
-            if (config.Notifications.Services.AMP.Enabled or
-                config.Notifications.Services.APNS.Enabled):
+            if (
+                config.Notifications.Services.AMP.Enabled or
+                config.Notifications.Services.APNS.Enabled
+            ):
                 notifier = self._newStoreHome.getNotifier("push")
                 if notifier is not None:
                     returnValue(customxml.PubSubXMPPPushKeyProperty(notifier.nodeName()))
@@ -2429,10 +2431,10 @@
             # These are "live" properties in the sense of WebDAV, however "live" for twext actually means
             # ones that are also always present, but the default alarm properties are allowed to be absent
             # and are in fact stored in the property store.
-            #caldavxml.DefaultAlarmVEventDateTime.qname(),
-            #caldavxml.DefaultAlarmVEventDate.qname(),
-            #caldavxml.DefaultAlarmVToDoDateTime.qname(),
-            #caldavxml.DefaultAlarmVToDoDate.qname(),
+            # caldavxml.DefaultAlarmVEventDateTime.qname(),
+            # caldavxml.DefaultAlarmVEventDate.qname(),
+            # caldavxml.DefaultAlarmVToDoDateTime.qname(),
+            # caldavxml.DefaultAlarmVToDoDate.qname(),
 
         )
 
@@ -2928,19 +2930,27 @@
     """ AuthenticationWrapper implementation which allows overriding
         credentialFactories on a per-resource-path basis """
 
-    def __init__(self, resource, portal,
+    def __init__(
+        self, resource, portal,
         wireEncryptedCredentialFactories, wireUnencryptedCredentialFactories,
-        loginInterfaces, overrides=None):
+        loginInterfaces, overrides=None
+    ):
 
-        super(AuthenticationWrapper, self).__init__(resource, portal,
+        super(AuthenticationWrapper, self).__init__(
+            resource, portal,
             wireEncryptedCredentialFactories, wireUnencryptedCredentialFactories,
-            loginInterfaces)
+            loginInterfaces
+        )
 
         self.overrides = {}
         if overrides:
             for path, factories in overrides.iteritems():
-                self.overrides[path] = dict([(factory.scheme, factory)
-                    for factory in factories])
+                self.overrides[path] = dict(
+                    [
+                        (factory.scheme, factory)
+                        for factory in factories
+                    ]
+                )
 
 
     def hook(self, req):
@@ -2949,8 +2959,10 @@
 
         super(AuthenticationWrapper, self).hook(req)
 
-        factories = self.overrides.get(req.path.rstrip("/"),
-            req.credentialFactories)
+        factories = self.overrides.get(
+            req.path.rstrip("/"),
+            req.credentialFactories
+        )
         req.credentialFactories = factories
 
 

Modified: CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/resource.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/resource.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -154,6 +154,7 @@
             customxml.CalendarAvailability.qname(),
         )
 
+
     def resourceType(self):
         return davxml.ResourceType.scheduleInbox
 

Modified: CalendarServer/trunk/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/storebridge.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -59,8 +59,8 @@
     TooManyAttendeesError, InvalidCalendarAccessError, ValidOrganizerError,
     InvalidPerUserDataMerge,
     AttendeeAllowedError, ResourceDeletedError, InvalidAttachmentOperation,
-    ShareeAllowedError, DuplicatePrivateCommentsError, InvalidSplit
-, AttachmentSizeTooLarge, UnknownTimezone)
+    ShareeAllowedError, DuplicatePrivateCommentsError, InvalidSplit,
+    AttachmentSizeTooLarge, UnknownTimezone)
 from txdav.carddav.iaddressbookstore import (
     KindChangeNotAllowedError, GroupWithUnsharedAddressNotAllowedError
 )
@@ -836,7 +836,7 @@
             except HTTPError, e:
                 hasPrivilege = e
 
-            #get components
+            # get components
             indexedComponents = []
             for index, xmldata in crudCreateInfo:
 
@@ -918,12 +918,12 @@
                     )
             else:
                 xmlresponses[index] = davxml.StatusResponse(
-                        davxml.HRef.fromString(href),
-                        davxml.Status.fromResponseCode(code),
-                        davxml.Error(
-                            WebDAVUnknownElement.withName(*error),
-                        ) if error else None,
-                    )
+                    davxml.HRef.fromString(href),
+                    davxml.Status.fromResponseCode(code),
+                    davxml.Error(
+                        WebDAVUnknownElement.withName(*error),
+                    ) if error else None,
+                )
 
 
     @inlineCallbacks
@@ -2659,8 +2659,10 @@
         homeUID = ownerHome.uid()
         txn = ownerHome.transaction().store().newTransaction(
             "new transaction for %s, doing: %s" % (self._newStoreObject.name(), label,))
-        newParent = (yield (yield txn.calendarHomeWithUID(homeUID))
-                             .calendarWithName(calendarName))
+        newParent = (
+            yield (yield txn.calendarHomeWithUID(homeUID))
+            .calendarWithName(calendarName)
+        )
         newObject = (yield newParent.calendarObjectWithName(objectName))
         request._newStoreTransaction = txn
         request._resourcesByURL.clear()
@@ -3323,8 +3325,8 @@
         call super and provision group share
         """
         abObjectResource = yield super(AddressBookCollectionResource, self).makeChild(name)
-        #if abObjectResource.exists() and abObjectResource._newStoreObject.shareUID() is not None:
-        #    abObjectResource = yield self.parentResource().provisionShare(abObjectResource)
+        # if abObjectResource.exists() and abObjectResource._newStoreObject.shareUID() is not None:
+        #     abObjectResource = yield self.parentResource().provisionShare(abObjectResource)
         returnValue(abObjectResource)
 
 
@@ -3434,7 +3436,7 @@
                     if ifmatch and ifmatch != etag.generate():
                         raise HTTPError(PRECONDITION_FAILED)
 
-                    #===========================================================
+                    # ===========================================================
                     # # If unshared is allowed deletes fails but crud adds works work!
                     # if (hasPrivilege is not True and not (
                     #             deleteResource.isShareeResource() or
@@ -3442,11 +3444,13 @@
                     #         )
                     #     ):
                     #     raise hasPrivilege
-                    #===========================================================
+                    # ===========================================================
 
                     # don't allow shared group deletion -> unshare
-                    if (deleteResource.isShareeResource() or
-                        deleteResource._newStoreObject.isGroupForSharedAddressBook()):
+                    if (
+                        deleteResource.isShareeResource() or
+                        deleteResource._newStoreObject.isGroupForSharedAddressBook()
+                    ):
                         raise HTTPError(FORBIDDEN)
 
                     if hasPrivilege is not True:
@@ -3675,8 +3679,10 @@
         """
         Override http_DELETE handle shared group deletion without fromParent=[davxml.Unbind()]
         """
-        if (self.isShareeResource() or
-            self.exists() and self._newStoreObject.isGroupForSharedAddressBook()):
+        if (
+            self.isShareeResource() or
+            self.exists() and self._newStoreObject.isGroupForSharedAddressBook()
+        ):
             returnValue((yield self.storeRemove(request)))
 
         returnValue((yield super(AddressBookObjectResource, self).http_DELETE(request)))

Modified: CalendarServer/trunk/twistedcaldav/test/test_addressbookmultiget.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_addressbookmultiget.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_addressbookmultiget.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -146,8 +146,10 @@
                     status = propstat.childOfType(davxml.Status)
 
                     if status.code != responsecode.OK:
-                        self.fail("REPORT failed (status %s) to locate properties: %r"
-                              % (status.code, href))
+                        self.fail(
+                            "REPORT failed (status %s) to locate properties: %r"
+                            % (status.code, href)
+                        )
 
                     properties = propstat.childOfType(davxml.PropertyContainer).children
 
@@ -187,8 +189,10 @@
                     status = response.childOfType(davxml.Status)
                 if status.code != responsecode.OK:
                     if href in okhrefs:
-                        self.fail("REPORT failed (status %s) to locate properties: %r"
-                              % (status.code, href))
+                        self.fail(
+                            "REPORT failed (status %s) to locate properties: %r"
+                            % (status.code, href)
+                        )
                     else:
                         if href in badhrefs:
                             badhrefs.remove(href)

Modified: CalendarServer/trunk/twistedcaldav/test/test_cache.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_cache.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_cache.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -254,9 +254,10 @@
 
     def test_getResponseForRequestNotInCache(self):
         d = self.rc.getResponseForRequest(StubRequest(
-                'PROPFIND',
-                '/calendars/__uids__/dreid/',
-                '/principals/__uids__/dreid/'))
+            'PROPFIND',
+            '/calendars/__uids__/dreid/',
+            '/principals/__uids__/dreid/'
+        ))
 
         d.addCallback(self.assertEquals, None)
         return d
@@ -264,9 +265,10 @@
 
     def test_getResponseForRequestInCache(self):
         d = self.rc.getResponseForRequest(StubRequest(
-                'PROPFIND',
-                '/calendars/__uids__/cdaboo/',
-                '/principals/__uids__/cdaboo/'))
+            'PROPFIND',
+            '/calendars/__uids__/cdaboo/',
+            '/principals/__uids__/cdaboo/'
+        ))
 
         d.addCallback(self.assertResponse, self.expected_response)
         return d
@@ -276,9 +278,10 @@
         self.tokens['/principals/__uids__/cdaboo/'] = 'principalToken1'
 
         d = self.rc.getResponseForRequest(StubRequest(
-                'PROPFIND',
-                '/calendars/__uids__/cdaboo/',
-                '/principals/__uids__/cdaboo/'))
+            'PROPFIND',
+            '/calendars/__uids__/cdaboo/',
+            '/principals/__uids__/cdaboo/'
+        ))
 
         d.addCallback(self.assertEquals, None)
         return d
@@ -288,9 +291,10 @@
         self.tokens['/calendars/__uids__/cdaboo/'] = 'uriToken1'
 
         d = self.rc.getResponseForRequest(StubRequest(
-                'PROPFIND',
-                '/calendars/__uids__/cdaboo/',
-                '/principals/__uids__/cdaboo/'))
+            'PROPFIND',
+            '/calendars/__uids__/cdaboo/',
+            '/principals/__uids__/cdaboo/'
+        ))
 
         d.addCallback(self.assertEquals, None)
         return d
@@ -300,9 +304,10 @@
         self.tokens['/calendars/__uids__/cdaboo/calendars/'] = 'childToken1'
 
         d = self.rc.getResponseForRequest(StubRequest(
-                'PROPFIND',
-                '/calendars/__uids__/cdaboo/',
-                '/principals/__uids__/cdaboo/'))
+            'PROPFIND',
+            '/calendars/__uids__/cdaboo/',
+            '/principals/__uids__/cdaboo/'
+        ))
 
         d.addCallback(self.assertEquals, None)
         return d
@@ -310,10 +315,11 @@
 
     def test_getResponseForDepthZero(self):
         d = self.rc.getResponseForRequest(StubRequest(
-                'PROPFIND',
-                '/calendars/__uids__/cdaboo/',
-                '/principals/__uids__/cdaboo/',
-                depth='0'))
+            'PROPFIND',
+            '/calendars/__uids__/cdaboo/',
+            '/principals/__uids__/cdaboo/',
+            depth='0'
+        ))
 
         d.addCallback(self.assertEquals, None)
         return d
@@ -321,10 +327,11 @@
 
     def test_getResponseForBody(self):
         d = self.rc.getResponseForRequest(StubRequest(
-                'PROPFIND',
-                '/calendars/__uids__/cdaboo/',
-                '/principals/__uids__/cdaboo/',
-                body='bazbax'))
+            'PROPFIND',
+            '/calendars/__uids__/cdaboo/',
+            '/principals/__uids__/cdaboo/',
+            body='bazbax'
+        ))
 
         d.addCallback(self.assertEquals, None)
         return d
@@ -332,10 +339,11 @@
 
     def test_getResponseForUnauthenticatedRequest(self):
         d = self.rc.getResponseForRequest(StubRequest(
-                'PROPFIND',
-                '/calendars/__uids__/cdaboo/',
-                '{DAV:}unauthenticated',
-                body='bazbax'))
+            'PROPFIND',
+            '/calendars/__uids__/cdaboo/',
+            '{DAV:}unauthenticated',
+            body='bazbax'
+        ))
 
         d.addCallback(self.assertEquals, None)
         return d
@@ -363,9 +371,10 @@
 
         def _assertResponse(ign):
             d1 = self.rc.getResponseForRequest(StubRequest(
-                    'PROPFIND',
-                    '/principals/__uids__/dreid/',
-                    '/principals/__uids__/dreid/'))
+                'PROPFIND',
+                '/principals/__uids__/dreid/',
+                '/principals/__uids__/dreid/'
+            ))
 
             d1.addCallback(self.assertResponse,
                            (expected_response.code,
@@ -374,9 +383,11 @@
             return d1
 
         d = self.rc.cacheResponseForRequest(
-            StubRequest('PROPFIND',
-                        '/principals/__uids__/dreid/',
-                        '/principals/__uids__/dreid/'),
+            StubRequest(
+                'PROPFIND',
+                '/principals/__uids__/dreid/',
+                '/principals/__uids__/dreid/'
+            ),
             expected_response)
 
         d.addCallback(_assertResponse)
@@ -419,23 +430,27 @@
         self.expected_response = (200, Headers({}), "Foo")
 
         expected_key = hashlib.md5(':'.join([str(t) for t in (
-                'PROPFIND',
-                '/principals/__uids__/cdaboo/',
-                '/calendars/__uids__/cdaboo/',
-                '1',
-                hash('foobar'),
-                )])).hexdigest()
+            'PROPFIND',
+            '/principals/__uids__/cdaboo/',
+            '/calendars/__uids__/cdaboo/',
+            '1',
+            hash('foobar'),
+        )])).hexdigest()
 
         memcacheStub._cache[expected_key] = (
             0, #flags
             cPickle.dumps((
-            'principalToken0',
-            StubDirectoryRecord('cdaboo').cacheToken(),
-            'uriToken0',
-            {'/calendars/__uids__/cdaboo/calendars/': 'childToken0'},
-            (self.expected_response[0],
-             dict(list(self.expected_response[1].getAllRawHeaders())),
-             self.expected_response[2]))))
+                'principalToken0',
+                StubDirectoryRecord('cdaboo').cacheToken(),
+                'uriToken0',
+                {'/calendars/__uids__/cdaboo/calendars/': 'childToken0'},
+                (
+                    self.expected_response[0],
+                    dict(list(self.expected_response[1].getAllRawHeaders())),
+                    self.expected_response[2]
+                )
+            ))
+        )
 
         self.memcacheStub = memcacheStub
 
@@ -449,25 +464,29 @@
         expected_response = (200, Headers({}), "Foobarbaz")
 
         _key = (
-                'PROPFIND',
-                '/principals/__uids__/cdaboo/',
-                '/calendars/users/cdaboo/',
-                '1',
-                hash('foobar'),
-                )
+            'PROPFIND',
+            '/principals/__uids__/cdaboo/',
+            '/calendars/users/cdaboo/',
+            '1',
+            hash('foobar'),
+        )
 
         expected_key = hashlib.md5(':'.join([str(t) for t in _key])).hexdigest()
 
         self.memcacheStub._cache[expected_key] = (
             0, #flags
             cPickle.dumps((
-                    'principalToken0',
-                    StubDirectoryRecord('cdaboo').cacheToken(),
-                    'uriToken0',
-                    {'/calendars/__uids__/cdaboo/calendars/': 'childToken0'},
-                    (expected_response[0],
-                     dict(list(expected_response[1].getAllRawHeaders())),
-                     expected_response[2]))))
+                'principalToken0',
+                StubDirectoryRecord('cdaboo').cacheToken(),
+                'uriToken0',
+                {'/calendars/__uids__/cdaboo/calendars/': 'childToken0'},
+                (
+                    expected_response[0],
+                    dict(list(expected_response[1].getAllRawHeaders())),
+                    expected_response[2]
+                )
+            ))
+        )
 
         d = self.rc.getResponseForRequest(
             StubRequest('PROPFIND',

Modified: CalendarServer/trunk/twistedcaldav/test/test_config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_config.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_config.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -276,10 +276,10 @@
 
         config.update({"DirectoryService": {"type": "twistedcaldav.test.test_config.SuperDuperAwesomeService"}})
 
-        #self.assertEquals(
-        #    config.DirectoryService.params,
-        #    SuperDuperAwesomeService.defaultParameters
-        #)
+        # self.assertEquals(
+        #     config.DirectoryService.params,
+        #     SuperDuperAwesomeService.defaultParameters
+        # )
 
     testDirectoryService_unknownType.todo = "unimplemented"
 

Modified: CalendarServer/trunk/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_icalendar.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_icalendar.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -74,16 +74,16 @@
 
 
     def test_component_equality(self):
-#        for filename in (
-#            os.path.join(self.data_dir, "Holidays", "C318A4BA-1ED0-11D9-A5E0-000A958A3252.ics"),
-#            os.path.join(self.data_dir, "Holidays.ics"),
-#        ):
-#            data = file(filename).read()
-#
-#            calendar1 = Component.fromString(data)
-#            calendar2 = Component.fromString(data)
-#
-#            self.assertEqual(calendar1, calendar2)
+        # for filename in (
+        #     os.path.join(self.data_dir, "Holidays", "C318A4BA-1ED0-11D9-A5E0-000A958A3252.ics"),
+        #     os.path.join(self.data_dir, "Holidays.ics"),
+        # ):
+        #     data = file(filename).read()
+        #
+        #     calendar1 = Component.fromString(data)
+        #     calendar2 = Component.fromString(data)
+        #
+        #     self.assertEqual(calendar1, calendar2)
 
         data1 = (
             (
@@ -334,7 +334,8 @@
 
         # Fix it
         calendar.validCalendarData(doFix=True)
-        self.assertTrue("RRULE:FREQ=DAILY;UNTIL=20110121T203000Z\r\n"
+        self.assertTrue(
+            "RRULE:FREQ=DAILY;UNTIL=20110121T203000Z\r\n"
             in str(calendar))
 
         # Now it should pass without fixing
@@ -536,14 +537,18 @@
             self.fail("Shouldn't validate for CalDAV")
 
         # Fix it
-        fixed, unfixed = calendar.validCalendarData(doFix=True,
+        fixed, unfixed = calendar.validCalendarData(
+            doFix=True,
             validateRecurrences=True)
-        self.assertEquals(fixed,
-            ["Removed earlier EXDATE: 20120201T113000",
-            "Removed earlier EXDATE: 20120202T113000",
-            "Removed earlier EXDATE: 20120214T113000",
-            "Removed earlier EXDATE: 20120215T113000",
-            "Removed earlier EXDATE: 20120216T113000"]
+        self.assertEquals(
+            fixed,
+            [
+                "Removed earlier EXDATE: 20120201T113000",
+                "Removed earlier EXDATE: 20120202T113000",
+                "Removed earlier EXDATE: 20120214T113000",
+                "Removed earlier EXDATE: 20120215T113000",
+                "Removed earlier EXDATE: 20120216T113000"
+            ]
         )
         self.assertEquals(unfixed, [])
 
@@ -3524,7 +3529,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            ("X-ITEM2",),
+                ("X-ITEM2",),
             ),
             (
                 "Non recurring - two properties",
@@ -3567,7 +3572,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            ("X-ITEM2", "X-ITEM3",),
+                ("X-ITEM2", "X-ITEM3",),
             ),
             (
                 "Non recurring - two properties - one overlap",
@@ -3610,7 +3615,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            ("X-ITEM2", "X-ITEM1",),
+                ("X-ITEM2", "X-ITEM1",),
             ),
             (
                 "Non recurring - one property",
@@ -3679,7 +3684,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            ("X-ITEM2",),
+                ("X-ITEM2",),
             ),
             (
                 "Non recurring - new override, one property",
@@ -3740,7 +3745,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            ("X-ITEM2",),
+                ("X-ITEM2",),
             ),
         )
 
@@ -5298,7 +5303,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            1, 0,
+                1, 0,
             ),
             (
                 "1.2 - valid with RDATE",
@@ -5338,7 +5343,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            0, 0,
+                0, 0,
             ),
             (
                 "2.1 - EXDATEd RECURRENCE-ID",
@@ -5378,7 +5383,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            1, 0,
+                1, 0,
             ),
             (
                 "2.2 - EXDATEd invalid RECURRENCE-ID",
@@ -5419,7 +5424,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            2, 0,
+                2, 0,
             ),
             (
                 "2.2 - EXDATEd RECURRENCE-ID with RDATE",
@@ -5461,7 +5466,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-            1, 0,
+                1, 0,
             ),
         )
 
@@ -5673,8 +5678,6 @@
                 self.fail("Valid calendar should validate")
 
 
-
-
     def test_add_exdate(self):
         data = ((
             """BEGIN:VCALENDAR
@@ -5804,9 +5807,9 @@
 
     def test_perUserData(self):
         data = (
-                    (
-                        "No per-user, not recurring 1.1",
-                        """BEGIN:VCALENDAR
+            (
+                "No per-user, not recurring 1.1",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -5821,18 +5824,18 @@
 END:VEVENT
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (True, None, None,),),
-                                ),
-                            ),
+                            ("", (True, None, None,),),
                         ),
                     ),
-                    (
-                        "Single user, not recurring 1.2",
-                        """BEGIN:VCALENDAR
+                ),
+            ),
+            (
+                "Single user, not recurring 1.2",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -5858,19 +5861,19 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                ),
-                            ),
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
                         ),
                     ),
-                    (
-                        "Two users, not recurring 1.3",
-                        """BEGIN:VCALENDAR
+                ),
+            ),
+            (
+                "Two users, not recurring 1.3",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -5903,20 +5906,20 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                    ("user02", (True, None, None,),),
-                                ),
-                            ),
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
+                            ("user02", (True, None, None,),),
                         ),
                     ),
-                    (
-                        "No per-user, simple recurring 2.1",
-                        """BEGIN:VCALENDAR
+                ),
+            ),
+            (
+                "No per-user, simple recurring 2.1",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -5931,24 +5934,24 @@
 END:VEVENT
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (False, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                ),
-                            ),
+                            ("", (False, None, None,),),
                         ),
                     ),
                     (
-                        "Single user, simple recurring 2.2",
-                        """BEGIN:VCALENDAR
+                        DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                        ),
+                    ),
+                ),
+            ),
+            (
+                "Single user, simple recurring 2.2",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -5975,26 +5978,26 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                ),
-                            ),
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
                         ),
                     ),
                     (
-                        "Two users, simple recurring 2.3",
-                        """BEGIN:VCALENDAR
+                        DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
+                        ),
+                    ),
+                ),
+            ),
+            (
+                "Two users, simple recurring 2.3",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -6028,28 +6031,28 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                    ("user02", (True, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                    ("user02", (True, None, None,),),
-                                ),
-                            ),
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
+                            ("user02", (True, None, None,),),
                         ),
                     ),
                     (
-                        "No per-user, complex recurring 3.1",
-                        """BEGIN:VCALENDAR
+                        DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
+                            ("user02", (True, None, None,),),
+                        ),
+                    ),
+                ),
+            ),
+            (
+                "No per-user, complex recurring 3.1",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -6076,36 +6079,36 @@
 END:VEVENT
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (True, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (True, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (True, None, None,),),
-                                ),
-                            ),
+                            ("", (True, None, None,),),
                         ),
                     ),
                     (
-                        "Single user, complex recurring 3.2",
-                        """BEGIN:VCALENDAR
+                        DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                        ),
+                    ),
+                    (
+                        DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (True, None, None,),),
+                        ),
+                    ),
+                    (
+                        DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (True, None, None,),),
+                        ),
+                    ),
+                ),
+            ),
+            (
+                "Single user, complex recurring 3.2",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -6150,40 +6153,40 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (True, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (True, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                ),
-                            ),
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
                         ),
                     ),
                     (
-                        "Two users, complex recurring 3.3",
-                        """BEGIN:VCALENDAR
+                        DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                            ("user01", (True, None, None,),),
+                        ),
+                    ),
+                    (
+                        DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                            ("user01", (True, None, None,),),
+                        ),
+                    ),
+                    (
+                        DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
+                        ),
+                    ),
+                ),
+            ),
+            (
+                "Two users, complex recurring 3.3",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -6248,44 +6251,44 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                    ("user02", (True, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (True, None, None,),),
-                                    ("user02", (False, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (True, None, None,),),
-                                    ("user02", (True, None, None,),),
-                                ),
-                            ),
-                            (
-                                DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, None, None,),),
-                                    ("user02", (True, None, None,),),
-                                ),
-                            ),
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
+                            ("user02", (True, None, None,),),
                         ),
                     ),
                     (
-                        "Single user, with travel time 4.1",
-                        """BEGIN:VCALENDAR
+                        DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                            ("user01", (True, None, None,),),
+                            ("user02", (False, None, None,),),
+                        ),
+                    ),
+                    (
+                        DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                            ("user01", (True, None, None,),),
+                            ("user02", (True, None, None,),),
+                        ),
+                    ),
+                    (
+                        DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
+                        (
+                            ("", (False, None, None,),),
+                            ("user01", (False, None, None,),),
+                            ("user02", (True, None, None,),),
+                        ),
+                    ),
+                ),
+            ),
+            (
+                "Single user, with travel time 4.1",
+                """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
@@ -6312,17 +6315,17 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """.replace("\n", "\r\n"),
+                (
+                    (
+                        None,
                         (
-                            (
-                                None,
-                                (
-                                    ("", (False, None, None,),),
-                                    ("user01", (False, Duration(minutes=30), None,),),
-                                ),
-                            ),
+                            ("", (False, None, None,),),
+                            ("user01", (False, Duration(minutes=30), None,),),
                         ),
                     ),
-                )
+                ),
+            ),
+        )
 
         for title, text, results in data:
             calendar = Component.fromString(text)
@@ -7331,8 +7334,9 @@
 
     def test_hasInstancesAfter(self):
         data = (
-            ("In the past (single)", False,
-"""BEGIN:VCALENDAR
+            (
+                "In the past (single)", False,
+                """BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
 PRODID:-//Apple Inc.//iCal 5.0.1//EN
@@ -7366,8 +7370,9 @@
 END:VCALENDAR
 """,
             ),
-            ("In the past (repeating)", False,
-"""
+            (
+                "In the past (repeating)", False,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7414,8 +7419,9 @@
 END:VCALENDAR
 """,
             ),
-            ("Straddling (repeating)", True,
-"""
+            (
+                "Straddling (repeating)", True,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7462,8 +7468,9 @@
 END:VCALENDAR
 """,
             ),
-            ("Future (single)", True,
-"""
+            (
+                "Future (single)", True,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7498,8 +7505,9 @@
 END:VCALENDAR
 """,
             ),
-            ("Future (repeating)", True,
-"""
+            (
+                "Future (repeating)", True,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7546,8 +7554,9 @@
 END:VCALENDAR
 """,
             ),
-            ("On the day (single)", True,
-"""
+            (
+                "On the day (single)", True,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7582,8 +7591,9 @@
 END:VCALENDAR
 """,
             ),
-            ("Long non-all-day straddling (single)", True,
-"""
+            (
+                "Long non-all-day straddling (single)", True,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7618,8 +7628,9 @@
 END:VCALENDAR
 """,
             ),
-            ("All Day in the past (repeating)", False,
-"""
+            (
+                "All Day in the past (repeating)", False,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7638,8 +7649,9 @@
 END:VCALENDAR
 """,
             ),
-            ("Straddling All Day (repeating)", True,
-"""
+            (
+                "Straddling All Day (repeating)", True,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7658,8 +7670,9 @@
 END:VCALENDAR
 """,
             ),
-            ("Straddling All Day (single multiday)", True,
-"""
+            (
+                "Straddling All Day (single multiday)", True,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7677,8 +7690,9 @@
 END:VCALENDAR
 """,
             ),
-            ("Future All Day (single)", True,
-"""
+            (
+                "Future All Day (single)", True,
+                """
 BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN
@@ -7746,26 +7760,30 @@
                         "Baz",
                         "baz",
                         "INDIVIDUAL",
-                       ("urn:x-uid:baz", "urn:uuid:baz", "http://example.com/baz")
+                        ("urn:x-uid:baz", "urn:uuid:baz", "http://example.com/baz")
                     ),
                     "urn:x-uid:buz" : (
                         "Buz",
                         "buz",
                         "INDIVIDUAL",
-                       ("urn:x-uid:buz", "urn:uuid:buz", "http://example.com/buz")
+                        ("urn:x-uid:buz", "urn:uuid:buz", "http://example.com/buz")
                     ),
                 }[cuaddr]
             )
 
         yield component.normalizeCalendarUserAddresses(lookupFunction, None, toCanonical=False)
 
-        self.assertEquals("mailto:bar at example.com",
+        self.assertEquals(
+            "mailto:bar at example.com",
             component.getAttendeeProperty(("mailto:bar at example.com",)).value())
-        self.assertEquals("/foo",
+        self.assertEquals(
+            "/foo",
             component.getAttendeeProperty(("/foo",)).value())
-        self.assertEquals("http://example.com/baz",
+        self.assertEquals(
+            "http://example.com/baz",
             component.getAttendeeProperty(("http://example.com/baz",)).value())
-        self.assertEquals("http://example.com/buz",
+        self.assertEquals(
+            "http://example.com/buz",
             component.getAttendeeProperty(("http://example.com/buz",)).value())
 
 

Modified: CalendarServer/trunk/twistedcaldav/test/test_localization.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_localization.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_localization.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -66,7 +66,8 @@
 
             self.assertEquals(_("All day"), "Allway ayday")
 
-            self.assertEquals(_("%(startTime)s to %(endTime)s") %
+            self.assertEquals(
+                _("%(startTime)s to %(endTime)s") %
                 {'startTime': 'a', 'endTime': 'b'},
                 "a otay b"
             )
@@ -100,35 +101,43 @@
 
             comp = data[0][1]
             self.assertEquals(t.date(comp), "Saturday, October 25, 2008")
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'9:15 AM to 10:15 AM (PDT)', u'1 hour 1 second'))
 
             comp = data[1][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'1:15 PM to 3:15 PM (PDT)', u'2 hours 2 seconds'))
 
             comp = data[2][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'11:05 AM to 2:15 PM (PDT)', u'3 hours 10 minutes'))
 
             comp = data[3][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 ("", u'All day'))
 
             comp = data[4][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'1:15 PM (PDT)', ""))
 
             comp = data[5][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'11:05 AM (PDT) to 6:15 PM (EDT)', u'4 hours 10 minutes'))
 
             comp = data[6][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'11:05 AM to 5:15 PM (PDT)', u'1 day 6 hours 10 minutes'))
 
             comp = data[7][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'11:05 AM to 12:15 PM (PDT)', u'2 days 1 hour 10 minutes'))
 
             self.assertEquals(t.monthAbbreviation(1), "JAN")
@@ -137,35 +146,43 @@
 
             comp = data[0][1]
             self.assertEquals(t.date(comp), 'Aturdaysay, Octoberway 25, 2008')
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'09:15 otay 10:15 (PDT)', u'1 ourhay 1 econdsay'))
 
             comp = data[1][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'13:15 otay 15:15 (PDT)', u'2 ourshay 2 econdsay'))
 
             comp = data[2][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'11:05 otay 14:15 (PDT)', u'3 ourshay 10 inutesmay'))
 
             comp = data[3][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 ("", u'Allway ayday'))
 
             comp = data[4][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'13:15 (PDT)', ""))
 
             comp = data[5][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'11:05 (PDT) otay 18:15 (EDT)', u'4 ourshay 10 inutesmay'))
 
             comp = data[6][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'11:05 otay 17:15 (PDT)', u'1 ayday 6 ourshay 10 inutesmay'))
 
             comp = data[7][1]
-            self.assertEquals(t.time(comp),
+            self.assertEquals(
+                t.time(comp),
                 (u'11:05 otay 12:15 (PDT)', u'2 aysday 1 ourhay 10 inutesmay'))
 
             self.assertEquals(t.monthAbbreviation(1), "ANJAY")

Modified: CalendarServer/trunk/twistedcaldav/test/test_memcacheprops.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_memcacheprops.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_memcacheprops.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -125,7 +125,8 @@
         child1.deadProperties().set(StubProperty("ns1:", "prop1", value="val1"))
 
         child2 = self.getColl().getChild("a")
-        self.assertEquals(child2.deadProperties().get(("ns1:", "prop1")).value,
+        self.assertEquals(
+            child2.deadProperties().get(("ns1:", "prop1")).value,
             "val1")
 
         child2.deadProperties().set(StubProperty("ns1:", "prop1", value="val2"))
@@ -133,7 +134,8 @@
         # force memcache to be consulted (once per collection per request)
         child1 = self.getColl().getChild("a")
 
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop1")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop1")).value,
             "val2")
 
 
@@ -144,11 +146,14 @@
         child1.deadProperties().set(StubProperty("ns1:", "prop2", value="val0"))
         child1.deadProperties().set(StubProperty("ns1:", "prop3", value="val0"))
 
-        self.assertEquals(child2.deadProperties().get(("ns1:", "prop1")).value,
+        self.assertEquals(
+            child2.deadProperties().get(("ns1:", "prop1")).value,
             "val0")
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop2")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop2")).value,
             "val0")
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop3")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop3")).value,
             "val0")
 
         child2.deadProperties().set(StubProperty("ns1:", "prop1", value="val1"))
@@ -158,18 +163,24 @@
         child2 = self.getColl().getChild("a")
 
         # verify properties
-        self.assertEquals(child2.deadProperties().get(("ns1:", "prop1")).value,
+        self.assertEquals(
+            child2.deadProperties().get(("ns1:", "prop1")).value,
             "val1")
-        self.assertEquals(child2.deadProperties().get(("ns1:", "prop2")).value,
+        self.assertEquals(
+            child2.deadProperties().get(("ns1:", "prop2")).value,
             "val0")
-        self.assertEquals(child2.deadProperties().get(("ns1:", "prop3")).value,
+        self.assertEquals(
+            child2.deadProperties().get(("ns1:", "prop3")).value,
             "val3")
 
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop1")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop1")).value,
             "val1")
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop2")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop2")).value,
             "val0")
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop3")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop3")).value,
             "val3")
 
 
@@ -180,11 +191,14 @@
         child1.deadProperties().set(StubProperty("ns1:", "prop2", value="val0"))
         child1.deadProperties().set(StubProperty("ns1:", "prop3", value="val0"))
 
-        self.assertEquals(child2.deadProperties().get(("ns1:", "prop1")).value,
+        self.assertEquals(
+            child2.deadProperties().get(("ns1:", "prop1")).value,
             "val0")
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop2")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop2")).value,
             "val0")
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop3")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop3")).value,
             "val0")
 
         child2.deadProperties().set(StubProperty("ns1:", "prop1", value="val1"))
@@ -192,9 +206,11 @@
         self.assertRaises(HTTPError, child1.deadProperties().get, ("ns1:", "prop1"))
 
         self.assertFalse(child1.deadProperties().contains(("ns1:", "prop1")))
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop2")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop2")).value,
             "val0")
-        self.assertEquals(child1.deadProperties().get(("ns1:", "prop3")).value,
+        self.assertEquals(
+            child1.deadProperties().get(("ns1:", "prop3")).value,
             "val0")
 
         # force memcache to be consulted (once per collection per request)
@@ -202,9 +218,11 @@
 
         # verify properties
         self.assertFalse(child2.deadProperties().contains(("ns1:", "prop1")))
-        self.assertEquals(child2.deadProperties().get(("ns1:", "prop2")).value,
+        self.assertEquals(
+            child2.deadProperties().get(("ns1:", "prop2")).value,
             "val0")
-        self.assertEquals(child2.deadProperties().get(("ns1:", "prop3")).value,
+        self.assertEquals(
+            child2.deadProperties().get(("ns1:", "prop3")).value,
             "val0")
 
 
@@ -215,7 +233,8 @@
             child1.deadProperties().set(StubProperty("ns1:", "prop1", value="val1%s" % (uid if uid else "",)), uid=uid)
 
             child2 = self.getColl().getChild("a")
-            self.assertEquals(child2.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
+            self.assertEquals(
+                child2.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
                 "val1%s" % (uid if uid else "",))
 
             child2.deadProperties().set(StubProperty("ns1:", "prop1", value="val2%s" % (uid if uid else "",)), uid=uid)
@@ -223,7 +242,8 @@
             # force memcache to be consulted (once per collection per request)
             child1 = self.getColl().getChild("a")
 
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
                 "val2%s" % (uid if uid else "",))
 
 
@@ -236,11 +256,14 @@
             child1.deadProperties().set(StubProperty("ns1:", "prop2", value="val0%s" % (uid if uid else "",)), uid=uid)
             child1.deadProperties().set(StubProperty("ns1:", "prop3", value="val0%s" % (uid if uid else "",)), uid=uid)
 
-            self.assertEquals(child2.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
+            self.assertEquals(
+                child2.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
 
             child2.deadProperties().set(StubProperty("ns1:", "prop1", value="val1%s" % (uid if uid else "",)), uid=uid)
@@ -250,18 +273,24 @@
             child2 = self.getColl().getChild("a")
 
             # verify properties
-            self.assertEquals(child2.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
+            self.assertEquals(
+                child2.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
                 "val1%s" % (uid if uid else "",))
-            self.assertEquals(child2.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
+            self.assertEquals(
+                child2.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
-            self.assertEquals(child2.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
+            self.assertEquals(
+                child2.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
                 "val3%s" % (uid if uid else "",))
 
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
                 "val1%s" % (uid if uid else "",))
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
                 "val3%s" % (uid if uid else "",))
 
 
@@ -274,11 +303,14 @@
             child1.deadProperties().set(StubProperty("ns1:", "prop2", value="val0%s" % (uid if uid else "",)), uid=uid)
             child1.deadProperties().set(StubProperty("ns1:", "prop3", value="val0%s" % (uid if uid else "",)), uid=uid)
 
-            self.assertEquals(child2.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
+            self.assertEquals(
+                child2.deadProperties().get(("ns1:", "prop1"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
 
             child2.deadProperties().set(StubProperty("ns1:", "prop1", value="val1%s" % (uid if uid else "",)), uid=uid)
@@ -286,9 +318,11 @@
             self.assertRaises(HTTPError, child1.deadProperties().get, ("ns1:", "prop1"), uid=uid)
 
             self.assertFalse(child1.deadProperties().contains(("ns1:", "prop1"), uid=uid))
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
-            self.assertEquals(child1.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
+            self.assertEquals(
+                child1.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
 
             # force memcache to be consulted (once per collection per request)
@@ -296,9 +330,11 @@
 
             # verify properties
             self.assertFalse(child2.deadProperties().contains(("ns1:", "prop1"), uid=uid))
-            self.assertEquals(child2.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
+            self.assertEquals(
+                child2.deadProperties().get(("ns1:", "prop2"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
-            self.assertEquals(child2.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
+            self.assertEquals(
+                child2.deadProperties().get(("ns1:", "prop3"), uid=uid).value,
                 "val0%s" % (uid if uid else "",))
 
 

Modified: CalendarServer/trunk/twistedcaldav/test/test_mkcalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_mkcalendar.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_mkcalendar.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -126,7 +126,7 @@
                     caldavxml.CalendarDescription("Calendar restricted to events."), # FIXME: lang=en
                     caldavxml.SupportedCalendarComponentSet(caldavxml.CalendarComponent(name="VEVENT")),
                     caldavxml.CalendarTimeZone(
-"""BEGIN:VCALENDAR
+                        """BEGIN:VCALENDAR
 PRODID:-//Example Corp.//CalDAV Client//EN
 VERSION:2.0
 BEGIN:VTIMEZONE

Modified: CalendarServer/trunk/twistedcaldav/test/test_multiget.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_multiget.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_multiget.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -210,8 +210,9 @@
                     status = propstat.childOfType(davxml.Status)
 
                     if status.code != responsecode.OK:
-                        self.fail("REPORT failed (status %s) to locate properties: %r"
-                              % (status.code, href))
+                        self.fail(
+                            "REPORT failed (status %s) to locate properties: %r"
+                            % (status.code, href))
 
                     properties = propstat.childOfType(davxml.PropertyContainer).children
 
@@ -251,8 +252,9 @@
                     status = response.childOfType(davxml.Status)
                 if status.code != responsecode.OK:
                     if href in okhrefs:
-                        self.fail("REPORT failed (status %s) to locate properties: %r"
-                              % (status.code, href))
+                        self.fail(
+                            "REPORT failed (status %s) to locate properties: %r"
+                            % (status.code, href))
                     else:
                         if href in badhrefs:
                             badhrefs.remove(href)

Modified: CalendarServer/trunk/twistedcaldav/test/test_wrapping.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_wrapping.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/test/test_wrapping.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -544,7 +544,7 @@
 """
         CR = "\n"
         CRLF = "\r\n"
-        #validEvent = eventTemplate.format("", wsanchez=wsanchez, cdaboo=cdaboo).replace(CR, CRLF)
+        # validEvent = eventTemplate.format("", wsanchez=wsanchez, cdaboo=cdaboo).replace(CR, CRLF)
         invalidInstance = """
 BEGIN:VEVENT
 UID:20060110T231240Z-4011c71-187-6f73

Modified: CalendarServer/trunk/twistedcaldav/vcard.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/vcard.py	2014-08-01 17:40:13 UTC (rev 13817)
+++ CalendarServer/trunk/twistedcaldav/vcard.py	2014-08-01 17:59:51 UTC (rev 13818)
@@ -60,7 +60,7 @@
             values are (possibly empty) lists of parameter values.
         """
         if name is None:
-            assert value  is None
+            assert value is None
             assert params is None
 
             pyobj = kwargs["pycard"]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140801/7c033c1c/attachment-0001.html>


More information about the calendarserver-changes mailing list