def initialize_iokit_functions_and_variables(): """ This handles the importing of specific functions and variables from the IOKit framework. IOKit is not natively bridged in PyObjC, and so the methods must be found and encoded manually to gain their functionality in Python. After calling this function, the following IOKit functions are available: IOServiceGetMatchingServices Look up the registered IOService objects that match the given dict. IODisplayCreateInfoDictionary Returns a dictionary with information about display hardware. IODisplayGetFloatParameter Finds a float value for a given parameter. IODisplaySetFloatParameter Sets a float value for a given parameter. IOServiceMatching Returns a dictionary that specifies an IOService class match. IOIteratorNext Finds the next object in an iteration. And the following variables are available: kIODisplayNoProductName Prevents IODisplayCreateInfoDictionary from including the kIODisplayProductName property. kIOMasterPortDefault The default mach port used to initiate communication with IOKit. kIODisplayBrightnessKey The key used to get brightness from IODisplayGetFloatParameter. kDisplayVendorID kDisplayProductID kDisplaySerialNumber These are keys used to access display information. """ # Grab the IOKit framework. iokit = objc.initFrameworkWrapper( "IOKit", frameworkIdentifier="com.apple.iokit", frameworkPath=objc.pathForFramework("/System/Library/Frameworks/IOKit.framework"), globals=globals() ) # These are the functions we're going to need. functions = [ ("IOServiceGetMatchingServices", b"iI@o^I"), ("IODisplayCreateInfoDictionary", b"@II"), ("IODisplayGetFloatParameter", b"iII@o^f"), ("IODisplaySetFloatParameter", b"iII@f"), ("IOServiceMatching", b"@or*", "", dict( # This one is obnoxious. The "*" gets pythonified as a char, not a # char*, so we have to make it interpret as a string. arguments= { 0: dict(type=objc._C_PTR + objc._C_CHAR_AS_TEXT, c_array_delimited_by_null=True, type_modifier=objc._C_IN) } )), ("IOIteratorNext", "II"), ] # Variables we'll need. variables = [ ("kIODisplayNoProductName", b"I"), ("kIOMasterPortDefault", b"I"), ("kIODisplayBrightnessKey", b"*"), ("kDisplayVendorID", b"*"), ("kDisplayProductID", b"*"), ("kDisplaySerialNumber", b"*"), ] # Load the things! objc.loadBundleFunctions(iokit, globals(), functions) objc.loadBundleVariables(iokit, globals(), variables) # Set this key for later use. global kDisplayBrightness kDisplayBrightness = CoreFoundation.CFSTR(kIODisplayBrightnessKey)
def testVariableLookup(self): NSBundle = objc.lookUpClass('NSBundle') bundle = NSBundle.bundleForClass_(NSBundle) tab = [ ('NSAppleScriptErrorMessage', b'@'), ] d = {} objc.loadBundleVariables(bundle, d, tab) self.assertIn('NSAppleScriptErrorMessage', d) tab = [ ('NSAppleScriptErrorMessage', '@'), ] self.assertRaises(TypeError, objc.loadBundleVariables, bundle, d, tab) tab = [ (b'NSAppleScriptErrorMessage', b'@'), ] self.assertRaises(TypeError, objc.loadBundleVariables, bundle, d, tab)
def getIOKit(): """ This handles the importing of specific functions and variables from the IOKit framework. IOKit is not natively bridged in PyObjC, so the methods must be found and encoded manually to gain their functionality in Python. :return: A dictionary containing several IOKit functions and variables. """ global iokit if not iokit: # iokit may have already been instantiated, in which case, nothing needs to be done # The dictionary which will contain all of the necessary functions and variables from IOKit iokit = {} # Retrieve the IOKit framework iokitBundle = objc.initFrameworkWrapper( "IOKit", frameworkIdentifier="com.apple.iokit", frameworkPath=objc.pathForFramework( "/System/Library/Frameworks/IOKit.framework"), globals=globals()) # The IOKit functions to be retrieved functions = [ ("IOServiceGetMatchingServices", b"iI@o^I"), ("IODisplayCreateInfoDictionary", b"@II"), ("IODisplayGetFloatParameter", b"iII@o^f"), ("IODisplaySetFloatParameter", b"iII@f"), ("IOServiceRequestProbe", b"iII"), ("IOIteratorNext", b"II"), ] # The IOKit variables to be retrieved variables = [ ("kIODisplayNoProductName", b"I"), ("kIOMasterPortDefault", b"I"), ("kIODisplayOverscanKey", b"*"), ("kDisplayVendorID", b"*"), ("kDisplayProductID", b"*"), ("kDisplaySerialNumber", b"*"), ] # Load functions from IOKit.framework into our iokit objc.loadBundleFunctions(iokitBundle, iokit, functions) # Bridge won't put straight into iokit, so globals() objc.loadBundleVariables(iokitBundle, globals(), variables) # Move only the desired variables into iokit for var in variables: key = "{}".format(var[0]) if key in globals(): iokit[key] = globals()[key] # A few IOKit variables that have been deprecated, but whose values # still work as intended in IOKit functions iokit["kDisplayBrightness"] = CoreFoundation.CFSTR("brightness") iokit["kDisplayUnderscan"] = CoreFoundation.CFSTR("pscn") return iokit
def testSimple(self): d = {} objc.loadBundleVariables(self.bundle, d, [ ('NSDebugEnabled', objc._C_NSBOOL), ('NSFoundationVersionNumber', objc._C_DBL), ]) self.assertIn('NSDebugEnabled', d) self.assertIn('NSFoundationVersionNumber', d) self.assertIsInstance(d['NSFoundationVersionNumber'], float) self.assertIsInstance(d['NSDebugEnabled'], int)
def testStrings(self): d = {} objc.loadBundleVariables(self.bundle, d, [ (u'NSAppleScriptErrorMessage', '@'), (u'NSBundleDidLoadNotification', '@'), ]) self.assert_(u'NSBundleDidLoadNotification' in d) self.assert_(u'NSAppleScriptErrorMessage' in d) self.assert_(isinstance(d[u'NSAppleScriptErrorMessage'], objc.pyobjc_unicode)) self.assert_(isinstance(d[u'NSBundleDidLoadNotification'], objc.pyobjc_unicode))
def testStrings(self): d = {} objc.loadBundleVariables(self.bundle, d, [ ('NSAppleScriptErrorMessage', b'@'), ('NSBundleDidLoadNotification', b'@'), ]) self.assertIn('NSBundleDidLoadNotification', d) self.assertIn('NSAppleScriptErrorMessage', d) self.assertIsInstance(d['NSAppleScriptErrorMessage'], objc.pyobjc_unicode) self.assertIsInstance(d['NSBundleDidLoadNotification'], objc.pyobjc_unicode)
def testSimple(self): d = {} objc.loadBundleVariables(self.bundle, d, [ (u'NSDebugEnabled', objc._C_NSBOOL), (u'NSFoundationVersionNumber', objc._C_DBL), ]) self.assert_(u'NSDebugEnabled' in d) self.assert_(u'NSFoundationVersionNumber' in d) self.assert_(isinstance(d[u'NSFoundationVersionNumber'], float)) self.assert_(isinstance(d[u'NSDebugEnabled'], int))
def run_event_loop(): logger.info('try to load mac hotkey event loop') # Set up a tap, with type of tap, location, options and event mask def create_tap(): return Quartz.CGEventTapCreate( Quartz.kCGSessionEventTap, # Session level is enough for our needs Quartz.kCGHeadInsertEventTap, # Insert wherever, we do not filter Quartz.kCGEventTapOptionDefault, # NSSystemDefined for media keys Quartz.CGEventMaskBit(NSSystemDefined), keyboard_tap_callback, None) tap = create_tap() if tap is None: logger.error('Error occurred when trying to listen global hotkey. ' 'trying to popup a prompt dialog to ask for permission.') # we do not use pyobjc-framework-ApplicationServices directly, since it # causes segfault when call AXIsProcessTrustedWithOptions function import objc AS = objc.loadBundle( 'CoreServices', globals(), '/System/Library/Frameworks/ApplicationServices.framework') objc.loadBundleFunctions(AS, globals(), [('AXIsProcessTrustedWithOptions', b'Z@')]) objc.loadBundleVariables(AS, globals(), [('kAXTrustedCheckOptionPrompt', b'@')]) trusted = AXIsProcessTrustedWithOptions( {kAXTrustedCheckOptionPrompt: True}) # noqa if not trusted: logger.info( 'Have popuped a prompt dialog to ask for accessibility.' 'You can restart feeluown after you grant access to it.') else: logger.warning('Have already grant accessibility, ' 'but we still can not listen global hotkey,' 'theoretically, this should not happen.') return run_loop_source = Quartz.CFMachPortCreateRunLoopSource(None, tap, 0) Quartz.CFRunLoopAddSource(Quartz.CFRunLoopGetCurrent(), run_loop_source, Quartz.kCFRunLoopDefaultMode) # Enable the tap Quartz.CGEventTapEnable(tap, True) # and run! This won't return until we exit or are terminated. Quartz.CFRunLoopRun() logger.error('mac hotkey event loop exit') return []
def testStrings(self): d = {} objc.loadBundleVariables(self.bundle, d, [ (u'NSAppleScriptErrorMessage', '@'), (u'NSBundleDidLoadNotification', '@'), ]) self.assert_(u'NSBundleDidLoadNotification' in d) self.assert_(u'NSAppleScriptErrorMessage' in d) self.assert_( isinstance(d[u'NSAppleScriptErrorMessage'], objc.pyobjc_unicode)) self.assert_( isinstance(d[u'NSBundleDidLoadNotification'], objc.pyobjc_unicode))
def testSimple(self): d = {} objc.loadBundleVariables( self.bundle, d, [ ("NSDebugEnabled", objc._C_NSBOOL), ("NSFoundationVersionNumber", objc._C_DBL), ], ) self.assertIn("NSDebugEnabled", d) self.assertIn("NSFoundationVersionNumber", d) self.assertIsInstance(d["NSFoundationVersionNumber"], float) self.assertIsInstance(d["NSDebugEnabled"], int)
def testStrings(self): d = {} objc.loadBundleVariables( self.bundle, d, [ ("NSAppleScriptErrorMessage", b"@"), ("NSBundleDidLoadNotification", b"@"), ], ) self.assertIn("NSBundleDidLoadNotification", d) self.assertIn("NSAppleScriptErrorMessage", d) self.assertIsInstance(d["NSAppleScriptErrorMessage"], objc.pyobjc_unicode) self.assertIsInstance(d["NSBundleDidLoadNotification"], objc.pyobjc_unicode)
def testVariableLookup(self): NSBundle = objc.lookUpClass("NSBundle") bundle = NSBundle.bundleForClass_(NSBundle) tab = [("NSAppleScriptErrorMessage", b"@")] d = {} objc.loadBundleVariables(bundle, d, tab) self.assertIn("NSAppleScriptErrorMessage", d) tab = [("NSAppleScriptErrorMessage", "@")] self.assertRaises(TypeError, objc.loadBundleVariables, bundle, d, tab) tab = [(b"NSAppleScriptErrorMessage", b"@")] self.assertRaises(TypeError, objc.loadBundleVariables, bundle, d, tab)
if platform == "darwin": import objc try: from ApplicationServices import AXIsProcessTrusted, AXIsProcessTrustedWithOptions, kAXTrustedCheckOptionPrompt except: HIServices = objc.loadBundle( "HIServices", globals(), "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework", ) objc.loadBundleFunctions( HIServices, globals(), [("AXIsProcessTrusted", "B"), ("AXIsProcessTrustedWithOptions", "B@")] ) objc.loadBundleVariables(HIServices, globals(), [("kAXTrustedCheckOptionPrompt", "@^{__CFString=}")]) was_accessible_at_launch = AXIsProcessTrusted() elif platform == "win32": # sigh tkFileDialog.askdirectory doesn't support unicode on Windows import ctypes from ctypes.wintypes import * # https://msdn.microsoft.com/en-us/library/windows/desktop/bb762115 BIF_RETURNONLYFSDIRS = 0x00000001 BIF_USENEWUI = 0x00000050 BFFM_INITIALIZED = 1 BFFM_SETSELECTION = 0x00000467 BrowseCallbackProc = ctypes.WINFUNCTYPE(ctypes.c_int, HWND, ctypes.c_uint, LPARAM, LPARAM) class BROWSEINFO(ctypes.Structure):
""" Dummy Foundation wrappers, just those parts needed for the unittests. """ import objc as _objc __bundle__ = _objc.loadBundle( 'Foundation', globals(), bundle_identifier=u'com.apple.Foundation', ) _objc.loadBundleVariables(__bundle__, globals(), [ ('NSPriorDayDesignations', _objc._C_ID), ]) NSPropertyListXMLFormat_v1_0 = 100 NSKeyValueObservingOptionNew = 0x01 NSKeyValueObservingOptionOld = 0x02
sys.exit(1) desired_ime_name = sys.argv[1] # # Load carbon framework # carbon = {} bundle = Foundation.NSBundle.bundleWithIdentifier_('com.apple.HIToolbox') objc.loadBundleFunctions(bundle, carbon, [ ('TISCreateInputSourceList','@@B'), ('TISGetInputSourceProperty', '@@@'), ('TISSelectInputSource', 'I@'), ]) objc.loadBundleVariables(bundle, carbon, [ ('kTISPropertyLocalizedName', '@'), ]) # # Lookup all available IMEs and find desired IME # for ime in carbon['TISCreateInputSourceList'](None, False): ime_name = carbon['TISGetInputSourceProperty'](ime, carbon['kTISPropertyLocalizedName']) if desired_ime_name == ime_name: chosen_ime = ime break else: print 'Input source "{}" is not available'.format(desired_ime_name) sys.exit(1) #
from Foundation import NSBundle, NSClassFromString, NSObject, NSRunLoop, NSDate, NSUUID, NSMakeRange, NSURL from AVFoundation import AVAudioPlayer import Quartz global lock_player global warn_player CoreBluetooth = NSBundle.bundleWithIdentifier_('com.apple.CoreBluetooth') _ = CoreBluetooth.load() CBCentralManager = NSClassFromString('CBCentralManager') constants = [ ('CBCentralManagerScanOptionAllowDuplicatesKey', '@'), ('CBAdvertisementDataManufacturerDataKey', '@'), ] objc.loadBundleVariables(CoreBluetooth, globals(), constants) Login = NSBundle.bundleWithPath_( '/System/Library/PrivateFrameworks/login.framework') functions = [ ('SACLockScreenImmediate', '@'), ] objc.loadBundleFunctions(Login, globals(), functions) # Prep the sound file lock_sound_file = NSURL.fileURLWithPath_(path_to_lock_sound) lock_player = AVAudioPlayer.alloc().initWithContentsOfURL_error_( lock_sound_file, None) lock_player.setNumberOfLoops_(0)
def __getrealapp(self): d = {} objc.loadBundleVariables(__bundle__, d, [("NSApp", b"@")]) return d.get("NSApp")
def __getrealapp(self): d = {} objc.loadBundleVariables(__bundle__, d, [('NSApp', '@')]) return d.get('NSApp')
#!/usr/bin/python #ref: https://gist.github.com/pudquick/eebc4d569100c8e3039bf3eae56bee4c from Foundation import NSBundle import objc CoreServices = NSBundle.bundleWithIdentifier_('com.apple.CoreServices') functions = [ ('_LSCopyRunningApplicationArray', '@I'), ('_LSCopyApplicationInformation', '@I@@'), ] constants = [('_kLSApplicationTypeKey', '@'), ('_kLSApplicationForegroundTypeKey', '@'), ('_kLSDisplayNameKey', '@')] objc.loadBundleFunctions(CoreServices, globals(), functions) objc.loadBundleVariables(CoreServices, globals(), constants) apps = _LSCopyRunningApplicationArray(0xfffffffe) app_infos = [_LSCopyApplicationInformation(0xffffffff, x, None) for x in apps] visible_app_infos = [ x for x in app_infos if x.get(_kLSApplicationTypeKey, None) == _kLSApplicationForegroundTypeKey ] visible_apps = sorted([x.get(_kLSDisplayNameKey) for x in visible_app_infos]) #print visible_app_infos print visible_apps
def __getrealapp(self): d = {} objc.loadBundleVariables(__bundle__, d, [ ('NSApp', b'@' ) ]) return d.get('NSApp')
""" Dummy Foundation wrappers, just those parts needed for the unittests. """ import objc as _objc __bundle__ = _objc.loadBundle( 'Foundation', globals(), bundle_identifier='com.apple.Foundation', ) _objc.loadBundleVariables(__bundle__, globals(), [ ( 'NSPriorDayDesignations', _objc._C_ID ), ]) NSPropertyListXMLFormat_v1_0 = 100 NSKeyValueObservingOptionNew = 0x01 NSKeyValueObservingOptionOld = 0x02
if platform == 'darwin': import objc from Foundation import NSFileManager try: from ApplicationServices import AXIsProcessTrusted, AXIsProcessTrustedWithOptions, kAXTrustedCheckOptionPrompt except: HIServices = objc.loadBundle( 'HIServices', globals(), '/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework' ) objc.loadBundleFunctions(HIServices, globals(), [('AXIsProcessTrusted', 'B'), ('AXIsProcessTrustedWithOptions', 'B@')]) objc.loadBundleVariables( HIServices, globals(), [('kAXTrustedCheckOptionPrompt', '@^{__CFString=}')]) was_accessible_at_launch = AXIsProcessTrusted() elif platform == 'win32': # sigh tkFileDialog.askdirectory doesn't support unicode on Windows import ctypes from ctypes.wintypes import * SHGetLocalizedName = ctypes.windll.shell32.SHGetLocalizedName SHGetLocalizedName.argtypes = [ LPCWSTR, LPWSTR, UINT, ctypes.POINTER(ctypes.c_int) ] LoadString = ctypes.windll.user32.LoadStringW
#!/usr/bin/python #ref: https://gist.github.com/pudquick/eebc4d569100c8e3039bf3eae56bee4c from Foundation import NSBundle import objc CoreServices = NSBundle.bundleWithIdentifier_('com.apple.CoreServices') functions = [ ('_LSCopyRunningApplicationArray', '@I'), ('_LSCopyApplicationInformation', '@I@@'), ] constants = [ ('_kLSApplicationTypeKey', '@'), ('_kLSApplicationForegroundTypeKey', '@'), ('_kLSDisplayNameKey', '@') ] objc.loadBundleFunctions(CoreServices, globals(), functions) objc.loadBundleVariables(CoreServices, globals(), constants) apps = _LSCopyRunningApplicationArray(0xfffffffe) app_infos = [_LSCopyApplicationInformation(0xffffffff, x, None) for x in apps] visible_app_infos = [x for x in app_infos if x.get(_kLSApplicationTypeKey, None) == _kLSApplicationForegroundTypeKey] visible_apps = sorted([x.get(_kLSDisplayNameKey) for x in visible_app_infos]) #print visible_app_infos print visible_apps
from l10n import Translations from monitor import monitor from theme import theme import plug if platform == 'darwin': import objc from Foundation import NSFileManager try: from ApplicationServices import AXIsProcessTrusted, AXIsProcessTrustedWithOptions, kAXTrustedCheckOptionPrompt except: HIServices = objc.loadBundle('HIServices', globals(), '/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework') objc.loadBundleFunctions(HIServices, globals(), [('AXIsProcessTrusted', 'B'), ('AXIsProcessTrustedWithOptions', 'B@')]) objc.loadBundleVariables(HIServices, globals(), [('kAXTrustedCheckOptionPrompt', '@^{__CFString=}')]) was_accessible_at_launch = AXIsProcessTrusted() elif platform=='win32': # sigh tkFileDialog.askdirectory doesn't support unicode on Windows import ctypes from ctypes.wintypes import * SHGetLocalizedName = ctypes.windll.shell32.SHGetLocalizedName SHGetLocalizedName.argtypes = [LPCWSTR, LPWSTR, UINT, ctypes.POINTER(ctypes.c_int)] LoadString = ctypes.windll.user32.LoadStringW LoadString.argtypes = [HINSTANCE, UINT, LPWSTR, ctypes.c_int] # https://msdn.microsoft.com/en-us/library/windows/desktop/bb762115 BIF_RETURNONLYFSDIRS = 0x00000001
def __calc_all(self): # Ensure that all dynamic entries get loaded if self.__varmap_dct: dct = {} objc.loadBundleVariables(self.__bundle, dct, [ (nm, self.__varmap_dct[nm].encode('ascii')) for nm in self.__varmap_dct if not self.__varmap_dct[nm].startswith('=')]) for nm in dct: if nm not in self.__dict__: self.__dict__[nm] = dct[nm] for nm, tp in self.__varmap_dct.items(): if tp.startswith('='): try: self.__dict__[nm] = objc._loadConstant(nm, tp[1:], True) except AttributeError: pass self.__varmap_dct = {} if self.__varmap: varmap = [] specials = [] for nm, tp in re.findall(r"\$([A-Z0-9a-z_]*)(@[^$]*)?(?=\$)", self.__varmap): if tp and tp.startswith('@='): specials.append((nm, tp[2:])) else: varmap.append((nm, b'@' if not tp else tp[1:].encode('ascii'))) dct = {} objc.loadBundleVariables(self.__bundle, dct, varmap) for nm in dct: if nm not in self.__dict__: self.__dict__[nm] = dct[nm] for nm, tp in specials: try: self.__dict__[nm] = objc._loadConstant(nm, tp, True) except AttributeError: pass self.__varmap = "" if self.__enummap: for nm, val in re.findall(r"\$([A-Z0-9a-z_]*)@([^$]*)(?=\$)", self.__enummap): if nm not in self.__dict__: self.__dict__[nm] = self.__prs_enum(val) self.__enummap = "" if self.__funcmap: func_list = [] for nm in self.__funcmap: if nm not in self.__dict__: func_list.append((nm,) + self.__funcmap[nm]) dct = {} objc.loadBundleFunctions(self.__bundle, dct, func_list) for nm in dct: if nm not in self.__dict__: self.__dict__[nm] = dct[nm] if self.__inlinelist is not None: dct = {} objc.loadFunctionList( self.__inlinelist, dct, func_list, skip_undefined=True) for nm in dct: if nm not in self.__dict__: self.__dict__[nm] = dct[nm] self.__funcmap = {} if self.__expressions: for nm in list(self.__expressions): try: getattr(self, nm) except AttributeError: pass if self.__aliases: for nm in list(self.__aliases): try: getattr(self, nm) except AttributeError: pass all_names = set() # Add all names that are already in our __dict__ all_names.update(self.__dict__) # Merge __all__of parents ('from parent import *') for p in self.__parents: try: all_names.update(p.__all__) except AttributeError: all_names.update(dir(p)) # Add all class names all_names.update(cls.__name__ for cls in getClassList()) return [ v for v in all_names if not v.startswith('_') ]
def __calc_all(self): # Ensure that all dynamic entries get loaded if self.__varmap_dct: dct = {} objc.loadBundleVariables( self.__bundle, dct, [(nm, self.__varmap_dct[nm].encode('ascii')) for nm in self.__varmap_dct if not self.__varmap_dct[nm].startswith('=')]) for nm in dct: if nm not in self.__dict__: self.__dict__[nm] = dct[nm] for nm, tp in self.__varmap_dct.items(): if tp.startswith('='): try: self.__dict__[nm] = objc._loadConstant( nm, tp[1:], True) except AttributeError: pass self.__varmap_dct = {} if self.__varmap: varmap = [] specials = [] for nm, tp in re.findall(r"\$([A-Z0-9a-z_]*)(@[^$]*)?(?=\$)", self.__varmap): if tp and tp.startswith('@='): specials.append((nm, tp[2:])) else: varmap.append( (nm, b'@' if not tp else tp[1:].encode('ascii'))) dct = {} objc.loadBundleVariables(self.__bundle, dct, varmap) for nm in dct: if nm not in self.__dict__: self.__dict__[nm] = dct[nm] for nm, tp in specials: try: self.__dict__[nm] = objc._loadConstant(nm, tp, True) except AttributeError: pass self.__varmap = "" if self.__enummap: for nm, val in re.findall(r"\$([A-Z0-9a-z_]*)@([^$]*)(?=\$)", self.__enummap): if nm not in self.__dict__: self.__dict__[nm] = self.__prs_enum(val) self.__enummap = "" if self.__funcmap: func_list = [] for nm in self.__funcmap: if nm not in self.__dict__: func_list.append((nm, ) + self.__funcmap[nm]) dct = {} objc.loadBundleFunctions(self.__bundle, dct, func_list) for nm in dct: if nm not in self.__dict__: self.__dict__[nm] = dct[nm] if self.__inlinelist is not None: dct = {} objc.loadFunctionList(self.__inlinelist, dct, func_list, skip_undefined=True) for nm in dct: if nm not in self.__dict__: self.__dict__[nm] = dct[nm] self.__funcmap = {} if self.__expressions: for nm in list(self.__expressions): try: getattr(self, nm) except AttributeError: pass if self.__aliases: for nm in list(self.__aliases): try: getattr(self, nm) except AttributeError: pass all_names = set() # Add all names that are already in our __dict__ all_names.update(self.__dict__) # Merge __all__of parents ('from parent import *') for p in self.__parents: try: all_names.update(p.__all__) except AttributeError: all_names.update(dir(p)) # Add all class names all_names.update(cls.__name__ for cls in getClassList()) return [v for v in all_names if not v.startswith('_')]
raise NotImplementedError # CFMutableDictionaryRef IORegistryEntryIDMatching(uint64_t entryID); def IORegistryEntryIDMatching(entryID: int) -> dict: # pylint: disable=invalid-name raise NotImplementedError # io_registry_entry_t IORegistryEntryFromPath(mach_port_t mainPort, const io_string_t path) def IORegistryEntryFromPath( mainPort: mach_port_t, path: io_string_t) -> io_registry_entry_t: # pylint: disable=invalid-name raise NotImplementedError objc.loadBundleFunctions(IOKit_bundle, globals(), functions) # type: ignore # pylint: disable=no-member objc.loadBundleVariables(IOKit_bundle, globals(), variables) # type: ignore # pylint: disable=no-member def ioiterator_to_list(iterator: io_iterator_t): # items = [] item = IOIteratorNext(iterator) # noqa: F821 while item: # items.append(next) yield item item = IOIteratorNext(iterator) # noqa: F821 IOObjectRelease(iterator) # noqa: F821 # return items def corefoundation_to_native(collection): if collection is None: # nullptr