Ronald Oussoren avatar Ronald Oussoren committed 5bc325e

Run reindent.py to remove trailing whitespace

Comments (0)

Files changed (541)

 TOPDIR = os.path.dirname(os.path.abspath(__file__))
 
 
-# Module defining a topological sort function, see 
+# Module defining a topological sort function, see
 # <http://www.bitformation.com/art/python_toposort.html> for more
 # information.
 #

pyobjc-core/Doc/conf.py

 pdf_splittables = True
 pdf_use_modindex = False
 pdf_use_index = True
-
-

pyobjc-core/Examples/ApplicationPlugins/Apple Mail/main.py

 
     def initialize (cls):
         cls.registerBundle()
-        NSLog('ToyMailBundle2 registered with Mail')        
+        NSLog('ToyMailBundle2 registered with Mail')
 
     initialize = classmethod(initialize)

pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/AsyncPythonInterpreter.py

     # allow the address to be re-used in a reasonable amount of time
     if os.name == 'posix' and sys.platform != 'cygwin':
         serversock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-        
+
     serversock.bind(hostport)
     serversock.listen(5)
     return serversock
         self.port = default(u'AsyncPythonInterpreterInterpreterPort', 0, int)
         self.interpreterPath = default(u'AsyncPythonInterpreterInterpreterPath', u'/usr/bin/python', unicode)
         self.scriptPath = type(self).bundleForClass().pathForResource_ofType_(u'tcpinterpreter', u'py')
-    
+
     def connect(self):
         #NSLog(u'connect')
         self.serverSocket = bind_and_listen((self.host, self.port))
         except objc.error:
             self.close()
         #NSLog(u'bytes written.')
-    
+
     def childTaskTerminated_(self, notification):
         #NSLog(u'childTaskTerminated_')
         self.close()
             except objc.error:
                 pass
             self.remoteFileHandle = None
-    
+
     def terminateChildTask(self):
         #NSLog(u'terminateChildTask')
         if self.childTask is not None:
         self.closeServerFileHandle()
         self.closeRemoteFileHandle()
         self.terminateChildTask()
-        
+
 def test_console():
     from PyObjCTools import AppHelper
     from ConsoleReactor import ConsoleReactor

pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/ConsoleReactor.py

         self.connection = None
         self.commands = {}
         return self
-    
+
     def connectionEstablished_(self, connection):
         #NSLog(u'connectionEstablished_')
         self.connection = connection
     def writeCode_(self, code):
         #NSLog(u'writeCode_')
         self.connection.writeBytes_(repr(code) + '\n')
-    
+
     def netEval_(self, s):
         #NSLog(u'netEval_')
         return eval(s, self.pool.namespace, self.pool.namespace)
         code = 'raise ' + nr.netrepr_exception(e)
         print "forwarding:", code
         self.writeCode_(code)
-    
+
     def doCallback_sequence_args_(self, callback, seq, args):
         nr = self.netReprCenter
         try:
             self.sendException_sequence_(e, seq)
         else:
             self.sendResult_sequence_(rval, seq)
-    
+
     def deferCallback_sequence_value_(self, callback, seq, value):
         self.commands[seq] = callback
         self.writeCode_('pipe.respond(%r, netrepr(%s))' % (seq, value))
-    
+
     def handleExpectCommand_(self, command):
         #NSLog(u'handleExpectCommand_')
         seq = command[0]

pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/RemotePyInterpreter.py

         #    self.doCallback_sequence_args_(meth, seq, args[1:])
         else:
             self.doCallback_sequence_args_(NSLog, seq, [u'%s does not respond to expect %s', self, command])
-    
+
     def close(self):
         super(RemotePyInterpreterReactor, self).close()
         self.delegate = None
         if not hasattr(self, 'version'):
             return u'Starting...'
         return u'Python %s - %s - %s' % (self.version, self.executable, self.pid)
-    
+
     def updateChangeCount_(self, val):
         return
 
         if self.interpreter is not None:
             self.interpreter.close()
             self.interpreter = None
