[CalendarServer-changes] [13807] twext/trunk/twext

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 31 12:18:20 PDT 2014


Revision: 13807
          http://trac.calendarserver.org//changeset/13807
Author:   cdaboo at apple.com
Date:     2014-07-31 12:18:20 -0700 (Thu, 31 Jul 2014)
Log Message:
-----------
Whitespace.

Modified Paths:
--------------
    twext/trunk/twext/application/masterchild.py
    twext/trunk/twext/enterprise/adbapi2.py
    twext/trunk/twext/enterprise/dal/test/test_sqlsyntax.py
    twext/trunk/twext/enterprise/jobqueue.py
    twext/trunk/twext/enterprise/queue.py
    twext/trunk/twext/enterprise/test/test_adbapi2.py
    twext/trunk/twext/internet/adaptendpoint.py
    twext/trunk/twext/internet/decorate.py
    twext/trunk/twext/internet/fswatch.py
    twext/trunk/twext/internet/gaiendpoint.py
    twext/trunk/twext/internet/spawnsvc.py
    twext/trunk/twext/internet/ssl.py
    twext/trunk/twext/internet/test/test_adaptendpoint.py
    twext/trunk/twext/internet/test/test_gaiendpoint.py
    twext/trunk/twext/internet/threadutils.py
    twext/trunk/twext/python/launchd.py
    twext/trunk/twext/python/log.py
    twext/trunk/twext/python/parallel.py
    twext/trunk/twext/python/test/pullpipe.py
    twext/trunk/twext/python/test/test_filepath.py
    twext/trunk/twext/python/test/test_launchd.py
    twext/trunk/twext/python/test/test_log.py
    twext/trunk/twext/python/test/test_parallel.py
    twext/trunk/twext/who/directory.py
    twext/trunk/twext/who/idirectory.py
    twext/trunk/twext/who/index.py
    twext/trunk/twext/who/ldap/_service.py
    twext/trunk/twext/who/ldap/_util.py
    twext/trunk/twext/who/ldap/test/test_service.py
    twext/trunk/twext/who/ldap/test/test_util.py
    twext/trunk/twext/who/opendirectory/_constants.py
    twext/trunk/twext/who/opendirectory/_scripts.py
    twext/trunk/twext/who/opendirectory/_service.py
    twext/trunk/twext/who/opendirectory/test/test_service.py
    twext/trunk/twext/who/test/test_directory.py
    twext/trunk/twext/who/test/test_index.py
    twext/trunk/twext/who/test/test_util.py
    twext/trunk/twext/who/test/test_xml.py
    twext/trunk/twext/who/xml.py

Modified: twext/trunk/twext/application/masterchild.py
===================================================================
--- twext/trunk/twext/application/masterchild.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/application/masterchild.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -89,7 +89,7 @@
         except TypeError:
             raise UsageError("Not a protocol: {0}".format(protocol))
 
-        #### FIXME: port should be a strport
+        # FIXME: port should be a strport
 
         # Validate port number
         try:

Modified: twext/trunk/twext/enterprise/adbapi2.py
===================================================================
--- twext/trunk/twext/enterprise/adbapi2.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/enterprise/adbapi2.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -932,6 +932,7 @@
         return self.abort()
 
 
+
 def _fork(x):
     """
     Produce a L{Deferred} that will fire when another L{Deferred} fires without

Modified: twext/trunk/twext/enterprise/dal/test/test_sqlsyntax.py
===================================================================
--- twext/trunk/twext/enterprise/dal/test/test_sqlsyntax.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/enterprise/dal/test/test_sqlsyntax.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -973,13 +973,11 @@
         self.assertEquals(
             Select(
                 From=self.schema.FOO,
-                Where=(
-                    (
+                Where=((
                     self.schema.FOO.BAZ == Parameter("P1")
                 ).Or(
-                        self.schema.FOO.BAR.In(Parameter("names", len(items))
-                ).And(
-                    self.schema.FOO.BAZ == Parameter("P2")
+                    self.schema.FOO.BAR.In(Parameter("names", len(items))).And(
+                        self.schema.FOO.BAZ == Parameter("P2")
                     )
                 ))
             ).toSQL().bind(P1="P1", P2="P2", names=items),

Modified: twext/trunk/twext/enterprise/jobqueue.py
===================================================================
--- twext/trunk/twext/enterprise/jobqueue.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/enterprise/jobqueue.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -81,22 +81,22 @@
 More details:
 
     Terminology:
-    
+
         node: a host in a multi-host setup. Each node will contain a
             "controller" process and a set of "worker" processes.
             Nodes communicate with each other to allow load balancing
             of jobs across the entire cluster.
-        
+
         controller: a process running in a node that is in charge of
             managing "workers" as well as connections to other nodes. The
             controller polls the job queue and dispatches outstanding jobs
             to its "workers".
-        
+
         worker: a process running in a node that is responsible for
             executing jobs sent to it by the "controller". It also
             handles enqueuing of jobs as dictated by operations it
             is doing.
-                
+
     A controller has a:
 
     L{WorkerConnectionPool}: this maintains a list of worker processes that
@@ -1499,7 +1499,7 @@
         """
         A worker enqueued a job and is letting us know. We need to "ping" the
         L{PeerConnectionPool} to ensure it is polling the job queue at its
