def testGetting(self): array = CoreFoundation.CFArrayCreate( None, ["a", 2, 3, 4, 4, 2], 6, CoreFoundation.kCFTypeArrayCallBacks ) self.assertEqual(array, ["a", 2, 3, 4, 4, 2]) self.assertIsInstance(array, NSArray) self.assertEqual(CoreFoundation.CFArrayGetValueAtIndex(array, 0), "a") self.assertEqual(CoreFoundation.CFArrayGetValueAtIndex(array, 1), 2) self.assertArgHasType(CoreFoundation.CFArrayGetValues, 2, b"o^@") self.assertArgSizeInArg(CoreFoundation.CFArrayGetValues, 2, 1) vals = CoreFoundation.CFArrayGetValues(array, (0, 3), None) self.assertIsInstance(vals, tuple) self.assertEqual(vals, ("a", 2, 3))
def get_avaliable_languages(): single_langs = filter(lambda x: x.count() == 1, \ map(lambda x: objc_object(carbon.TISGetInputSourceProperty(CoreFoundation.CFArrayGetValueAtIndex(objc_object(s), x).__c_void_p__(), kTISPropertyInputSourceLanguages_p)), \ range(CoreFoundation.CFArrayGetCount(objc_object(carbon.TISCreateInputSourceList(None, 0)))))) res = set() map(lambda y: res.add(y[0]), single_langs) return res