Commits

Ronald Oussoren committed 4cdcd4c

import output of the new signatures tool

  • Participants
  • Parent commits 925f493
  • Branches pyobjc-ancient

Comments (0)

Files changed (24)

Lib/AddressBook/__init__.py

     )
 
 import protocols  # no need to export these, just register with PyObjC
-
-# Define useful utility methods here
-
-_objc.setSignatureForSelector('NSImagePickerController', 'setTarget:selector:userInfo:', 'v@:@:i')
-
-# Not entirely correct...
-_objc.setSignatureForSelector('ABAuthenticationInfo', 'appliesToRequest:', 'c@:@')
-_objc.setSignatureForSelector('ABAuthenticationInfo', 'applyToRequest:', 'c@:@')
-_objc.setSignatureForSelector('ABDAVQuery', 'buildRequest', '@@:')
-_objc.setSignatureForSelector('ABPerson', 'encodedDataForValue:charsetName:', '@@:@o^@')
+import _signatures

Lib/AddressBook/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+setSignatureForSelector('ABAddressBook', 'nts_AddTable:withPropertiesAndTypes:needsReadWriteMode:registerDataTypes:neededRegistering:', 'c@:@@cco^c')
+setSignatureForSelector('ABAuthenticationInfo', 'appliesToRequest:', 'c@:@')
+setSignatureForSelector('ABAuthenticationInfo', 'applyToRequest:', 'c@:@')
+setSignatureForSelector('ABDAVManager', 'canReachDotMacError:', 'c@:o^@')
+setSignatureForSelector('ABDAVQuery', 'buildRequest', '@@:')
+setSignatureForSelector('ABDBCache', 'databaseChangedForUserInfo:groupsChanged:peopleChanged:', 'v@:@o^co^c')
+setSignatureForSelector('ABFileManager', 'ACLsAtURL:read:write:', 'c@:@o^@o^@')
+setSignatureForSelector('ABFileManager', 'dictionaryAtURL:errorCode:securely:', '@@:@o^ic')
+setSignatureForSelector('ABGroupsController', 'sharingProgressForGroup:showUpdateSharingIndicator:', 'f@:@o^c')
+setSignatureForSelector('ABPerson', 'encodedDataForValue:charsetName:', '@@:@o^@')
+setSignatureForSelector('ABSearchElementHelper', 'calculateBestDateType:andBestValue:forTimeInterval:', 'v@:o^io^dd')
+setSignatureForSelector('ABSearchElementHelper', 'isSingleSearchElement:property:value:comparison:level:', 'c@:@o^@o^@o^ii')
+# end of file