-        normal "fast" rate, as opposed to slower idle rates. 
+        normal "fast" rate, as opposed to slower idle rates.
         """
 
         self.peerPool.enqueuedJob()
@@ -2180,8 +2180,8 @@
         the same peer.
         """
         # if (host, port) in self.mappedPeers:
-            # TODO: think about this for race conditions
-            # self.mappedPeers.pop((host, port)).transport.loseConnection()
+        #     TODO: think about this for race conditions
+        #     self.mappedPeers.pop((host, port)).transport.loseConnection()
         self.mappedPeers[(host, port)] = peer
 
     _connectingToPeer = []

Modified: twext/trunk/twext/enterprise/queue.py
===================================================================
--- twext/trunk/twext/enterprise/queue.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/enterprise/queue.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -1437,8 +1437,8 @@
         the same peer.
         """
         # if (host, port) in self.mappedPeers:
-            # TODO: think about this for race conditions
-            # self.mappedPeers.pop((host, port)).transport.loseConnection()
+        #     TODO: think about this for race conditions
+        #     self.mappedPeers.pop((host, port)).transport.loseConnection()
         self.mappedPeers[(host, port)] = peer
 
     _connectingToPeer = []

Modified: twext/trunk/twext/enterprise/test/test_adbapi2.py
===================================================================
--- twext/trunk/twext/enterprise/test/test_adbapi2.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/enterprise/test/test_adbapi2.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -352,7 +352,7 @@
         stopResult = self.resultOf(self.pool.stopService())
         self.assertEquals(stopResult, [])
         self.flushHolders()
-        #self.assertEquals(abortResult, [None])
+        # self.assertEquals(abortResult, [None])
         self.assertResultList(stopResult, None)
 
 

Modified: twext/trunk/twext/internet/adaptendpoint.py
===================================================================
--- twext/trunk/twext/internet/adaptendpoint.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/adaptendpoint.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -163,4 +163,3 @@
     wrap.noisy = clientFactory.noisy # relay the noisy attribute to the wrapper
     wrap.connect()
     return wrap
-

Modified: twext/trunk/twext/internet/decorate.py
===================================================================
--- twext/trunk/twext/internet/decorate.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/decorate.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -90,9 +90,9 @@
         if argname in kw:
             return kw[argname]
         else:
-            raise TypeError("could not find key argument %r in %r/%r (%r)" %
-                (argname, args, kw, argpos)
-            )
+            raise TypeError("could not find key argument %r in %r/%r (%r)" % (
+                argname, args, kw, argpos
+            ))
 
 
     def decorate(thunk):

Modified: twext/trunk/twext/internet/fswatch.py
===================================================================
--- twext/trunk/twext/internet/fswatch.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/fswatch.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -34,6 +34,7 @@
     kqueueSupported = False
 
 
+
 class IDirectoryChangeListenee(Interface):
     """
     A delegate of DirectoryChangeListener
@@ -60,7 +61,7 @@
         """
 
 
-#TODO: better way to tell if reactor is kqueue or not
+# TODO: better way to tell if reactor is kqueue or not
 if kqueueSupported and hasattr(reactor, "_doWriteOrRead"):
 
 
@@ -78,7 +79,6 @@
     patchReactor(reactor)
 
 
-
     class DirectoryChangeListener(Logger, object):
         """
         Listens for the removal, renaming, or general unavailability of a

Modified: twext/trunk/twext/internet/gaiendpoint.py
===================================================================
--- twext/trunk/twext/internet/gaiendpoint.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/gaiendpoint.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -94,7 +94,7 @@
                                   AF_UNSPEC, SOCK_STREAM)
         @dgai.addCallback
         def gaiToEndpoints(gairesult):
-            for family, socktype, proto, canonname, sockaddr in gairesult:
+            for family, _ignore_socktype, _ignore_proto, _ignore_canonname, sockaddr in gairesult:
                 if family in [AF_INET6, AF_INET]:
                     yield self.subEndpoint(self.reactor, sockaddr[0],
                                            sockaddr[1], self.contextFactory)
@@ -162,7 +162,9 @@
         host = "localhost"
         port = 22
     gaie = GAIEndpoint(reactor, host, port)
+
     from twisted.internet.protocol import Factory, Protocol
+
     class HelloGoobye(Protocol, object):
         def connectionMade(self):
             print('Hello!')
@@ -171,12 +173,16 @@
         def connectionLost(self, reason):
             print('Goodbye')
 
+
     class MyFactory(Factory, object):
         def buildProtocol(self, addr):
             print('Building protocol for:', addr)
             return HelloGoobye()
+
+
     def bye(what):
         print('bye', what)
         reactor.stop()
+
     gaie.connect(MyFactory()).addBoth(bye)
     reactor.run()

Modified: twext/trunk/twext/internet/spawnsvc.py
===================================================================
--- twext/trunk/twext/internet/spawnsvc.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/spawnsvc.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -50,8 +50,6 @@
     os._exit(0)
 
 
-import sys
-
 from zope.interface import implements
 
 from twisted.internet.interfaces import ITransport, IPushProducer, IConsumer