-    
+
     def windowNibName(self):
         return u'RemotePyInterpreterDocument'
-    
+
     def isDocumentEdited(self):
         return False
-    
+
     def awakeFromNib(self):
         # XXX - should this be done later?
         self.setFont_(NSFont.userFixedPitchFontOfSize_(10))
 
     def setColor_forName_(self, color, name):
         self.p_colors[name] = color
-    
+
     #
     #  Convenience methods for manipulating the NSTextView
     #
     #
 
     def textView_completions_forPartialWordRange_indexOfSelectedItem_(self, aTextView, completions, (begin, length), index):
-        # XXX 
+        # XXX
         # this will probably have to be tricky in order to be asynchronous..
         # either by:
         #     nesting a run loop (bleh)
 
     def setSingleLineInteraction_(self, v):
         self.p_singleLineInteraction = v
-    
-        
+
+
 
 if __name__ == '__main__':
     AppHelper.runEventLoop(installInterrupt=True)

pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/netrepr.py

         self.objectPool = objectPool
         self.cache = {}
         self._identfactory = itertools.count()
-    
+
     def clear(self):
         self.cache.clear()
         self._identfactory = itertools.count()
-        
+
     def netrepr_tuple(self, obj):
         return repr(tuple(itertools.imap(self.netrepr, obj)))
 
         pool = self.pools.pop()
         for ref, count in pool.iteritems():
             ref.release(count)
- 
+
     def referenceForObject(self, obj):
         raise TypeError, "Can not create a reference to %r, the bridge is unidirectional" % (obj,)
 
         if rval is None:
             rval = RemoteObjectReference(self, ident, type_string)
         return rval
- 
+
 
 class ObjectPool(BaseObjectPool):
     def __init__(self):
 
     def object_alloc(self, ref, obj_id):
         self.obj_ids[obj_id] = ref
-    
+
     def object_dealloc(self, ref, obj_id):
         del self.obj_ids[obj_id]
-    
+
     def objectForIdent(self, ident):
         return self.referenceForIdent(ident).obj
 
             rval = ObjectReference(self, ident, type_string(obj), obj, obj_id)
             rval = rval.alloc().autorelease()
         return rval
-        
+
 
 class BaseObjectReference(object):
     def __init__(self, objectPool, ident, type_string):
             raise ValueError, "Reference %r over-released (%r -> %r)" % (self, self.retainCount, newCount)
         self.retainCount = newCount
         return self
-            
+
     def autorelease(self):
         #print "%s.autorelease()" % (self,)
         self.objectPool.autorelease(self)
         self.obj = None
         self.obj_id = -1
         BaseObjectReference.dealloc(self)
-    
+
     def __netrepr__(self):
         return "__ref__(%r, %r)" % (self.ident, self.type_string)
 

pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/remote_console.py

 
     def excepthook(self, type, value, traceback):
         return self.pipe.expect('RemoteConsole.excepthook', type, value, traceback)
-    
+
     def runcode(self, code):
         try:
             exec code in self.locals

pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/remote_pipe.py

 
     def respond(self, *args):
         self.send('respond', *args)
-        
+
     def expect(self, *args):
         self.pool.push()
         try:
     def writelines(self, lines):
         for line in lines:
             self.write(line)
-    
+
     def close(self):
         self.closed = True
 

pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/tcpinterpreter.py

     source = eval(source)
     co = compile(source+'\n', '<remote-source>', 'exec')
     exec co in g