Lib/AppKit/__init__.py

 documentation for details on how to use these functions and classes.
 """
 
-import _AppKitSignatures
+import _signatures
 import objc as _objc
 
 # Import contansts and global functions.

Lib/AppKit/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+setSignatureForSelector('NSApplication', 'runModalSession:', 'i@:^{_NSModalSession=@@^{_NSModalSession}iciI^vi@@:^vi}')
+setSignatureForSelector('NSATSTypesetter', 'lineFragmentRectForProposedRect:remainingRect:', '{_NSRect={_NSPoint=ff}{_NSSize=ff}}@:{_NSRect={_NSPoint=ff}{_NSSize=ff}}o^{_NSRect={_NSPoint=ff}{_NSSize=ff}}')
+setSignatureForSelector('NSApplication', 'openFile:ok:', 'i@:@o^i')
+setSignatureForSelector('NSApplication', 'openTempFile:ok:', 'i@:@o^i')
+setSignatureForSelector('NSBitmapImageRep', 'getCompression:factor:', 'v@:o^io^f')
+setSignatureForSelector('NSButton', 'getPeriodicDelay:interval:', 'v@:o^fo^f')
+setSignatureForSelector('NSCell', 'getPeriodicDelay:interval:', 'v@:o^fo^f')
+setSignatureForSelector('NSColor', 'getCyan:magenta:yellow:black:alpha:', 'v@:o^fo^fo^fo^fo^f')
+setSignatureForSelector('NSColor', 'getHue:saturation:brightness:alpha:', 'v@:o^fo^fo^fo^f')
+setSignatureForSelector('NSColor', 'getRed:green:blue:alpha:', 'v@:o^fo^fo^fo^f')
+setSignatureForSelector('NSColor', 'getWhite:alpha:', 'v@:o^fo^f')
+setSignatureForSelector('NSFont', 'positionOfGlyph:precededByGlyph:isNominal:', '{_NSPoint=ff}@:IIo^c')
+setSignatureForSelector('NSFont', 'positionOfGlyph:struckOverGlyph:metricsExist:', '{_NSPoint=ff}@:IIo^c')
+setSignatureForSelector('NSFont', 'positionOfGlyph:struckOverRect:metricsExist:', '{_NSPoint=ff}@:I{_NSRect={_NSPoint=ff}{_NSSize=ff}}o^c')
+setSignatureForSelector('NSFont', 'positionOfGlyph:withRelation:toBaseGlyph:totalAdvancement:metricsExist:', '{_NSPoint=ff}@:IiIo^{_NSSize=ff}o^c')
+setSignatureForSelector('NSInputManager', 'getMarkedText:selectedRange:', 'v@:o^@o^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'characterRangeForGlyphRange:actualGlyphRange:', '{_NSRange=II}@:{_NSRange=II}o^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'getFirstUnlaidCharacterIndex:glyphIndex:', 'v@:o^Io^I')
+setSignatureForSelector('NSLayoutManager', 'glyphAtIndex:isValidIndex:', 'I@:Io^c')
+setSignatureForSelector('NSLayoutManager', 'glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:', 'I@:{_NSPoint=ff}@o^f')
+setSignatureForSelector('NSLayoutManager', 'glyphRangeForCharacterRange:actualCharacterRange:', '{_NSRange=II}@:{_NSRange=II}o^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'invalidateGlyphsForCharacterRange:changeInLength:actualCharacterRange:', 'v@:{_NSRange=II}io^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:', 'v@:{_NSRange=II}co^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'layoutRectForTextBlock:atIndex:effectiveRange:', '{_NSRect={_NSPoint=ff}{_NSSize=ff}}@:@Io^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'lineFragmentRectForGlyphAtIndex:effectiveRange:', '{_NSRect={_NSPoint=ff}{_NSSize=ff}}@:Io^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'lineFragmentRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:', '{_NSRect={_NSPoint=ff}{_NSSize=ff}}@:Io^{_NSRange=II}c')
+setSignatureForSelector('NSLayoutManager', 'lineFragmentUsedRectForGlyphAtIndex:effectiveRange:', '{_NSRect={_NSPoint=ff}{_NSSize=ff}}@:Io^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'lineFragmentUsedRectForGlyphAtIndex:effectiveRange:allowLayout:', '{_NSRect={_NSPoint=ff}{_NSSize=ff}}@:Io^{_NSRange=II}c')
+setSignatureForSelector('NSLayoutManager', 'temporaryAttributesAtCharacterIndex:effectiveRange:', '@@:Io^{_NSRange=II}')
+setSignatureForSelector('NSLayoutManager', 'textContainerForGlyphAtIndex:effectiveRange:', '@@:Io^{_NSRange=II}')
+setSignatureForSelector('NSMatrix', 'getNumberOfRows:columns:', 'v@:o^io^i')
+setSignatureForSelector('NSMatrix', 'getRow:column:forPoint:', 'c@:o^io^i{_NSPoint=ff}')
+setSignatureForSelector('NSMatrix', 'getRow:column:ofCell:', 'c@:o^io^i@')
+setSignatureForSelector('NSNib', 'instantiateNibWithOwner:topLevelObjects:', 'c@:@N^@')
+setSignatureForSelector('NSPSMatrix', 'invTransform:', '@@:N^{_NSPoint=ff}')
+setSignatureForSelector('NSPSMatrix', 'invTransformRect:', '@@:N^{_NSRect={_NSPoint=ff}{_NSSize=ff}}')
+setSignatureForSelector('NSPSMatrix', 'transform:', '@@:N^{_NSPoint=ff}')
+setSignatureForSelector('NSPSMatrix', 'transformRect:', '@@:N^{_NSRect={_NSPoint=ff}{_NSSize=ff}}')
+setSignatureForSelector('NSPageLayout', 'convertOldFactor:newFactor:', 'v@:n^fo^f')
+setSignatureForSelector('NSSpellChecker', 'checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:', '{_NSRange=II}@:@i@cio^i')
+setSignatureForSelector('NSSpellChecker', 'checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:reconnectOnError:', '{_NSRange=II}@:@i@cio^ic')
+setSignatureForSelector('NSTableView', 'dragImageForRows:event:dragImageOffset:', '@@:@@N^{_NSPoint=ff}')
+setSignatureForSelector('NSTextContainer', 'lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:', '{_NSRect={_NSPoint=ff}{_NSSize=ff}}@:{_NSRect={_NSPoint=ff}{_NSSize=ff}}iio^{_NSRect={_NSPoint=ff}{_NSSize=ff}}')
+setSignatureForSelector('NSTextView', 'dragImageForSelectionWithEvent:origin:', '@@:@N^{_NSPoint=ff}')
+setSignatureForSelector('NSTypesetter', 'characterRangeForGlyphRange:actualGlyphRange:', '{_NSRange=II}@:{_NSRange=II}o^{_NSRange=II}')
+setSignatureForSelector('NSTypesetter', 'layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:nextGlyphIndex:', 'v@:@IIo^I')
+setSignatureForSelector('NSTypesetter', 'layoutParagraphAtPoint:', 'I@:N^{_NSPoint=ff}')
+setSignatureForSelector('NSView', 'adjustPageHeightNew:top:bottom:limit:', 'v@:o^ffff')
+setSignatureForSelector('NSView', 'adjustPageWidthNew:left:right:limit:', 'v@:o^ffff')
+setSignatureForSelector('NSView', 'knowsPageRange:', 'c@:o^{_NSRange=II}')
+setSignatureForSelector('NSWorkspace', 'getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type:', 'c@:@o^co^co^co^@o^@')
+setSignatureForSelector('NSWorkspace', 'getInfoForFile:application:type:', 'c@:@o^@o^@')
+setSignatureForSelector('NSWorkspace', 'launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:', 'c@:@I@o^@')
+setSignatureForSelector('NSWorkspace', 'openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:', 'c@:@@I@o^@')
+setSignatureForSelector('NSWorkspace', 'performFileOperation:source:destination:files:tag:', 'c@:@@@@o^i')
+setSignatureForSelector('NSOpenGLPixelFormat', 'getValues:forAttribute:forVirtualScreen:', 'v@:o^lii')
+# end of file

Lib/AppleScriptKit/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+# end of file

Lib/CoreData/__init__.py

         bundle_identifier=u'com.apple.CoreData',
     )
 import protocols
-
-_objc.setSignatureForSelector("NSManagedObjectContext", "save:", "c@:o^@")
+import _signatures

Lib/CoreData/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+setSignatureForSelector('NSManagedObjectContext', 'save:', 'c@:o^@')
+# end of file

Lib/DiscRecordingUI/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+# end of file

Lib/Foundation/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+setSignatureForSelector('NSAppleScript', 'compileAndReturnError:', 'c@:o^@')
+setSignatureForSelector('NSAppleScript', 'executeAndReturnError:', '@@:o^@')
+setSignatureForSelector('NSArray', 'getObject:atIndex:', 'c@:o^@I')
+setSignatureForSelector('NSAttributedString', 'attribute:atIndex:effectiveRange:', '@@:@Io^{_NSRange=II}')
+setSignatureForSelector('NSAttributedString', 'attribute:atIndex:longestEffectiveRange:inRange:', '@@:@Io^{_NSRange=II}{_NSRange=II}')
+setSignatureForSelector('NSAttributedString', 'attributesAtIndex:effectiveRange:', '@@:Io^{_NSRange=II}')
+setSignatureForSelector('NSAttributedString', 'attributesAtIndex:longestEffectiveRange:inRange:', '@@:Io^{_NSRange=II}{_NSRange=II}')
+setSignatureForSelector('NSAttributedString', 'initWithData:options:documentAttributes:error:', '@@:@@o^@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithDocFormat:documentAttributes:', '@@:@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithHTML:baseURL:documentAttributes:', '@@:@@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithHTML:documentAttributes:', '@@:@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithHTML:options:documentAttributes:', '@@:@@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithPath:documentAttributes:', '@@:@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithRTF:documentAttributes:', '@@:@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithRTFD:documentAttributes:', '@@:@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithRTFDFileWrapper:documentAttributes:', '@@:@o^@')
+setSignatureForSelector('NSAttributedString', 'initWithURL:documentAttributes:', '@@:@o^@')
+setSignatureForSelector('NSBinHexDecoder', 'decodeDownloadData:dataForkData:resourceForkData:', 'c@:@o^@o^@')
+setSignatureForSelector('NSCalendarDate', 'years:months:days:hours:minutes:seconds:sinceDate:', 'v@:o^io^io^io^io^io^i@')
+setSignatureForSelector('NSDeserializer', 'deserializePropertyListFromData:atCursor:mutableContainers:', '@@:@O^Ic')
+setSignatureForSelector('NSDeserializer', 'deserializePropertyListLazilyFromData:atCursor:length:mutableContainers:', '@@:@O^IIc')
+setSignatureForSelector('NSFileManager', 'fileExistsAtPath:isDirectory:', 'c@:@o^c')
+setSignatureForSelector('NSFormatter', 'getObjectValue:forString:errorDescription:', 'c@:o^@@o^@')
+setSignatureForSelector('NSFormatter', 'isPartialStringValid:newEditingString:errorDescription:', 'c@:@o^@o^@')
+setSignatureForSelector('NSFormatter', 'isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:', 'c@:o^@o^{_NSRange=II}@{_NSRange=II}o^@')
+setSignatureForSelector('NSGZipDecoder', 'decodeDownloadData:dataForkData:resourceForkData:', 'c@:@o^@o^@')
+setSignatureForSelector('NSKeyValueProperty', 'keyPathIfAffectedByValueForKey:exactMatch:', '@@:@o^c')
+setSignatureForSelector('NSMacBinaryDecoder', 'decodeDownloadData:dataForkData:resourceForkData:', 'c@:@o^@o^@')
+setSignatureForSelector('NSMutableAttributedString', 'readFromData:options:documentAttributes:', 'c@:@@o^@')
+setSignatureForSelector('NSMutableAttributedString', 'readFromURL:options:documentAttributes:', 'c@:@@o^@')
+setSignatureForSelector('NSNetService', 'getInputStream:outputStream:', 'c@:o^@o^@')
+setSignatureForSelector('NSObject', 'validateValue:forKey:error:', 'c@:N^@@o^@')
+setSignatureForSelector('NSObject', 'validateValue:forKeyPath:error:', 'c@:N^@@o^@')
+setSignatureForSelector('NSPropertyListSerialization', 'dataFromPropertyList:format:errorDescription:', '@@:@io^@')
+setSignatureForSelector('NSPropertyListSerialization', 'propertyListFromData:mutabilityOption:format:errorDescription:', '@@:@io^io^@')
+setSignatureForSelector('NSScanner', 'scanCharactersFromSet:intoString:', 'c@:@o^@')
+setSignatureForSelector('NSScanner', 'scanDecimal:', 'c@:o^{?=b8b4b1b1b18[8S]}')
+setSignatureForSelector('NSScanner', 'scanDouble:', 'c@:o^d')
+setSignatureForSelector('NSScanner', 'scanEndIntoString:', 'c@:o^@')
+setSignatureForSelector('NSScanner', 'scanFloat:', 'c@:o^f')
+setSignatureForSelector('NSScanner', 'scanHexInt:', 'c@:o^I')
+setSignatureForSelector('NSScanner', 'scanInt:', 'c@:o^i')
+setSignatureForSelector('NSScanner', 'scanLongLong:', 'c@:o^q')
+setSignatureForSelector('NSScanner', 'scanString:intoString:', 'c@:@o^@')
+setSignatureForSelector('NSScanner', 'scanUpToCharactersFromSet:intoString:', 'c@:@o^@')
+setSignatureForSelector('NSScanner', 'scanUpToString:intoString:', 'c@:@o^@')
+setSignatureForSelector('NSStream', 'getStreamsToHost:port:inputStream:outputStream:', 'v@:@io^@o^@')
+setSignatureForSelector('NSString', 'completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:', 'I@:o^@co^@@')
+setSignatureForSelector('NSString', 'getLineStart:end:contentsEnd:forRange:', 'v@:o^Io^Io^I{_NSRange=II}')
+setSignatureForSelector('NSString', 'getParagraphStart:end:contentsEnd:forRange:', 'v@:o^Io^Io^I{_NSRange=II}')
+setSignatureForSelector('NSURLConnection', 'sendSynchronousRequest:returningResponse:error:', '@@:@o^@o^@')
+setSignatureForSelector('NSXMLDocument', 'validateAndReturnError:', 'c@:o^@')
+# end of file

Lib/Foundation/test/test_nsarray.py

         def cmpfunc(l, r):
             return -cmp(l,r)
 
-        a.sort(cmpfunc)
+        a.sort(cmpfunc=cmpfunc)
 
         self.assertEquals(a, (3, 2, 1, 0))
 
 
         self.assertEquals(a, (0, 1, 2, 3))
 
+        map={
+            0: "nul",
+            1: "een",
+            2: "twee",
+            3: "drie",
+        }
+
+
+        def keyfunc(l):
+            return  map[l]
+
+        a.sort(key=keyfunc)
+        self.assertEquals(a, (3, 1, 0, 2))
+
+        a.sort(key=keyfunc, reverse=True)
+        self.assertEquals(a, (2, 0, 1, 3))
+
+        a.sort(reverse=True)
+        self.assertEquals(a, (3, 2, 1, 0))
+
     def test_unsupportedMethods(self):
         #
         # Check that calling unsupported methods results in a TypeError

Lib/InterfaceBuilder/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+# end of file

Lib/Message/__init__.py

     ])
 _initialize()
 
+import _signatures
+
 # Define useful utility methods here
 

Lib/Message/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+setSignatureForSelector('DataScanner', 'scanBytesFromSet:intoData:', 'c@:@o^@')
+setSignatureForSelector('DataScanner', 'scanCString:intoData:', 'c@:r*o^@')
+setSignatureForSelector('DataScanner', 'scanData:intoData:', 'c@:@o^@')
+setSignatureForSelector('DataScanner', 'scanInt:', 'c@:o^i')
+setSignatureForSelector('DataScanner', 'scanUpToBytesFromSet:intoData:', 'c@:@o^@')
+setSignatureForSelector('DataScanner', 'scanUpToCString:intoData:', 'c@:r*o^@')
+setSignatureForSelector('DataScanner', 'scanUpToData:intoData:', 'c@:@o^@')
+setSignatureForSelector('Library', 'bodyDataAtPath:headerData:', '@@:@o^@')
+setSignatureForSelector('Library', 'bodyDataForMessage:andHeaderDataIfReadilyAvailable:', '@@:@o^@')
+setSignatureForSelector('Library', 'fullBodyDataForMessage:andHeaderDataIfReadilyAvailable:', '@@:@o^@')
+setSignatureForSelector('Library', 'gatherCountsForMailbox:totalCount:unreadCount:deletedCount:totalSize:', 'v@:@o^Lo^Lo^Lo^Q')
+setSignatureForSelector('Message', 'isParentResponseMessage:isRejected:requestedAddresses:requestIsForSenders:', 'c@:o^co^c@o^c')
+setSignatureForSelector('MessageStore', 'fullBodyDataForMessage:andHeaderDataIfReadilyAvailable:', '@@:@o^@')
+# end of file

Lib/OSAKit/__init__.py

         bundle_identifier=u'com.apple.OSAKit',
     )
 import protocols
+import _signatures

Lib/OSAKit/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+setSignatureForSelector('OSAScript', 'compileAndReturnError:', 'c@:o^@')
+setSignatureForSelector('OSAScript', 'executeAndReturnDisplayValue:error:', '@@:o^@o^@')
+setSignatureForSelector('OSAScript', 'executeAndReturnError:', '@@:o^@')
+setSignatureForSelector('OSAScript', 'sourceAndReturnError:', '@@:o^@')
+# end of file

Lib/QTKit/__init__.py

         bundle_identifier=u'com.apple.QTKit',
     )
 import protocols
+import _signatures

Lib/QTKit/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+setSignatureForSelector('QTMovie', 'initWithError:', '@@:o^@')
+# end of file

Lib/ScreenSaver/__init__.py

 
 # NOTE: One MacOSX 10.2.4 the framework doesn't define constants,
 # therefore there is no _ScreenSaver module.
+import _signatures
 
 # Define useful utility methods here

Lib/ScreenSaver/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+setSignatureForSelector("ScreenSaverUserInfo", "loginUserName:andID:", "v@:o^@o^I")
+# end of file

Lib/SecurityInterface/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+# end of file

Lib/SyncServices/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+# end of file

Lib/WebKit/_signatures.py

+# This file is generated using the Signatures tool, don't edit
+from objc import setSignatureForSelector
+# end of file

Lib/objc/_FoundationSignatures.py

 
 setSignatureForSelector("NSObject", "validateValue:forKey:error:", "c@:N^@@o^@")
 setSignatureForSelector("NSObject", "validateValue:forKeyPath:error:", "c@:N^@@o^@")
-#setSignatureForSelector("NSObject", "addObserver:forKeyPath:options:context:",
-#    "v@:@@Ii")
-#setSignatureForSelector("NSObject", "observeValueForKeyPath:ofObject:change:context:", "v@:@@@i")
-#setSignatureForSelector("NSArray", "addObserver:toObjectsAtIndexes:forKeyPath:options:context:", 'v@:@@@Ii')
 setSignatureForSelector("NSURLConnection", "sendSynchronousRequest:returningResponse:error:", "@@:@o^@o^@")
 setSignatureForSelector("NSString", "getParagraphStart:end:contentsEnd:forRange:", "v@:o^Io^Io^I{_NSRange=II}")
 setSignatureForSelector("NSMutableAttributedString", "readFromData:options:documentAttributes:", "c@:@@o^@")
 setSignatureForSelector("NSAttributedString", "initWithHTML:options:documentAttributes:", "@20@0:4@8@12o^@16")
 setSignatureForSelector("NSAttributedString", "initWithDocFormat:documentAttributes:", "@@:@o^@")
 setSignatureForSelector("NSKeyValueProperty", "keyPathIfAffectedByValueForKey:exactMatch:", "@@:@o^c")
-#setSignatureForSelector("NSKeyValueObservationForwarder", "initWithObserver:relationshipKey:keyPathFromRelatedObject:options:context:", "@@:@@@Ii")
 setSignatureForSelector("NSDeserializer", "deserializePropertyListFromData:atCursor:mutableContainers:", "@@:@O^Ic")
 setSignatureForSelector("NSDeserializer", "deserializePropertyListLazilyFromData:atCursor:length:mutableContainers:", "@@:@O^IIc")
-#setSignatureForSelector("OC_PythonObject", "addObserver:forKeyPath:options:context:", "v@:@@Ii")
 setSignatureForSelector("NSXMLDocument", "validateAndReturnError:", "c@:o^@")
 setSignatureForSelector("NSNetService", "getInputStream:outputStream:", "c@:o^@o^@")
 
-# Technically incorrect, but not used anyway
 setSignatureForSelector("NSObject", "setObservationInfo:", "v@:i")
 setSignatureForSelector("NSObject", "observationInfo", "i@:")

Lib/objc/_convenience.py

         traceback.print_exc()
         raise
 
+# This will have to do until we finish CF support: replace type signatures
+# for toll-free bridged types by '@'.
+_CFTypes={
+    '^{__CFString}':1,
+    '^{__CFString=}':1,
+    '^{__CFArray}':1,
+    '^{__CFArray=}':1,
+    '^{__CFDictionary}':1,
+    '^{__CFDictionary=}':1,
+    '^{__CFURL}':1,
+    '^{__CFURL=}':1,
+}
+
+def defaultSignatureUpdates(sel, signature):
+    if sel.endswith(':error:'):
+        # Error is always an output argument
+        sigParts = splitSignature(signature)
+        if sigParts[-1] == '^@':
+            sigParts = sigParts[:-1] + ('o^@',)
+            signature = ''.join(sigParts)
+
+    sigParts = list(splitSignature(signature))
+    updated = 0
+    for idx, val in enumerate(sigParts):
+        if val in _CFTypes:
+            sigParts[idx] = '@'
+            updated = 1
+
+    if updated:
+        signature = ''.join(sigParts)
+
+    return signature
 
 def _add_convenience_methods(super_class, name, type_dict):
     """
         # Handle some common exceptions to the usual rules:
         #
 