@@ -257,6 +255,3 @@
                 bridge.eventuallyStop()
             return self._stopAllDeferred
         return succeed(None)
-
-
-

Modified: twext/trunk/twext/internet/ssl.py
===================================================================
--- twext/trunk/twext/internet/ssl.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/ssl.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -44,6 +44,7 @@
             sslmethod=sslmethod
         )
 
+
     def cacheContext(self):
         # Unfortunate code duplication.
         ctx = SSLContext(self.sslmethod)

Modified: twext/trunk/twext/internet/test/test_adaptendpoint.py
===================================================================
--- twext/trunk/twext/internet/test/test_adaptendpoint.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/test/test_adaptendpoint.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -33,6 +33,7 @@
         self.__dict__.update(kw)
 
 
+
 class RecordingProtocol(Protocol, object):
     def __init__(self):
         super(RecordingProtocol, self).__init__()
@@ -82,7 +83,7 @@
 
 
     def buildProtocol(self, addr):
-        b =  RecordingProtocol()
+        b = RecordingProtocol()
         self.built.append(names(protocol=b, addr=addr))
         return b
 
@@ -100,6 +101,7 @@
         return d
 
 
+
 class RecordingTransport(object):
 
     def __init__(self):
@@ -256,6 +258,3 @@
         """
         self.connectionFails(Failure(ZeroDivisionError()))
         self.assertRaises(RuntimeError, self.connector.stopConnecting)
-
-
-

Modified: twext/trunk/twext/internet/test/test_gaiendpoint.py
===================================================================
--- twext/trunk/twext/internet/test/test_gaiendpoint.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/test/test_gaiendpoint.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -78,7 +78,7 @@
         A call to L{getaddrinfo} has succeeded; invoke the L{Deferred} waiting
         on it.
         """
-        d, f, a, k = self.inThreads.pop(0)
+        d, _ignore_f, _ignore_a, _ignore_k = self.inThreads.pop(0)
         d.callback([(family, socktype, proto, canonname, sockaddr)])
 
 
@@ -109,4 +109,3 @@
         attempt = self.fakeRealEndpoints[0]._attempt
         attempt.callback(self.fakeRealEndpoints[0]._factory.buildProtocol(None))
         self.assertEqual(len(protos), 1)
-

Modified: twext/trunk/twext/internet/threadutils.py
===================================================================
--- twext/trunk/twext/internet/threadutils.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/internet/threadutils.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -118,6 +118,3 @@
         self._state = _STATE_STOPPING
         self._q.put(_DONE)
         return s
-
-
-

Modified: twext/trunk/twext/python/launchd.py
===================================================================
--- twext/trunk/twext/python/launchd.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/python/launchd.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -205,7 +205,6 @@
 
 
 
-
 class LaunchErrno(Exception):
     """
     Error from launchd.

Modified: twext/trunk/twext/python/log.py
===================================================================
--- twext/trunk/twext/python/log.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/python/log.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -62,7 +62,7 @@
     "LogLevelFilterPredicate",
     "LegacyLogObserver",
     "replaceTwistedLoggers",
-    #"StandardIOObserver",
+    # "StandardIOObserver",
 ]
 
 
@@ -81,7 +81,6 @@
 import twisted.python.log
 from twisted.python.log import msg as twistedLogMessage
 from twisted.python.log import addObserver, removeObserver
-from twisted.python.log import ILogObserver as ILegacyLogObserver
 
 
 
@@ -349,7 +348,7 @@
                 invalidLevel=level,
                 logger=self,
             )
-            #level = LogLevel.error
+            # level = LogLevel.error
             # FIXME: continue to emit?
             return
 
@@ -603,7 +602,7 @@
         @param predicates: an ordered iterable of predicates to apply
             to events before forwarding to the wrapped observer.
         """
-        self.observer   = observer
+        self.observer = observer
         self.predicates = list(predicates)
 
 
@@ -701,7 +700,7 @@
 
 
     def __call__(self, event):