-    
+
 def serveonce(clientsock, name='stdin'):
     clientfile = clientsock.makefile('r+b', 0)
     g = {
     g.update(newglobals)
     serverglobals = {'__name__': '__socketclient__'}
     execfile(sourcefile, serverglobals, serverglobals)
-    
+
 if __name__ == '__main__':
     main()
 elif __name__ == '__socketclient__':

pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/test_client.py

     # allow the address to be re-used in a reasonable amount of time
     if os.name == 'posix' and sys.platform != 'cygwin':
         serversock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-        
+
     serversock.bind(hostport)
     serversock.listen(5)
     return serversock

pyobjc-core/Examples/Scripts/autoreadme.py

                     return
                 workspace.openFile_withApplication_(fullPath, app)
 
-# Create an instance of our notification handler, and ask the workspace 
+# Create an instance of our notification handler, and ask the workspace
 # notification center to tell us when a new volume is mounted.
 workspace = NSWorkspace.sharedWorkspace()
 notificationCenter = workspace.notificationCenter()

pyobjc-core/Examples/Scripts/instrumentSends.py

 """
-Warning: this script uses an undocumented, private API of the Objective-C 
+Warning: this script uses an undocumented, private API of the Objective-C
 runtime.
 
-It sometimes is useful to see which Objective-C methods are called in a 
+It sometimes is useful to see which Objective-C methods are called in a
 program. Luckily the Objective-C runtime contains a private API for logging
 all method calls. This file shows how to call that API.
 """
 #   with you're program itself but are generated by the bridge code (such
 #   as all NSClassicMapTable calls in the example in the previous item).
 
-instrumentObjcMessageSends(True) 
+instrumentObjcMessageSends(True)
 
 # To disable
-instrumentObjcMessageSends(False) 
+instrumentObjcMessageSends(False)

pyobjc-core/Lib/PyObjCTools/KeyValueCoding.py

         if count == 0:
             return 0.0
         return msum(map(float, lst)) / count
-    
+
     def count(self, obj, segments):
         return len(obj)
-    
+
     def distinctUnionOfArrays(self, obj, segments):
         path = '.'.join(segments)
         rval = []
             rval.append(item)
             s.add(item)
         return rval
-        
+
     def max(self, obj, segments):
         path = '.'.join(segments)
         return max(getKeyPath(obj, path))
-    
+
     def min(self, obj, segments):
         path = '.'.join(segments)
         return min(getKeyPath(obj, path))
-    
+
     def sum(self, obj, segments):
         path = '.'.join(segments)
         lst = getKeyPath(obj, path)
             # This is not entirely correct, should check if this
             # is the right kind of ValueError before translating
             raise KeyError(str(msg))
-    
+
     # check for dict-like objects
     getitem = getattr(obj, '__getitem__', None)
     if getitem is not None:
     """
     if obj is None:
         return None
-        
+
     if isinstance(obj, (objc.objc_object, objc.objc_class)):
         return obj.valueForKeyPath_(keypath)
 
     """
     if obj is None:
         return
-        
+
     if isinstance(obj, (objc.objc_object, objc.objc_class)):
         return getattr(obj, SETVALUEFORKEYPATH)(value, keypath)
 
 
     return setKey(cur, elements[-1], value)
 
-        
+
 class kvc(object):
     def __init__(self, obj):
         self.__pyobjc_object__ = obj
-    
+
     def __getattr__(self, attr):
         return getKey(self.__pyobjc_object__, attr)
 

pyobjc-core/Lib/PyObjCTools/TestSupport.py

                 and _typealias.get(type, type) != _typealias.get(tp, tp):
             self.fail(message or "result of %r is not of type %r, but %r"%(
                 method, tp, type))
-        
+
     def assertArgHasType(self, method, argno, tp, message=None):
         if isinstance(method, objc.selector):
             offset = 2
             self.fail(message or "arg %d of %s is not an 'in' argument"%(
                 argno, method))
 
-    
+
     #
     # Addition assert methods, all of them should only be necessary for
     # python 2.7 or later
 
     if not hasattr(_unittest.TestCase, 'assertItemsEqual'): # pragma: no cover
         def assertItemsEqual(self, seq1, seq2, message=None):
-            # This is based on unittest.util._count_diff_all_purpose from 
+            # This is based on unittest.util._count_diff_all_purpose from
             # Python 2.7
             s, t = list(seq1), list(seq2)
             m, n = len(s), len(t)
 
     if not hasattr(_unittest.TestCase, "assertAlmostEquals"): # pragma: no cover
         def assertAlmostEquals(self, val1, val2, message=None):
-            self.failUnless(abs (val1 - val2) < 0.00001, 
+            self.failUnless(abs (val1 - val2) < 0.00001,
                     message or 'abs(%r - %r) >= 0.00001'%(val1, val2))
 
 
         def test(self):
             try:
                 func(self)
-            
+
             except AssertionError:
                 return
 

pyobjc-core/Lib/PyObjCTools/test/__init__.py

-"""Unit test package."""
+"""Unit test package."""

pyobjc-core/Lib/PyObjCTools/test/test_keyvalue.py

 class Transaction(object):
     def __init__(self, **kw):
         self.__dict__.update(kw)
-        
+
 class PyObjCAccount(NSObject):
     openingBalance = objc.ivar('openingBalance', 'd')
     name = objc.ivar('name')
         for k, v in kw.iteritems():
             setattr(self, k, v)
         return self
-        
+
 class PyObjCTransaction(NSObject):
     referenceNumber = objc.ivar('referenceNumber', 'I')
     amount = objc.ivar('amount', 'd')
 
 class TestArrayOperators(unittest.TestCase):
     def setUp(self):
-        self.accounts = makeAccounts(Account, Transaction)    
+        self.accounts = makeAccounts(Account, Transaction)
     def testCount(self):
         self.assertEquals(
             getKeyPath(self, u'accounts.@count'), 2)
                 self.accounts,
                 u'@distinctUnionOfArrays.transactions.category'),
             [u'Tacos', u'Bagels', u'Tequila', u'Beer', u'Book'])