-        if sel.selector.endswith(':error:'):
-            # Error is always an output argument
-            sigParts = splitSignature(sel.signature)
-            if sigParts[-1] == '^@':
-                sigParts = sigParts[:-1] + ('o^@',)
-                sel.signature = ''.join(sigParts)
-
-        elif sel.selector.endswith(':userData:'):
-            # userData:(void*)arg -> userData:(int)arg
-            sigParts = splitSignature(sel.signature)
-            if sigParts[-1] == '^v':
-                sigParts = sigParts[:-1] + ('i',)
-                sel.signature = ''.join(sigParts)
-
-        elif sel.selector == 'userData':
-            # The getter for userData.
-            sigParts = splitSignature(sel.signature)
-            if sigParts[0] == '^v':
-                sigParts = ('i',) + sigParts[1:]
-                sel.signature = ''.join(sigParts)
-
-        elif sel.selector.endswith(':contextInfo:'):
-            # contextInfo:(void*)arg -> contextInfo:(int)arg
-            sigParts = splitSignature(sel.signature)
-            if sigParts[-1] == '^v':
-                sigParts = sigParts[:-1] + ('i',)
-                sel.signature = ''.join(sigParts)
-
-        elif sel.selector.endswith(':context:'):
-            # context:(void*)arg -> context:(int)arg
-            sigParts = splitSignature(sel.signature)
-            if sigParts[-1] == '^v':
-                sigParts = sigParts[:-1] + ('i',)
-                sel.signature = ''.join(sigParts)
-
-        elif sel.selector == 'context':
-            # The getter for context.
-            sigParts = splitSignature(sel.signature)
-            if sigParts[0] == '^v':
-                sigParts = ('i',) + sigParts[1:]
-                sel.signature = ''.join(sigParts)
-            
+        sig = defaultSignatureUpdates(sel.selector, sel.signature)
+        if sig != sel.signature:
+            sel.signature = sig
 
 
 
     ( 'initWithObjectsAndKeys_', initWithObjectsAndKeys_ ),
 )
 
-def sort(self, cmpfunc=cmp):
-    def doCmp(a, b, cmpfunc):
-        return cmpfunc(a, b)
+def sort(self, key=None, reverse=False, cmpfunc=cmp):
+    # NOTE: cmpfunc argument is for backward compatibility.
+    if key is None:
+        if reverse:
+            def doCmp(a, b, cmpfunc):
+                return -cmpfunc(a, b)
+        else:
+            def doCmp(a, b, cmpfunc):
+                return cmpfunc(a, b)
+    else:
+        # This is (a lot) slower than the algoritm used for
+        # list.sort, but so be it.
+        if reverse:
+            def doCmp(a, b, cmpfunc):
+                return -cmpfunc(key(a), key(b))
+        else:
+            def doCmp(a, b, cmpfunc):
+                return cmpfunc(key(a), key(b))
 
     self.sortUsingFunction_context_(doCmp, cmpfunc)
 
+
+
 CONVENIENCE_METHODS['sortUsingFunction:context:'] = (
     ('sort', sort),
 )