-        level     = event.get("log_level", None)
+        level = event.get("log_level", None)
         namespace = event.get("log_namespace", None)
 
         if (
@@ -819,10 +818,11 @@
     def __init__(self):
         self.legacyLogObserver = LegacyLogObserver(twistedLogMessage)
         self.filteredPublisher = LogPublisher(self.legacyLogObserver)
-        self.levels            = LogLevelFilterPredicate()
-        self.filters           = FilteringLogObserver(self.filteredPublisher,
-                                                      (self.levels,))
-        self.rootPublisher     = LogPublisher(self.filters)
+        self.levels = LogLevelFilterPredicate()
+        self.filters = FilteringLogObserver(
+            self.filteredPublisher, (self.levels,)
+        )
+        self.rootPublisher = LogPublisher(self.filters)
 
 
     def addObserver(self, observer, filtered=True):
@@ -982,8 +982,6 @@
 
 
 
-
-######################################################################
 # FIXME: This may not be needed; look into removing it.
 
 class StandardIOObserver(object):

Modified: twext/trunk/twext/python/parallel.py
===================================================================
--- twext/trunk/twext/python/parallel.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/python/parallel.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -89,6 +89,3 @@
         """
         return (DeferredList(self.activeDeferreds)
                 .addCallback(lambda ignored: None))
-
-
-

Modified: twext/trunk/twext/python/test/pullpipe.py
===================================================================
--- twext/trunk/twext/python/test/pullpipe.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/python/test/pullpipe.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -18,9 +18,8 @@
 
 if __name__ == '__main__':
     from twext.python.sendfd import recvfd
-    import sys, os
+    import sys
+    import os
     fd, description = recvfd(int(sys.argv[1]))
     os.write(fd, "Test fixture data: %s.\n" % (description,))
     os.close(fd)
-
-    

Modified: twext/trunk/twext/python/test/test_filepath.py
===================================================================
--- twext/trunk/twext/python/test/test_filepath.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/python/test/test_filepath.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -71,7 +71,8 @@
         observe exceptions raised by the replacement.  This verifies that the
         test patching done here is actually testing something.
         """
-        class CustomException(Exception): "Just for testing."
+        class CustomException(Exception):
+            "Just for testing."
         def blowUp(dirname):
             raise CustomException()
         self.cfp._listdir = blowUp
@@ -93,9 +94,10 @@
         self.cfp._listdir = raiseEINVAL
         self.assertEquals(self.cfp.listdir(), ['a', 'b', 'c'])
         self.assertEquals(self.cfp.children(), [
-                CachingFilePath(pathjoin(self.cfp.path, 'a')),
-                CachingFilePath(pathjoin(self.cfp.path, 'b')),
-                CachingFilePath(pathjoin(self.cfp.path, 'c')),])
+            CachingFilePath(pathjoin(self.cfp.path, 'a')),
+            CachingFilePath(pathjoin(self.cfp.path, 'b')),
+            CachingFilePath(pathjoin(self.cfp.path, 'c')),
+        ])
 
 
     def requireTimePassed(self, filenames):
@@ -128,9 +130,12 @@
                 current += value
                 yield current
 
-        self.assertEquals(self.calls,
-                          list(cumulative(
-                    [0.0, 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 5.0, 5.0])))
+        self.assertEquals(
+            self.calls,
+            list(cumulative(
+                [0.0, 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 5.0, 5.0]
+            ))
+        )
 
 
     def test_backoff(self):
@@ -148,7 +153,7 @@
         terms of L{FilePath.listdir}, so we need to verify that it will also
         retry.
         """
-        filenames = [self.cfp.basename()+'.a',
+        filenames = [self.cfp.basename() + '.a',
                      self.cfp.basename() + '.b',
                      self.cfp.basename() + '.c']
         siblings = map(self.cfp.sibling, filenames)

Modified: twext/trunk/twext/python/test/test_launchd.py
===================================================================
--- twext/trunk/twext/python/test/test_launchd.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/python/test/test_launchd.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -18,7 +18,11 @@
 Tests for L{twext.python.launchd}.
 """
 
-import sys, os, plistlib, socket, json
+import json
+import os
+import plistlib
+import socket
+import sys
 
 if __name__ == '__main__':
     # This module is loaded as a launchd job by test-cases below; the following
@@ -151,9 +155,10 @@
         L{plainPython} will convert a L{_LaunchDictionary} into a Python
         dictionary.
         """
-        self.assertEquals({b"alpha": b"alpha-value", b"beta": b"beta-value",
-                           b"gamma": 3},
-                           plainPython(_LaunchDictionary(self.testDict)))
+        self.assertEquals(
+            {b"alpha": b"alpha-value", b"beta": b"beta-value", b"gamma": 3},
+            plainPython(_LaunchDictionary(self.testDict))
+        )
 
 
     def test_plainPythonNested(self):
@@ -165,11 +170,14 @@
         lib.launch_data_dict_insert(otherDict,
                                     lib.launch_data_new_string("bar"), "foo")
         lib.launch_data_dict_insert(self.testDict, otherDict, "delta")
-        self.assertEquals({b"alpha": b"alpha-value", b"beta": b"beta-value",
-                           b"gamma": 3, b"delta": {b"foo": b"bar"}},
-                           plainPython(_LaunchDictionary(self.testDict)))
+        self.assertEquals(
+            {b"alpha": b"alpha-value", b"beta": b"beta-value",
+             b"gamma": 3, b"delta": {b"foo": b"bar"}},
+            plainPython(_LaunchDictionary(self.testDict))
+        )
 
 
+
 class ArrayTests(TestCase):
     """
     Tests for L{_LaunchArray}
@@ -393,5 +401,3 @@
         err = self.stderr.getContent()
         if 'Traceback' in err:
             self.fail(err)
-
-

Modified: twext/trunk/twext/python/test/test_log.py
===================================================================
--- twext/trunk/twext/python/test/test_log.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/python/test/test_log.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -32,9 +32,9 @@
 
 
 
-defaultLogLevel         = LogLevelFilterPredicate().defaultLogLevel
-clearLogLevels          = Logger.publisher.levels.clearLogLevels
-logLevelForNamespace    = Logger.publisher.levels.logLevelForNamespace
+defaultLogLevel = LogLevelFilterPredicate().defaultLogLevel
+clearLogLevels = Logger.publisher.levels.clearLogLevels
+logLevelForNamespace = Logger.publisher.levels.logLevelForNamespace
 setLogLevelForNamespace = Logger.publisher.levels.setLogLevelForNamespace
 
 
