diff options
author | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-12 14:07:20 +0200 |
---|---|---|
committer | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-12 14:07:20 +0200 |
commit | b7ccaa7015df61c101b3aa40e44feb2b5da287a0 (patch) | |
tree | 82fe8a280cc285d8196b5973e2358374ebf66f3e /BluetoothPairedDevices.py | |
parent | 7c7a156588b99dcd1d632a4d8ff6e53f46aef2e8 (diff) | |
download | pyParrotZikTCP-b7ccaa7015df61c101b3aa40e44feb2b5da287a0.tar.xz pyParrotZikTCP-b7ccaa7015df61c101b3aa40e44feb2b5da287a0.zip |
Fix pep8.
Diffstat (limited to 'BluetoothPairedDevices.py')
-rw-r--r-- | BluetoothPairedDevices.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/BluetoothPairedDevices.py b/BluetoothPairedDevices.py index 52b9a7d..4cf0c2b 100644 --- a/BluetoothPairedDevices.py +++ b/BluetoothPairedDevices.py @@ -13,29 +13,31 @@ def ParrotZikMac(): if sys.platform == "linux2": out = os.popen("bluez-test-device list").read() res = p.findall(out) - if len(res)>0: + if len(res) > 0: return res[0] elif sys.platform == "darwin": fd = open("/Library/Preferences/com.apple.Bluetooth.plist", "rb") plist = binplist.BinaryPlist(file_obj=fd) parsed_plist = plist.Parse() - try : + try: for mac in parsed_plist['PairedDevices']: - if p.match(mac.replace("-",":")): - return mac.replace("-",":") + if p.match(mac.replace("-", ":")): + return mac.replace("-", ":") except: pass elif sys.platform == "win32": - aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE) - aKey = _winreg.OpenKey(aReg, 'SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Devices') + aReg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) + aKey = _winreg.OpenKey( + aReg, 'SYSTEM\CurrentControlSet\Services\ + BTHPORT\Parameters\Devices') for i in range(10): try: - asubkey_name=_winreg.EnumKey(aKey,i) - mac =':'.join(asubkey_name[i:i+2] for i in range(0,12,2)) + asubkey_name = _winreg.EnumKey(aKey, i) + mac = ':'.join(asubkey_name[i:i+2] for i in range(0, 12, 2)) res = p.findall(mac) - if len(res)>0: + if len(res) > 0: return res[0] except EnvironmentError: |