-    
+
     def testDistinctUnionOfObjects(self):
         alice = self.accounts[0]
         v = getKeyPath(alice, u'transactions.@distinctUnionOfObjects.payee')
                 alice,
                 u'transactions.@max.amount'),
             250)
-            
+
     def testMin(self):
         alice = self.accounts[0]
         self.assertEquals(
                 bob,
                 u'transactions.@sum.amount'),
             25 + 60 + 250)
-    
+
     def testUnionOfArrays(self):
         self.assertEquals(
             getKeyPath(
                 self.accounts,
                 u'@unionOfArrays.transactions.category'),
             [u'Tacos', u'Bagels', u'Tequila', u'Beer', u'Book', u'Tequila'])
-    
+
     def testUnionOfObjects(self):
         alice = self.accounts[0]
         self.assertEquals(

pyobjc-core/Lib/objc/__init__.py

 # Import the namespace from the _objc extension
 def _update(g=globals()):
 
-    # Dummy import of copy_reg, needed 
+    # Dummy import of copy_reg, needed
     # for py2app.
     if sys.version_info[0] == 2:
         import copy_reg
         m = getattr(m, k)
 
     return getattr(m, name)
-

pyobjc-core/Lib/objc/_bridges.py

 def registerListType(type):
     """
     Register 'type' as a list-like type that will be proxied
-    as an NSMutableArray subclass. 
+    as an NSMutableArray subclass.
     """
     OC_PythonArray = lookUpClass('OC_PythonArray')
     OC_PythonArray.depythonifyTable().append(type)
 def registerMappingType(type):
     """
     Register 'type' as a list-like type that will be proxied
-    as an NSMutableArray subclass. 
+    as an NSMutableArray subclass.
     """
     OC_PythonDictionary = lookUpClass('OC_PythonDictionary')
     OC_PythonDictionary.depythonifyTable().append(type)

pyobjc-core/Lib/objc/_bridgesupport.py

 # The rest of this file contains support for bridgesupport
 # XML files.
 #
-# TODO: parseBridgeSupport (and its support class) is a 
+# TODO: parseBridgeSupport (and its support class) is a
 #       basic port from C, check if it can be simplified.
 
 # NOTE: This search path only contains system locations to
 
 class _BridgeSupportParser (object):
     """
-    Parser for the bridge support file format. 
+    Parser for the bridge support file format.
 
     Instances of this class will not update the bridge state,
     this makes it easier to test the class.
                         result.append(b'"')
                         result.append(_as_bytes(nm))
                         result.append(b'"')
-                    
+
                     result.append(self.typestr2typestr(tp))
                 result.append(stop)
 
 
             is_class = self.attribute_bool(method, "classmethod", None, _SENTINEL)
             if is_class is _SENTINEL:
-                # Manpage says 'class_method', older PyObjC used 'classmethod' 
+                # Manpage says 'class_method', older PyObjC used 'classmethod'
                 is_class = self.attribute_bool(method, "class_method", None, False)
-            
+
 
             metadata = {}
             if ignore:
 
         if self.attribute_bool(node, "ignore", None, False):
             return
-        
+
         meta = {}
         siglist = [b"v"]
         arguments = meta["arguments"] = {}
             typestr  = self.attribute_string(method, "type", "type64")
             is_class = self.attribute_bool(method, "classmethod", None, _SENTINEL)
             if is_class is _SENTINEL:
-                # Manpage says 'class_method', older PyObjC used 'classmethod' 
+                # Manpage says 'class_method', older PyObjC used 'classmethod'
                 is_class = self.attribute_bool(method, "class_method", None, False)
 
             if not sel_name or not typestr:
                 continue
 
             typestr = self.typestr2typestr(typestr)
-            sel = objc.selector(None, selector=_as_bytes(sel_name), 
+            sel = objc.selector(None, selector=_as_bytes(sel_name),
                     signature=_as_bytes(typestr), isClassMethod=is_class)
             method_list.append(sel)
 
     try:
         return  pkg_resources.resource_exists(package, resource)
     except ImportError:
-        # resource_exists raises ImportError when it cannot find 
+        # resource_exists raises ImportError when it cannot find
         # the first argument.
         return False
 
 def initFrameworkWrapper(frameworkName,
-        frameworkPath, frameworkIdentifier, globals, inlineTab=None, 
+        frameworkPath, frameworkIdentifier, globals, inlineTab=None,
         scan_classes=None, frameworkResourceName=None):
     """
     Load the named framework, using the identifier if that has result otherwise
                     globals,
                     bundle_identifier=frameworkIdentifier,
                     scan_classes=scan_classes)