@@ -42,12 +42,12 @@
 class TestLogger(Logger):
     def emit(self, level, format=None, **kwargs):
         if False:
-            print "*"*60
+            print "*" * 60
             print "level =", level
             print "format =", format
             for key, value in kwargs.items():
                 print key, "=", value
-            print "*"*60
+            print "*" * 60
 
         def observer(event):
             self.event = event
@@ -59,7 +59,7 @@
             twistedLogging.removeObserver(observer)
 
         self.emitted = {
-            "level":  level,
+            "level": level,
             "format": format,
             "kwargs": kwargs,
         }
@@ -281,7 +281,7 @@
         """
         Formatting an event that's just plain out to get us.
         """
-        event = dict(log_format="{evil()}", evil=lambda: 1/0)
+        event = dict(log_format="{evil()}", evil=lambda: 1 / 0)
         result = formatEvent(event)
 
         self.assertIn("Unable to format event", result)
@@ -294,7 +294,7 @@
         """
         event = {
             "log_format": "{evil()}",
-            "evil": lambda: 1/0,
+            "evil": lambda: 1 / 0,
             Unformattable(): "gurk",
         }
         result = formatEvent(event)
@@ -309,7 +309,7 @@
         """
         event = dict(
             log_format="{evil()}",
-            evil=lambda: 1/0,
+            evil=lambda: 1 / 0,
             gurk=Unformattable(),
         )
         result = formatEvent(event)
@@ -324,7 +324,7 @@
         """
         event = dict(
             log_format="{evil()}",
-            evil=lambda: 1/0,
+            evil=lambda: 1 / 0,
             recoverable="okay",
         )
         # Call formatUnformattableEvent() directly with a bogus exception.
@@ -723,7 +723,7 @@
     def test_filteredObserverNoFilteringKeys(self):
         event_debug = dict(log_level=LogLevel.debug)
         event_error = dict(log_level=LogLevel.error)
-        event_none  = dict()
+        event_none = dict()
         events = []
 
         observer = lambda e: events.append(e)
@@ -1026,4 +1026,4 @@
     """
 
     def __repr__(self):
-        return str(1/0)
+        return str(1 / 0)

Modified: twext/trunk/twext/python/test/test_parallel.py
===================================================================
--- twext/trunk/twext/python/test/test_parallel.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/python/test/test_parallel.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -59,5 +59,3 @@
         d1.callback(4)
         self.assertEqual(done, [None, None, None, None])
         self.assertEqual(allDone, [None])
-
-

Modified: twext/trunk/twext/who/directory.py
===================================================================
--- twext/trunk/twext/who/directory.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/directory.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -160,7 +160,7 @@
             supported by this directory service.
         """
         if records is not None:
-            for record in records:
+            for _ignore_record in records:
                 break
             else:
                 return succeed(())
@@ -311,13 +311,13 @@
 
 
     def updateRecords(self, records, create=False):
-        for record in records:
+        for _ignore_record in records:
             return fail(NotAllowedError("Record updates not allowed."))
         return succeed(None)
 
 
     def removeRecords(self, uids):
-        for uid in uids:
+        for _ignore_uid in uids:
             return fail(NotAllowedError("Record removal not allowed."))
         return succeed(None)
 

Modified: twext/trunk/twext/who/idirectory.py
===================================================================
--- twext/trunk/twext/who/idirectory.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/idirectory.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -277,7 +277,6 @@
         @rtype: iterable of L{NamedConstant}s
         """
 
-
     def recordsFromExpression(expression, recordTypes=None):
         """
         Find records matching an expression.
@@ -296,7 +295,6 @@
             supported by this directory service.
         """
 
-
     def recordsWithFieldValue(fieldName, value):
         """
         Find records that have the given field name with the given
@@ -312,7 +310,6 @@
         @rtype: deferred iterable of L{IDirectoryRecord}s
         """
 
-
     def recordWithUID(uid):
         """
         Find the record that has the given UID.
@@ -324,7 +321,6 @@
         @rtype: deferred L{IDirectoryRecord}s or C{None}
         """
 
-
     def recordWithGUID(guid):
         """
         Find the record that has the given GUID.
@@ -336,7 +332,6 @@
         @rtype: deferred L{IDirectoryRecord}s or C{None}
         """
 
-
     def recordsWithRecordType(recordType):
         """
         Find the records that have the given record type.
@@ -348,7 +343,6 @@
         @rtype: deferred iterable of L{IDirectoryRecord}s
         """
 
-
     def recordWithShortName(recordType, shortName):
         """
         Find the record that has the given record type and short name.
@@ -363,7 +357,6 @@
         @rtype: deferred L{IDirectoryRecord}s or C{None}
         """
 
-
     def recordsWithEmailAddress(emailAddress):
         """
         Find the records that have the given email address.
@@ -375,7 +368,6 @@
         @rtype: deferred iterable of L{IDirectoryRecord}s
         """
 
-
     def updateRecords(records, create=False):
         """
         Updates existing directory records.
@@ -393,7 +385,6 @@
             directory service.
         """
 
-
     def removeRecords(uids):
         """
         Removes the records with the given UIDs.
@@ -452,7 +443,6 @@
             direct members of this group.
         """
 
-
     def groups():
         """
         Find the group records that this record is a member of.  Only
@@ -463,7 +453,6 @@
             groups that this record is a member of.
         """
 
-
     def addMembers(members):
         """
         Adds the members to this record.
@@ -472,7 +461,6 @@
         @type members: An iterable of L{IDirectoryRecord}s.
         """
 
-
     def removeMembers(members):
         """
         Removes the members from this record.
@@ -481,7 +469,6 @@
         @type members: An iterable of L{IDirectoryRecord}s.
         """
 
-
     def setMembers(members):
         """
         Replaces the current members of this record.
@@ -491,6 +478,7 @@
         """
 
 
+
 class IPlaintextPasswordVerifier(Interface):
     """
     Provides a way to verify a plaintext password as provided by a client.

Modified: twext/trunk/twext/who/index.py
===================================================================
--- twext/trunk/twext/who/index.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/index.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -255,7 +255,7 @@
             )
 
         matchValue = normalize(expression.fieldValue)
-        matchType  = expression.matchType
+        matchType = expression.matchType
 
         if matchType == MatchType.startsWith:
             indexKeys = (

Modified: twext/trunk/twext/who/ldap/_service.py
===================================================================
--- twext/trunk/twext/who/ldap/_service.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/ldap/_service.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -412,7 +412,6 @@
             returnValue(False)
 
 
-
     @inlineCallbacks
     def _recordsFromQueryString(self, queryString, recordTypes=None):
         records = []
@@ -669,6 +668,7 @@
     return new
 
 
+
 def recordTypeForDN(baseDnStr, recordTypeSchemas, dnStr):
     """
     Examine a DN to determine which recordType it belongs to
@@ -695,6 +695,7 @@
     return None
 
 
+
 def dnContainedIn(child, parent):
     """
     Return True if child dn is contained within parent dn, otherwise False.
@@ -702,6 +703,7 @@
     return child[-len(parent):] == parent
 
 
+
 def recordTypeForRecordData(recordTypeSchemas, recordData):
     """
     Given info about record types, determine the record type for a blob of

Modified: twext/trunk/twext/who/ldap/_util.py
===================================================================
--- twext/trunk/twext/who/ldap/_util.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/ldap/_util.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -49,6 +49,7 @@
         return u""
 
 
+
 def ldapQueryStringFromMatchExpression(
     expression, fieldNameToAttributesMap, recordTypeSchemas
 ):
@@ -153,6 +154,7 @@
     raise AssertionError("We shouldn't be here.")
 
 
+
 def ldapQueryStringFromCompoundExpression(
     expression, fieldNameToAttributesMap, recordTypeSchemas
 ):
@@ -194,6 +196,7 @@
     return ldapQueryStringFromQueryStrings(operand, queryStrings)
 
 
+
 def ldapQueryStringFromExpression(
     expression, fieldNameToAttributesMap, recordTypeSchemas
 ):

Modified: twext/trunk/twext/who/ldap/test/test_service.py
===================================================================
--- twext/trunk/twext/who/ldap/test/test_service.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/ldap/test/test_service.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -46,7 +46,7 @@
 from twisted.trial import unittest
 from twisted.trial.unittest import SkipTest
 
-from ...idirectory import QueryNotSupportedError, FieldName as BaseFieldName
+from ...idirectory import FieldName as BaseFieldName
 from .._service import (
     DEFAULT_FIELDNAME_ATTRIBUTE_MAP, DEFAULT_RECORDTYPE_SCHEMAS,
     LDAPBindAuthError,
@@ -62,7 +62,6 @@
     DirectoryServiceRealmTestMixIn,
     DirectoryServiceQueryTestMixIn as BaseDirectoryServiceQueryTestMixIn,
     DirectoryServiceMutableTestMixIn as BaseDirectoryServiceMutableTestMixIn,
-    UnknownConstant,
 )
 
 
@@ -168,6 +167,7 @@
     test_recordsWithRecordType_unknown.todo = "After this test runs, other tests fail, need to investigate"
 
 
+
 class DirectoryServiceQueryTestMixIn(BaseDirectoryServiceQueryTestMixIn):
     def test_queryNot(self):
         return BaseDirectoryServiceQueryTestMixIn.test_queryNot(self)
@@ -390,6 +390,7 @@
 
         return unicode(obj)
 
+
     def tuplify(record, fieldName):
         fieldValue = record.fields[fieldName]
 
@@ -441,6 +442,7 @@
     last = None
 
 
+
 def mockldap_parse(self):
     match = self.TEST_RE.match(self.content)
 
@@ -457,6 +459,7 @@
             u"Operation %r is not supported" % (self.op,)
         )
 
+
     def unescape(value):
         return self.UNESCAPE_RE.sub(lambda m: chr(int(m.group(1), 16)), value)
 
@@ -481,6 +484,7 @@
         self.value = unescape(valueExpression)
 
 
+
 def mockldap_matches(self, dn, attrs):
     values = attrs.get(self.attr)
 