-        
+
         except ImportError:
             if scan_classes is None:
                 bundle = objc.loadBundle(
     globals['super'] = objc.super
 
     # Look for metadata in the Python wrapper and prefer that over the
-    # data in the framework or in system locations. 
+    # data in the framework or in system locations.
     # Needed because the system bridgesupport files are buggy.
     if safe_resource_exists(frameworkResourceName, "PyObjC.bridgesupport"):
         data = pkg_resources.resource_string(frameworkResourceName,
                 _parseBridgeSupport(data, globals, frameworkName, inlineTab=inlineTab)
 
         return bundle
-    
+
     # If there is no metadata there look for metadata in the standard Library
     # locations
     fn = frameworkName + '.bridgesupport'
                 _parseBridgeSupport(data, globals, frameworkName, dylib_path=dylib_path)
             else:
                 _parseBridgeSupport(data, globals, frameworkName)
-            
+
             # Check if we have additional metadata bundled with PyObjC
             if safe_resource_exists(frameworkResourceName, "PyObjCOverrides.bridgesupport"):
                 data = pkg_resources.resource_string(frameworkResourceName,
                     _parseBridgeSupport(data, globals, frameworkName, inlineTab=inlineTab)
 
             return bundle
-    
+
     return bundle
 
 _ivar_dict = objc._objc._ivar_dict()

pyobjc-core/Lib/objc/_category.py

 
 def Category(cls):
     """
-    Create a category on ``cls``. 
+    Create a category on ``cls``.
 
     Usage:
         class SomeClass (Category(SomeClass)):

pyobjc-core/Lib/objc/_context.py

 """
-A number of Cocoa API's have a 'context' argument that is a plain 'void*' 
+A number of Cocoa API's have a 'context' argument that is a plain 'void*'
 in ObjC, and an Integer value in Python.  The 'context' object defined here
 allows you to get a unique integer number that can be used as the context
 argument for any Python object, and retrieve that object later on using the
 
 and in the callback::
 
-    def observeValueForKeyPath_ofObject_change_context_(self, 
+    def observeValueForKeyPath_ofObject_change_context_(self,
         kp, obj, change, ctx):
 
         myContext = objc.context.get(ctx)

pyobjc-core/Lib/objc/_convenience.py

         if not isinstance(sel, selector):
             continue
 
-        # 
+        #
         # Handle some common exceptions to the usual rules:
         #
 
     if name == 'NSObject':
         class kvc (object):
             """
-            Key-Value-Coding accessor for Cocoa objects. 
-            
-            Both attribute access and dict-like indexing will attempt to 
+            Key-Value-Coding accessor for Cocoa objects.
+
+            Both attribute access and dict-like indexing will attempt to
             access the requested item through Key-Value-Coding.
             """
             __slots__ = ('__object',)
 
 
 #
-# The following conveniences should strictly speaking be in 
+# The following conveniences should strictly speaking be in
 # in pyobjc-framework-Foundation, but as they are very fundamental
 # we're keeping them here.
 #
 
 def __setitem__setObject_forKey_(self, key, value):
     self.setObject_forKey_(container_wrap(value), container_wrap(key))
-   
+
 pop_setObject_dflt=object()
 def pop_setObject_forKey_(self, key, dflt=pop_setObject_dflt):
     try:
     if not isinstance(anArray, (NSArray, list, tuple)):
         anArray = list(anArray)
     return anArray
-    
+
 
 def extend_addObjectsFromArray_(self, anArray):
     self.addObjectsFromArray_(ensureArray(anArray))
 
         if itemcount == 0:
             raise ValueError("%s.index(x): x not in list" % (type(self).__name__,))
-           
+
         else:
             if start >= itemcount:
                 start = itemcount - 1
                 stop = itemcount - 1
 
             if stop <= start:
-                ln = 0 
+                ln = 0
             else:
 
                 ln = stop - start
 
             if ln == 0:
                 raise ValueError("%s.index(x): x not in list" % (type(self).__name__,))
-            
+
             if ln > sys.maxsize:
                 ln = sys.maxsize
 
 )
 
 def insert_insertObject_atIndex_(self, idx, item):
-    if idx < 0: 
+    if idx < 0:
         idx += len(self)
         if idx < 0:
             raise IndexError("list index out of range")
         #    if m is not None:
         #        return m((start, stop - start))
         return [self[i] for i in range(start, stop, step)]
-    
+
     elif not isinstance(idx, INT_TYPES):
         raise TypeError("index must be a number")
-    
+
     if idx < 0:
         idx += len(self)
         if idx < 0:
         idx += len(self)
         if idx < 0:
             raise IndexError("list index out of range")
-        
+
     self.removeObjectAtIndex_(idx)
 
 def __delslice__removeObjectAtIndex_(self, i, j):
     __delitem__removeObjectAtIndex_(self, slice(i, j))
-    
+
 def pop_removeObjectAtIndex_(self, idx=-1):
     length = len(self)
     if length <= 0:
                 toAssign = list(anObject)
             else:
                 toAssign = anObject
-            for inIdx, outIdx in enumerate(range(start, stop, step)): 
+            for inIdx, outIdx in enumerate(range(start, stop, step)):
                 self.replaceObjectAtIndex_withObject_(outIdx, toAssign[inIdx])
 
         elif step == 0:
                 toAssign = list(anObject)
             else:
                 toAssign = anObject
-            for inIdx, outIdx in enumerate(range(start, stop, step)): 
+            for inIdx, outIdx in enumerate(range(start, stop, step)):
                 self.replaceObjectAtIndex_withObject_(outIdx, toAssign[inIdx])
 
 
 registerMetaDataForSelector(b"NSObject", b"sortUsingFunction:context:",
         dict(
             arguments={
-                2:  { 
+                2:  {
                         'callable': {
                             'reval': 'i',
                             'arguments': {
 def NSMutableData__setslice__(self, i, j, sequence):
     # XXX - could use replaceBytes:inRange:, etc.
     self.mutableBytes()[i:j] = sequence
-    
+
 def NSMutableData__setitem__(self, item, value):
     self.mutableBytes()[item] = value
 
 
             if len(self) == len(other):
                 return all_contained_in(self, other)
-        
+
             else:
                 return False
 
 
             if len(self) == len(other):
                 return not all_contained_in(self, other)
-        
+
             else:
                 return True
 
             result = set(self)
             result.symmetric_difference_update(other)
             return result
-    
+
     #collections.Set.register(nsdict_view)
 
     class nsdict_keys(nsdict_view):
             #keys.sort()
 
             return "<nsdict_keys({0})>".format(keys)
-            
+
 
         def __len__(self):
             return len(self.__value)
 
     def nsdict__richcmp__(self, other):
         return NotImplemented
-        
+
 
     if sys.version_info[0] == 3:
         CLASS_METHODS['NSDictionary'] = (
             ('items', lambda self: nsdict_items(self)),
 
             # Explicitly add these methods, instead of relying
-            # on the selector based selection. 
+            # on the selector based selection.
             #
             # Primary reason: turns out at least the chosen
             # implementation for __contains__ depends on dict
-            # iteration order, and one of the implementation doesn't 
+            # iteration order, and one of the implementation doesn't
             # work for NSDictionary.
             #
-            # In the slightly longer run all python API 
-            # implementations will be added explictly to 
+            # In the slightly longer run all python API
+            # implementations will be added explictly to
             # classes because of this, and because this allows
             # for a faster implementation of method dispatch.
             ('__getitem__', __getitem__objectForKey_),
         if item not in self:
             result.add(item)
     return result
-    
+
 
 def nsset__contains__(self, value):
     hash(value) # Force error for non-hashable values
     )
 
 CLASS_METHODS['NSMutableSet'] = (
-    ('add',  nsset_add), 
+    ('add',  nsset_add),
     ('remove',  nsset_remove),
     ('discard',  nsset_discard),
     ('update', nsset_update),

pyobjc-core/Lib/objc/_descriptors.py

             raise TypeError('%s expected to take %d args, but must accept %d from Objective-C (implicit self plus count of underscores)' % (funcName, maxArgs, selArgs))
         else:
             raise TypeError('%s expected to take between %d and %d args, but must accept %d from Objective-C (implicit self plus count of underscores)' % (funcName, minArgs, maxArgs, selArgs))
-    
+
     if selArgs == 3:
         if funcName.startswith('validate') and funcName.endswith('_error_'):
             return selector(func, signature=_C_NSBOOL + b'@:N^@o^@')
             return selector(func, signature=b'v@:' + _C_NSUInteger + typeSignature)
 
         elif funcName.startswith('get') and funcName.endswith('_range_'):
-            return selector(func, signature=b'v@:o^@' + _C_NSRange) 
+            return selector(func, signature=b'v@:o^@' + _C_NSRange)
 
         elif funcName.startswith('insert') and funcName.endswith('_atIndexes_'):
-            return selector(func, signature=b'v@:@@') 
+            return selector(func, signature=b'v@:@@')
 
         elif funcName.startswith('replace') and 'AtIndexes_with' in funcName:
-            return selector(func, signature=b'v@:@@') 
+            return selector(func, signature=b'v@:@@')
 
         # pass through to "too many arguments"
 
 def typedAccessor(typeSignature):
     """
     Decorator for creating a typed accessor, usage:
-        
+
         @typedAccessor('i')
         def someIntegerAccessor(self):
             return self.someInteger
     decorator is optional when the callback isn't stored by the called function
 
     Usage::
-        
+
         @objc.callbackFor(NSArray.sortedArrayUsingFunction_context_)
         def compare(left, right, context):
             return 1
     used as the selector argument to the specified method.
 
     Usage::
-        
+
         @objc.selectorFor(NSApplication.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_)
         def sheetDidEnd_returnCode_contextInfo_(self, sheet, returnCode, info):
             pass
         except (IndexError, KeyError):
             raise ValueError("Not a selector argument with type information")
 
-    def addSignature(function): 
+    def addSignature(function):
         return selector(function, signature=signature)
 
     return addSignature
     is used and special features (like copying) are needed
 
     usage::
-        
+
         class MyClass (NSObject):
             objc.synthesize('someTitle', copy=True)
 
     of Objective-C selectors.
 
     Usage::
-        
+
         @objc.signature('i@:if')
         def methodWithX_andY_(self, x, y):
             return 0

pyobjc-core/Lib/objc/_lazyimport.py

                 {},
                 bundle_identifier=frameworkIdentifier,
                 scan_classes=False)
-        
+
         except ImportError:
             bundle = loadBundle(
                 frameworkName,
 
     # Define slots for all attributes, that way they don't end up it __dict__.
     __slots__ = (
-                '_ObjCLazyModule__bundle', '_ObjCLazyModule__enummap', '_ObjCLazyModule__funcmap', 
+                '_ObjCLazyModule__bundle', '_ObjCLazyModule__enummap', '_ObjCLazyModule__funcmap',
                 '_ObjCLazyModule__parents', '_ObjCLazyModule__varmap', '_ObjCLazyModule__inlinelist',
                 '_ObjCLazyModule__aliases',
             )
                     metadict['protocols'])
 
             for p in objc.protocolsForProcess():
-                                setattr(self.__dict__['protocols'], p.__name__, p)
+                setattr(self.__dict__['protocols'], p.__name__, p)
 
 
     def __dir__(self):
             else:
                 self.__dict__[name] = value
                 return value
-        
+
         # Check if the name is a constant from
         # the metadata files
         try:
         for name, type, gettypeid_func, tollfree in cftypes:
             if tollfree:
                 for nm in tollfree.split(','):
-                    try: 
+                    try:
                         objc.lookUpClass(nm)
                     except objc.error:
                         pass
             try:
                 func = getattr(self, gettypeid_func)
             except AttributeError:
-                # GetTypeID function not found, this is either 
+                # GetTypeID function not found, this is either
                 # a CFType that isn't present on the current
                 # platform, or a CFType without a public GetTypeID
                 # function. Proxy using the generic CFType
 
             if tollfree:
                 for nm in tollfree.split(','):
-                    try: 
+                    try:
                         objc.lookUpClass(nm)
                     except objc.error:
                         pass

pyobjc-core/Lib/objc/_locking.py

 """
 Support for @synchronized blocks
 
-The python class object_lock is a contextmanager for with statements that 
-can also be used manually. 
+The python class object_lock is a contextmanager for with statements that
+can also be used manually.
 """
 import objc as _objc
 
     @synchronized statements in Objective-C. Locking can also
     be done manually using the ``lock`` and ``unlock`` methods.
 
-    The mutex for object ``anObject`` is represented by 
+    The mutex for object ``anObject`` is represented by
     ``objc.object_lock(anObject)``.
     """
     def __init__(self, value):

pyobjc-core/Lib/objc/_properties.py

     return setter
 
 class object_property (object):
-    def __init__(self, name=None, 
-            read_only=False, copy=False, dynamic=False, 
+    def __init__(self, name=None,
+            read_only=False, copy=False, dynamic=False,
             ivar=None, typestr=_C_ID, depends_on=None):
         self.__created = False
         self.__inherit = False
         else:
             depends = self._depends_on.copy()
 
-        v = type(self)(name=self._name, 
+        v = type(self)(name=self._name,
                 read_only=self._ro, copy=self._copy, dynamic=self._dynamic,
                 ivar=self._ivar, typestr=self._typestr, depends_on=depends)
         v.__inherit = True
         return self
 
 class bool_property (object_property):
-    def __init__(self, name=None, 
-            read_only=False, copy=False, dynamic=False, 
+    def __init__(self, name=None,
+            read_only=False, copy=False, dynamic=False,
             ivar=None, typestr=_C_NSBOOL):
         super(bool_property, self).__init__(
                 name, read_only, copy, dynamic, ivar, typestr)
 
             else:
                 return NSIndexSet.alloc().initWithIndex_(index)
-        
+
 
 
     def __repr__(self):
 #