Modified: twext/trunk/twext/who/ldap/test/test_util.py
===================================================================
--- twext/trunk/twext/who/ldap/test/test_util.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/ldap/test/test_util.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -375,6 +375,7 @@
             MatchFlags.none, expected
         )
 
+
     def test_queryStringFromMatchExpression_multipleRecordType_not(self):
         """
         Match expression when the queried field name is the record type field,

Modified: twext/trunk/twext/who/opendirectory/_constants.py
===================================================================
--- twext/trunk/twext/who/opendirectory/_constants.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/opendirectory/_constants.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -54,6 +54,7 @@
     nestedGroupsUIDs.multiValue = True
 
 
+
 #
 # OD constants
 #
@@ -71,7 +72,7 @@
     group = ValueConstant(u"dsRecTypeStandard:Groups")
     group.recordType = BaseRecordType.group
 
-    #location = ValueConstant(u"dsRecTypeStandard:Locations")
+    # location = ValueConstant(u"dsRecTypeStandard:Locations")
     place = ValueConstant(u"dsRecTypeStandard:Places")
 
     resource = ValueConstant(u"dsRecTypeStandard:Resources")

Modified: twext/trunk/twext/who/opendirectory/_scripts.py
===================================================================
--- twext/trunk/twext/who/opendirectory/_scripts.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/opendirectory/_scripts.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -91,6 +91,7 @@
     return HA1.encode("hex")
 
 
+
 # DigestCalcResponse
 def calcResponse(
     HA1,
@@ -129,6 +130,7 @@
     return respHash
 
 
+
 @inlineCallbacks
 def authUsernamePassword(username, password):
     # Authenticate using simple password
@@ -148,14 +150,14 @@
     # Authenticate using Digest
 
     algorithm = "md5"  # "md5-sess"
-    cnonce    = "/rrD6TqPA3lHRmg+fw/vyU6oWoQgzK7h9yWrsCmv/lE="
-    entity    = "00000000000000000000000000000000"
-    method    = "GET"
-    nc        = "00000001"
-    nonce     = "128446648710842461101646794502"
-    qop       = None
-    realm     = "host.example.com"
-    uri       = "http://host.example.com"
+    cnonce = "/rrD6TqPA3lHRmg+fw/vyU6oWoQgzK7h9yWrsCmv/lE="
+    entity = "00000000000000000000000000000000"
+    method = "GET"
+    nc = "00000001"
+    nonce = "128446648710842461101646794502"
+    qop = None
+    realm = "host.example.com"
+    uri = "http://host.example.com"
 
     responseHash = calcResponse(
         calcHA1(
@@ -187,6 +189,7 @@
         print("Via DigestedCredentials, could not authenticate")
 
 
+
 @inlineCallbacks
 def lookup(shortNames):
     service = DirectoryService()
@@ -236,6 +239,7 @@
             print(record.description())
 
 
+
 def run_auth():
     username = raw_input("Username: ")
     if username:
@@ -244,5 +248,6 @@
             authUsernamePassword(username, password)
 
 
+
 def run_lookup():
     lookup(sys.argv[1:])

Modified: twext/trunk/twext/who/opendirectory/_service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/_service.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/opendirectory/_service.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -93,6 +93,7 @@
     """
 
 
+
 class UnsupportedRecordTypeError(OpenDirectoryError):
     """
     Record type not supported by service.
@@ -144,7 +145,6 @@
         return u"OpenDirectory Node {self.nodeName!r}".format(self=self)
 
 
-
     @property
     def node(self):
         """
@@ -410,7 +410,7 @@
         else:
             node = self.node
 
-        queryString, expressionRecordTypes = (
+        queryString, _ignore_expressionRecordTypes = (
             self._queryStringAndRecordTypesFromExpression(expression)
         )
 
@@ -746,7 +746,6 @@
         returnValue(results)
 
 
-
     @inlineCallbacks
     def localRecordsFromCompoundExpression(self, expression, recordTypes=None):
         """
@@ -869,6 +868,7 @@
             returnValue(None)
 
 
+
 @implementer(IPlaintextPasswordVerifier, IHTTPDigestVerifier)
 class DirectoryRecord(BaseDirectoryRecord):
     """
@@ -1016,7 +1016,7 @@
             response=response
         )
 
-        result, m1, m2, error = self._odRecord.verifyExtendedWithAuthenticationType_authenticationItems_continueItems_context_error_(
+        result, _ignore_m1, _ignore_m2, error = self._odRecord.verifyExtendedWithAuthenticationType_authenticationItems_continueItems_context_error_(
             ODAuthMethod.digestMD5.value,
             [username, challenge, responseArg, method],
             None, None, None

Modified: twext/trunk/twext/who/opendirectory/test/test_service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/test/test_service.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/opendirectory/test/test_service.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -351,8 +351,8 @@
         self.assertEquals(
             queryString,
             u"("
-                u"|(dsAttrTypeStandard:RecordName=xxxxx)"
-                u"(dsAttrTypeStandard:RecordName=yyyyy)"
+            u"|(dsAttrTypeStandard:RecordName=xxxxx)"
+            u"(dsAttrTypeStandard:RecordName=yyyyy)"
             u")"
         )
         # NOR expression
@@ -391,8 +391,8 @@
         self.assertEquals(
             queryString,
             u"("
-                u"|(dsAttrTypeStandard:RecordName=xxxxx)"
-                u"(dsAttrTypeStandard:RecordName=yyyyy)"
+            u"|(dsAttrTypeStandard:RecordName=xxxxx)"
+            u"(dsAttrTypeStandard:RecordName=yyyyy)"
             u")"
         )
 

Modified: twext/trunk/twext/who/test/test_directory.py
===================================================================
--- twext/trunk/twext/who/test/test_directory.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/test/test_directory.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -660,7 +660,7 @@
         """
         L{DirectoryRecord} initialization sets service and fields.
         """
-        service  = self.service()
+        service = self.service()
         wsanchez = self.makeRecord(self.fields_wsanchez, service=service)
 
         self.assertEquals(wsanchez.service, service)
@@ -758,7 +758,7 @@
         """
         Verify a value of None is allowed
         """
-        service  = self.service()
+        service = self.service()
         record = self.makeRecord(self.fields_none_password, service=service)
 
         self.assertEquals(record.password, None)
@@ -888,10 +888,10 @@
 
         plugh = self.serviceClass(u"plugh")
 
-        wsanchez    = self.makeRecord(self.fields_wsanchez)
+        wsanchez = self.makeRecord(self.fields_wsanchez)
         wsanchezmod = self.makeRecord(self.fields_wsanchez, service=plugh)
-        glyph       = self.makeRecord(self.fields_glyph)
-        glyphmod    = self.makeRecord(fields_glyphmod)
+        glyph = self.makeRecord(self.fields_glyph)
+        glyphmod = self.makeRecord(fields_glyphmod)
 
         self.assertEquals(wsanchez, wsanchez)
         self.assertNotEqual(wsanchez, glyph)

Modified: twext/trunk/twext/who/test/test_index.py
===================================================================
--- twext/trunk/twext/who/test/test_index.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/test/test_index.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -70,6 +70,7 @@
     return NoLoadDirectoryService
 
 
+
 class BaseDirectoryServiceTest(test_directory.BaseDirectoryServiceTest):
     """
     Tests for indexed directory services.
@@ -86,6 +87,7 @@
 
         return service
 
+
     def test_indexRecords_positive(self):
         """
         L{DirectoryService.indexRecords} ensures all record data is in the
@@ -508,9 +510,9 @@
     if not index:
         return True
 
-    for fieldName, fieldIndex in index.iteritems():
-        for fieldValue, records in fieldIndex.iteritems():
-            for record in records:
+    for _ignore_fieldName, fieldIndex in index.iteritems():
+        for _ignore_fieldValue, records in fieldIndex.iteritems():
+            for _ignore_record in records:
                 return False
 
     return True

Modified: twext/trunk/twext/who/test/test_util.py
===================================================================
--- twext/trunk/twext/who/test/test_util.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/test/test_util.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -45,6 +45,7 @@
         return False
 
 
+
 class MoreTools(Names):
     saw = NamedConstant()
     saw.description = u"z maker"
@@ -53,6 +54,7 @@
     mallet.description = u"soft pounder"
 
 
+
 class Instruments(Names):
     hammer = NamedConstant()
     chisel = NamedConstant()
@@ -225,7 +227,6 @@
         )
 
 
-
     def test_lookupByName(self):
         """
         Constants are assessible via L{ConstantsContainer.lookupByName}.
@@ -304,6 +305,7 @@
         self.assertEquals(u"red|green", describe(Switches.r | Switches.g))
         self.assertEquals(u"blue|black", describe(Switches.b | Switches.black))
 
+
     def test_describeObject(self):
         """
         L{describe} will cast non-cosntant objects to L{unicode}.

Modified: twext/trunk/twext/who/test/test_xml.py
===================================================================
--- twext/trunk/twext/who/test/test_xml.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/test/test_xml.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -892,6 +892,7 @@
             )
         )
 
+
     @inlineCallbacks
     def test_memberships(self):
         service = self.service()

Modified: twext/trunk/twext/who/xml.py
===================================================================
--- twext/trunk/twext/who/xml.py	2014-07-31 18:35:53 UTC (rev 13806)
+++ twext/trunk/twext/who/xml.py	2014-07-31 19:18:20 UTC (rev 13807)
@@ -80,7 +80,7 @@
     # Schema hierarchy
 
     directory = ValueConstant(u"directory")
-    record    = ValueConstant(u"record")
+    record = ValueConstant(u"record")
 
     # Field names
 
@@ -112,7 +112,7 @@
     XML attribute names.
     """
 
-    realm      = ValueConstant(u"realm")
+    realm = ValueConstant(u"realm")
     recordType = ValueConstant(u"type")
 
 
@@ -144,8 +144,8 @@
     )
 
     # XML schema constants
-    element         = Element
-    attribute       = Attribute
+    element = Element
+    attribute = Attribute
     recordTypeValue = RecordTypeValue
 
 
@@ -440,7 +440,6 @@
             )
 
 
-
     def flush(self):
         BaseDirectoryService.flush(self)
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140731/a92f9cc0/attachment-0001.html>


More information about the calendarserver-changes mailing list