pymobiledevice3 5.0.0__py3-none-any.whl → 5.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pymobiledevice3 might be problematic. Click here for more details.

Files changed (143) hide show
  1. misc/plist_sniffer.py +15 -15
  2. misc/remotexpc_sniffer.py +29 -28
  3. pymobiledevice3/__main__.py +128 -102
  4. pymobiledevice3/_version.py +2 -2
  5. pymobiledevice3/bonjour.py +26 -49
  6. pymobiledevice3/ca.py +32 -24
  7. pymobiledevice3/cli/activation.py +7 -7
  8. pymobiledevice3/cli/afc.py +19 -19
  9. pymobiledevice3/cli/amfi.py +4 -4
  10. pymobiledevice3/cli/apps.py +51 -39
  11. pymobiledevice3/cli/backup.py +58 -32
  12. pymobiledevice3/cli/bonjour.py +25 -18
  13. pymobiledevice3/cli/cli_common.py +112 -81
  14. pymobiledevice3/cli/companion_proxy.py +4 -4
  15. pymobiledevice3/cli/completions.py +10 -10
  16. pymobiledevice3/cli/crash.py +37 -31
  17. pymobiledevice3/cli/developer.py +602 -520
  18. pymobiledevice3/cli/diagnostics.py +38 -33
  19. pymobiledevice3/cli/lockdown.py +79 -74
  20. pymobiledevice3/cli/mounter.py +85 -68
  21. pymobiledevice3/cli/notification.py +10 -10
  22. pymobiledevice3/cli/pcap.py +19 -14
  23. pymobiledevice3/cli/power_assertion.py +12 -10
  24. pymobiledevice3/cli/processes.py +10 -10
  25. pymobiledevice3/cli/profile.py +88 -77
  26. pymobiledevice3/cli/provision.py +17 -17
  27. pymobiledevice3/cli/remote.py +186 -110
  28. pymobiledevice3/cli/restore.py +43 -40
  29. pymobiledevice3/cli/springboard.py +30 -28
  30. pymobiledevice3/cli/syslog.py +85 -58
  31. pymobiledevice3/cli/usbmux.py +21 -20
  32. pymobiledevice3/cli/version.py +3 -2
  33. pymobiledevice3/cli/webinspector.py +157 -79
  34. pymobiledevice3/common.py +1 -1
  35. pymobiledevice3/exceptions.py +154 -60
  36. pymobiledevice3/irecv.py +49 -53
  37. pymobiledevice3/irecv_devices.py +1489 -492
  38. pymobiledevice3/lockdown.py +394 -241
  39. pymobiledevice3/lockdown_service_provider.py +5 -7
  40. pymobiledevice3/osu/os_utils.py +18 -9
  41. pymobiledevice3/osu/posix_util.py +28 -15
  42. pymobiledevice3/osu/win_util.py +14 -8
  43. pymobiledevice3/pair_records.py +19 -19
  44. pymobiledevice3/remote/common.py +4 -4
  45. pymobiledevice3/remote/core_device/app_service.py +94 -67
  46. pymobiledevice3/remote/core_device/core_device_service.py +17 -14
  47. pymobiledevice3/remote/core_device/device_info.py +5 -5
  48. pymobiledevice3/remote/core_device/diagnostics_service.py +10 -8
  49. pymobiledevice3/remote/core_device/file_service.py +47 -33
  50. pymobiledevice3/remote/remote_service_discovery.py +53 -35
  51. pymobiledevice3/remote/remotexpc.py +62 -41
  52. pymobiledevice3/remote/tunnel_service.py +371 -293
  53. pymobiledevice3/remote/utils.py +12 -11
  54. pymobiledevice3/remote/xpc_message.py +145 -125
  55. pymobiledevice3/resources/dsc_uuid_map.py +19 -19
  56. pymobiledevice3/resources/firmware_notifications.py +16 -16
  57. pymobiledevice3/restore/asr.py +27 -27
  58. pymobiledevice3/restore/base_restore.py +90 -47
  59. pymobiledevice3/restore/consts.py +87 -66
  60. pymobiledevice3/restore/device.py +11 -11
  61. pymobiledevice3/restore/fdr.py +46 -46
  62. pymobiledevice3/restore/ftab.py +19 -19
  63. pymobiledevice3/restore/img4.py +130 -133
  64. pymobiledevice3/restore/mbn.py +35 -54
  65. pymobiledevice3/restore/recovery.py +125 -135
  66. pymobiledevice3/restore/restore.py +524 -523
  67. pymobiledevice3/restore/restore_options.py +122 -115
  68. pymobiledevice3/restore/restored_client.py +25 -22
  69. pymobiledevice3/restore/tss.py +378 -270
  70. pymobiledevice3/service_connection.py +50 -46
  71. pymobiledevice3/services/accessibilityaudit.py +136 -126
  72. pymobiledevice3/services/afc.py +350 -291
  73. pymobiledevice3/services/amfi.py +21 -18
  74. pymobiledevice3/services/companion.py +23 -19
  75. pymobiledevice3/services/crash_reports.py +60 -46
  76. pymobiledevice3/services/debugserver_applist.py +3 -3
  77. pymobiledevice3/services/device_arbitration.py +8 -8
  78. pymobiledevice3/services/device_link.py +55 -47
  79. pymobiledevice3/services/diagnostics.py +971 -968
  80. pymobiledevice3/services/dtfetchsymbols.py +8 -8
  81. pymobiledevice3/services/dvt/dvt_secure_socket_proxy.py +4 -4
  82. pymobiledevice3/services/dvt/dvt_testmanaged_proxy.py +4 -4
  83. pymobiledevice3/services/dvt/instruments/activity_trace_tap.py +85 -74
  84. pymobiledevice3/services/dvt/instruments/application_listing.py +2 -3
  85. pymobiledevice3/services/dvt/instruments/condition_inducer.py +7 -6
  86. pymobiledevice3/services/dvt/instruments/core_profile_session_tap.py +466 -384
  87. pymobiledevice3/services/dvt/instruments/device_info.py +11 -11
  88. pymobiledevice3/services/dvt/instruments/energy_monitor.py +1 -1
  89. pymobiledevice3/services/dvt/instruments/graphics.py +1 -1
  90. pymobiledevice3/services/dvt/instruments/location_simulation.py +1 -1
  91. pymobiledevice3/services/dvt/instruments/location_simulation_base.py +10 -10
  92. pymobiledevice3/services/dvt/instruments/network_monitor.py +17 -17
  93. pymobiledevice3/services/dvt/instruments/notifications.py +1 -1
  94. pymobiledevice3/services/dvt/instruments/process_control.py +25 -10
  95. pymobiledevice3/services/dvt/instruments/screenshot.py +2 -2
  96. pymobiledevice3/services/dvt/instruments/sysmontap.py +15 -15
  97. pymobiledevice3/services/dvt/testmanaged/xcuitest.py +40 -50
  98. pymobiledevice3/services/file_relay.py +10 -10
  99. pymobiledevice3/services/heartbeat.py +8 -7
  100. pymobiledevice3/services/house_arrest.py +12 -15
  101. pymobiledevice3/services/installation_proxy.py +119 -100
  102. pymobiledevice3/services/lockdown_service.py +12 -5
  103. pymobiledevice3/services/misagent.py +22 -19
  104. pymobiledevice3/services/mobile_activation.py +84 -72
  105. pymobiledevice3/services/mobile_config.py +330 -301
  106. pymobiledevice3/services/mobile_image_mounter.py +137 -116
  107. pymobiledevice3/services/mobilebackup2.py +188 -150
  108. pymobiledevice3/services/notification_proxy.py +11 -11
  109. pymobiledevice3/services/os_trace.py +69 -51
  110. pymobiledevice3/services/pcapd.py +306 -306
  111. pymobiledevice3/services/power_assertion.py +10 -9
  112. pymobiledevice3/services/preboard.py +4 -4
  113. pymobiledevice3/services/remote_fetch_symbols.py +16 -14
  114. pymobiledevice3/services/remote_server.py +176 -146
  115. pymobiledevice3/services/restore_service.py +16 -16
  116. pymobiledevice3/services/screenshot.py +13 -10
  117. pymobiledevice3/services/simulate_location.py +7 -7
  118. pymobiledevice3/services/springboard.py +15 -15
  119. pymobiledevice3/services/syslog.py +5 -5
  120. pymobiledevice3/services/web_protocol/alert.py +3 -3
  121. pymobiledevice3/services/web_protocol/automation_session.py +180 -176
  122. pymobiledevice3/services/web_protocol/cdp_screencast.py +44 -36
  123. pymobiledevice3/services/web_protocol/cdp_server.py +19 -19
  124. pymobiledevice3/services/web_protocol/cdp_target.py +411 -373
  125. pymobiledevice3/services/web_protocol/driver.py +47 -45
  126. pymobiledevice3/services/web_protocol/element.py +74 -63
  127. pymobiledevice3/services/web_protocol/inspector_session.py +106 -102
  128. pymobiledevice3/services/web_protocol/selenium_api.py +2 -2
  129. pymobiledevice3/services/web_protocol/session_protocol.py +15 -10
  130. pymobiledevice3/services/web_protocol/switch_to.py +11 -12
  131. pymobiledevice3/services/webinspector.py +127 -116
  132. pymobiledevice3/tcp_forwarder.py +35 -22
  133. pymobiledevice3/tunneld/api.py +20 -15
  134. pymobiledevice3/tunneld/server.py +212 -133
  135. pymobiledevice3/usbmux.py +183 -138
  136. pymobiledevice3/utils.py +14 -11
  137. {pymobiledevice3-5.0.0.dist-info → pymobiledevice3-5.0.2.dist-info}/METADATA +1 -1
  138. pymobiledevice3-5.0.2.dist-info/RECORD +173 -0
  139. pymobiledevice3-5.0.0.dist-info/RECORD +0 -173
  140. {pymobiledevice3-5.0.0.dist-info → pymobiledevice3-5.0.2.dist-info}/WHEEL +0 -0
  141. {pymobiledevice3-5.0.0.dist-info → pymobiledevice3-5.0.2.dist-info}/entry_points.txt +0 -0
  142. {pymobiledevice3-5.0.0.dist-info → pymobiledevice3-5.0.2.dist-info}/licenses/LICENSE +0 -0
  143. {pymobiledevice3-5.0.0.dist-info → pymobiledevice3-5.0.2.dist-info}/top_level.txt +0 -0
@@ -1,123 +1,130 @@
1
1
  # extracted from ac2
2
2
  import logging
3
3
  import uuid
4
+ from typing import Optional
4
5
 
5
6
  from ipsw_parser.build_identity import BuildIdentity
6
7
 
7
8
  logger = logging.getLogger(__name__)
8
9
 
9
10
  SUPPORTED_DATA_TYPES = {
10
- 'BasebandBootData': False,
11
- 'BasebandData': False,
12
- 'BasebandStackData': False,
13
- 'BasebandUpdaterOutputData': False,
14
- 'BootabilityBundle': False,
15
- 'BuildIdentityDict': False,
16
- 'BuildIdentityDictV2': False,
17
- 'DataType': False,
18
- 'DiagData': False,
19
- 'EANData': False,
20
- 'FDRMemoryCommit': False,
21
- 'FDRTrustData': False,
22
- 'FUDData': False,
23
- 'FileData': False,
24
- 'FileDataDone': False,
25
- 'FirmwareUpdaterData': False,
26
- 'GrapeFWData': False,
27
- 'HPMFWData': False,
28
- 'HostSystemTime': True,
29
- 'KernelCache': False,
30
- 'NORData': False,
31
- 'NitrogenFWData': True,
32
- 'OpalFWData': False,
33
- 'OverlayRootDataCount': False,
34
- 'OverlayRootDataForKey': True,
35
- 'PeppyFWData': True,
36
- 'PersonalizedBootObjectV3': False,
37
- 'PersonalizedData': True,
38
- 'ProvisioningData': False,
39
- 'RamdiskFWData': True,
40
- 'RecoveryOSASRImage': True,
41
- 'RecoveryOSAppleLogo': True,
42
- 'RecoveryOSDeviceTree': True,
43
- 'RecoveryOSFileAssetImage': True,
44
- 'RecoveryOSIBEC': True,
45
- 'RecoveryOSIBootFWFilesImages': True,
46
- 'RecoveryOSImage': True,
47
- 'RecoveryOSKernelCache': True,
48
- 'RecoveryOSLocalPolicy': True,
49
- 'RecoveryOSOverlayRootDataCount': False,
50
- 'RecoveryOSRootTicketData': True,
51
- 'RecoveryOSStaticTrustCache': True,
52
- 'RecoveryOSVersionData': True,
53
- 'RootData': False,
54
- 'RootTicket': False,
55
- 'S3EOverride': False,
56
- 'SourceBootObjectV3': False,
57
- 'SourceBootObjectV4': False,
58
- 'SsoServiceTicket': False,
59
- 'StockholmPostflight': False,
60
- 'SystemImageCanonicalMetadata': False,
61
- 'SystemImageData': False,
62
- 'SystemImageRootHash': False,
63
- 'USBCFWData': False,
64
- 'USBCOverride': False,
65
- 'FirmwareUpdaterPreflight': True,
66
- 'ReceiptManifest': True,
67
- 'FirmwareUpdaterDataV2': False,
68
- 'RestoreLocalPolicy': True,
69
- 'AuthInstallCACert': True,
70
- 'OverlayRootDataForKeyIndex': True,
71
-
11
+ "BasebandBootData": False,
12
+ "BasebandData": False,
13
+ "BasebandStackData": False,
14
+ "BasebandUpdaterOutputData": False,
15
+ "BootabilityBundle": False,
16
+ "BuildIdentityDict": False,
17
+ "BuildIdentityDictV2": False,
18
+ "DataType": False,
19
+ "DiagData": False,
20
+ "EANData": False,
21
+ "FDRMemoryCommit": False,
22
+ "FDRTrustData": False,
23
+ "FUDData": False,
24
+ "FileData": False,
25
+ "FileDataDone": False,
26
+ "FirmwareUpdaterData": False,
27
+ "GrapeFWData": False,
28
+ "HPMFWData": False,
29
+ "HostSystemTime": True,
30
+ "KernelCache": False,
31
+ "NORData": False,
32
+ "NitrogenFWData": True,
33
+ "OpalFWData": False,
34
+ "OverlayRootDataCount": False,
35
+ "OverlayRootDataForKey": True,
36
+ "PeppyFWData": True,
37
+ "PersonalizedBootObjectV3": False,
38
+ "PersonalizedData": True,
39
+ "ProvisioningData": False,
40
+ "RamdiskFWData": True,
41
+ "RecoveryOSASRImage": True,
42
+ "RecoveryOSAppleLogo": True,
43
+ "RecoveryOSDeviceTree": True,
44
+ "RecoveryOSFileAssetImage": True,
45
+ "RecoveryOSIBEC": True,
46
+ "RecoveryOSIBootFWFilesImages": True,
47
+ "RecoveryOSImage": True,
48
+ "RecoveryOSKernelCache": True,
49
+ "RecoveryOSLocalPolicy": True,
50
+ "RecoveryOSOverlayRootDataCount": False,
51
+ "RecoveryOSRootTicketData": True,
52
+ "RecoveryOSStaticTrustCache": True,
53
+ "RecoveryOSVersionData": True,
54
+ "RootData": False,
55
+ "RootTicket": False,
56
+ "S3EOverride": False,
57
+ "SourceBootObjectV3": False,
58
+ "SourceBootObjectV4": False,
59
+ "SsoServiceTicket": False,
60
+ "StockholmPostflight": False,
61
+ "SystemImageCanonicalMetadata": False,
62
+ "SystemImageData": False,
63
+ "SystemImageRootHash": False,
64
+ "USBCFWData": False,
65
+ "USBCOverride": False,
66
+ "FirmwareUpdaterPreflight": True,
67
+ "ReceiptManifest": True,
68
+ "FirmwareUpdaterDataV2": False,
69
+ "RestoreLocalPolicy": True,
70
+ "AuthInstallCACert": True,
71
+ "OverlayRootDataForKeyIndex": True,
72
72
  # Added in iOS 18.0 beta1
73
- 'FirmwareUpdaterDataV3': True,
74
- 'MessageUseStreamedImageFile': True,
75
- 'UpdateVolumeOverlayRootDataCount': True,
76
- 'URLAsset': True,
73
+ "FirmwareUpdaterDataV3": True,
74
+ "MessageUseStreamedImageFile": True,
75
+ "UpdateVolumeOverlayRootDataCount": True,
76
+ "URLAsset": True,
77
77
  }
78
78
 
79
79
  # extracted from ac2
80
80
  SUPPORTED_MESSAGE_TYPES = {
81
- 'BBUpdateStatusMsg': False,
82
- 'CheckpointMsg': True,
83
- 'CrashLog': True,
84
- 'DataRequestMsg': False,
85
- 'FDRSubmit': True,
86
- 'MsgType': False,
87
- 'PreviousRestoreLogMsg': False,
88
- 'ProgressMsg': False,
89
- 'ProvisioningAck': False,
90
- 'ProvisioningInfo': False,
91
- 'ProvisioningStatusMsg': False,
92
- 'ReceivedFinalStatusMsg': False,
93
- 'RestoredCrash': True,
94
- 'StatusMsg': False,
95
-
81
+ "BBUpdateStatusMsg": False,
82
+ "CheckpointMsg": True,
83
+ "CrashLog": True,
84
+ "DataRequestMsg": False,
85
+ "FDRSubmit": True,
86
+ "MsgType": False,
87
+ "PreviousRestoreLogMsg": False,
88
+ "ProgressMsg": False,
89
+ "ProvisioningAck": False,
90
+ "ProvisioningInfo": False,
91
+ "ProvisioningStatusMsg": False,
92
+ "ReceivedFinalStatusMsg": False,
93
+ "RestoredCrash": True,
94
+ "StatusMsg": False,
96
95
  # Added in iOS 18.0 beta1
97
- 'AsyncDataRequestMsg': True,
98
- 'AsyncWait': True,
99
- 'RestoreAttestation': True,
96
+ "AsyncDataRequestMsg": True,
97
+ "AsyncWait": True,
98
+ "RestoreAttestation": True,
100
99
  }
101
100
 
102
101
 
103
102
  class RestoreOptions:
104
-
105
- def __init__(self, firmware_preflight_info=None, sep=None, macos_variant=None, build_identity: BuildIdentity = None,
106
- restore_boot_args=None, spp=None, restore_behavior: str = None, msp=None):
103
+ def __init__(
104
+ self,
105
+ firmware_preflight_info=None,
106
+ sep=None,
107
+ macos_variant=None,
108
+ build_identity: BuildIdentity = None,
109
+ restore_boot_args=None,
110
+ spp=None,
111
+ restore_behavior: Optional[str] = None,
112
+ msp=None,
113
+ ):
107
114
  self.AutoBootDelay = 0
108
115
 
109
116
  try:
110
117
  if firmware_preflight_info is not None:
111
118
  bbus = dict(firmware_preflight_info)
112
- bbus.pop('FusingStatus')
113
- bbus.pop('PkHash')
119
+ bbus.pop("FusingStatus")
120
+ bbus.pop("PkHash")
114
121
  self.BBUpdaterState = bbus
115
122
 
116
- nonce = firmware_preflight_info.get('Nonce')
123
+ nonce = firmware_preflight_info.get("Nonce")
117
124
  if nonce is not None:
118
125
  self.BasebandNonce = nonce
119
126
  except KeyError as e:
120
- logger.warning(f'Skipping addition of firmware_preflight_info due to: {e}')
127
+ logger.warning(f"Skipping addition of firmware_preflight_info due to: {e}")
121
128
 
122
129
  self.SupportedDataTypes = SUPPORTED_DATA_TYPES
123
130
  self.SupportedMessageTypes = SUPPORTED_MESSAGE_TYPES
@@ -159,33 +166,33 @@ class RestoreOptions:
159
166
  if msp:
160
167
  self.SystemPartitionSize = msp
161
168
  else:
162
- self.BootImageType = 'UserOrInternal'
163
- self.DFUFileType = 'RELEASE'
169
+ self.BootImageType = "UserOrInternal"
170
+ self.DFUFileType = "RELEASE"
164
171
  self.DataImage = False
165
- self.FirmwareDirectory = '.'
172
+ self.FirmwareDirectory = "."
166
173
  self.FlashNOR = True
167
- self.KernelCacheType = 'Release'
168
- self.NORImageType = 'production'
169
- self.RestoreBundlePath = '/tmp/Per2.tmp'
170
- self.SystemImageType = 'User'
174
+ self.KernelCacheType = "Release"
175
+ self.NORImageType = "production"
176
+ self.RestoreBundlePath = "/tmp/Per2.tmp"
177
+ self.SystemImageType = "User"
171
178
  self.UpdateBaseband = False
172
179
 
173
180
  # Added for iOS 18.0 beta1
174
181
  self.HostHasFixFor99053849 = True
175
- self.SystemImageFormat = 'AEAWrappedDiskImage'
182
+ self.SystemImageFormat = "AEAWrappedDiskImage"
176
183
  self.WaitForDeviceConnectionToFinishStateMachine = False
177
184
  self.SupportedAsyncDataTypes = {
178
- 'BasebandData': False,
179
- 'RecoveryOSASRImage': False,
180
- 'StreamedImageDecryptionKey': False,
181
- 'SystemImageData': False,
182
- 'URLAsset': True
185
+ "BasebandData": False,
186
+ "RecoveryOSASRImage": False,
187
+ "StreamedImageDecryptionKey": False,
188
+ "SystemImageData": False,
189
+ "URLAsset": True,
183
190
  }
184
191
 
185
192
  if sep is not None:
186
- required_capacity = sep.get('RequiredCapacity')
193
+ required_capacity = sep.get("RequiredCapacity")
187
194
  if required_capacity:
188
- logger.debug(f'TZ0RequiredCapacity: {required_capacity}')
195
+ logger.debug(f"TZ0RequiredCapacity: {required_capacity}")
189
196
  self.TZ0RequiredCapacity = required_capacity
190
197
 
191
198
  self.PersonalizedDuringPreflight = True
@@ -202,15 +209,15 @@ class RestoreOptions:
202
209
  spp = dict(spp)
203
210
  else:
204
211
  spp = {
205
- '1024': 1280,
206
- '128': 1280,
207
- '16': 160,
208
- '256': 1280,
209
- '32': 320,
210
- '512': 1280,
211
- '64': 640,
212
- '768': 1280,
213
- '8': 80
212
+ "1024": 1280,
213
+ "128": 1280,
214
+ "16": 160,
215
+ "256": 1280,
216
+ "32": 320,
217
+ "512": 1280,
218
+ "64": 640,
219
+ "768": 1280,
220
+ "8": 80,
214
221
  }
215
222
  self.SystemPartitionPadding = spp
216
223
 
@@ -12,23 +12,24 @@ logger = logging.getLogger(__name__)
12
12
 
13
13
 
14
14
  class RestoredClient:
15
- DEFAULT_CLIENT_NAME = 'pymobiledevice3'
15
+ DEFAULT_CLIENT_NAME = "pymobiledevice3"
16
16
  SERVICE_PORT = 62078
17
17
 
18
18
  @classmethod
19
- async def create(cls, ecid: str) -> 'RestoredClient':
20
- for mux_device in select_devices_by_connection_type('USB'):
21
- logger.debug(f'Iterating: {mux_device}')
22
- service = ServiceConnection.create_using_usbmux(mux_device.serial, cls.SERVICE_PORT,
23
- connection_type=mux_device.connection_type)
19
+ async def create(cls, ecid: str) -> "RestoredClient":
20
+ for mux_device in select_devices_by_connection_type("USB"):
21
+ logger.debug(f"Iterating: {mux_device}")
22
+ service = ServiceConnection.create_using_usbmux(
23
+ mux_device.serial, cls.SERVICE_PORT, connection_type=mux_device.connection_type
24
+ )
24
25
  await service.aio_start()
25
26
 
26
- query_type = await service.aio_send_recv_plist({'Request': 'QueryType'})
27
- version = query_type.get('RestoreProtocolVersion')
28
- logger.debug(f'RestoreProtocolVersion: {version}')
27
+ query_type = await service.aio_send_recv_plist({"Request": "QueryType"})
28
+ version = query_type.get("RestoreProtocolVersion")
29
+ logger.debug(f"RestoreProtocolVersion: {version}")
29
30
 
30
- if query_type.get('Type') != 'com.apple.mobile.restored':
31
- logger.debug(f'Skipping: {mux_device.serial} as its not a restored device')
31
+ if query_type.get("Type") != "com.apple.mobile.restored":
32
+ logger.debug(f"Skipping: {mux_device.serial} as its not a restored device")
32
33
  await service.aio_close()
33
34
  continue
34
35
 
@@ -36,8 +37,10 @@ class RestoredClient:
36
37
  await restored_client._connect()
37
38
 
38
39
  if restored_client.ecid != ecid:
39
- logger.debug(f'Skipping: {restored_client.ecid} as its not the right ECID ({restored_client.ecid} '
40
- f'instead of {ecid})')
40
+ logger.debug(
41
+ f"Skipping: {restored_client.ecid} as its not the right ECID ({restored_client.ecid} "
42
+ f"instead of {ecid})"
43
+ )
41
44
  await service.aio_close()
42
45
  continue
43
46
 
@@ -51,9 +54,9 @@ class RestoredClient:
51
54
  self.label = DEFAULT_LABEL
52
55
 
53
56
  async def _connect(self) -> None:
54
- self.hardware_info = (await self.query_value('HardwareInfo'))['HardwareInfo']
55
- self.ecid = self.hardware_info['UniqueChipID']
56
- self.saved_debug_info = (await self.query_value('SavedDebugInfo'))['SavedDebugInfo']
57
+ self.hardware_info = (await self.query_value("HardwareInfo"))["HardwareInfo"]
58
+ self.ecid = self.hardware_info["UniqueChipID"]
59
+ self.saved_debug_info = (await self.query_value("SavedDebugInfo"))["SavedDebugInfo"]
57
60
 
58
61
  @staticmethod
59
62
  def _get_or_verify_udid(udid: Optional[str] = None) -> str:
@@ -66,25 +69,25 @@ class RestoredClient:
66
69
  return device.serial
67
70
 
68
71
  async def query_value(self, key: Optional[str] = None) -> Any:
69
- req = {'Request': 'QueryValue', 'Label': self.label}
72
+ req = {"Request": "QueryValue", "Label": self.label}
70
73
 
71
74
  if key:
72
- req['QueryKey'] = key
75
+ req["QueryKey"] = key
73
76
 
74
77
  return await self.service.aio_send_recv_plist(req)
75
78
 
76
79
  async def start_restore(self, opts: Optional[RestoreOptions] = None) -> None:
77
- req = {'Request': 'StartRestore', 'Label': self.label, 'RestoreProtocolVersion': self.version}
80
+ req = {"Request": "StartRestore", "Label": self.label, "RestoreProtocolVersion": self.version}
78
81
 
79
82
  if opts is not None:
80
- req['RestoreOptions'] = opts.to_dict()
83
+ req["RestoreOptions"] = opts.to_dict()
81
84
 
82
- logger.debug(f'start_restore request: {req}')
85
+ logger.debug(f"start_restore request: {req}")
83
86
 
84
87
  return await self.service.aio_send_plist(req)
85
88
 
86
89
  async def reboot(self) -> dict:
87
- return await self.service.aio_send_recv_plist({'Request': 'Reboot', 'Label': self.label})
90
+ return await self.service.aio_send_recv_plist({"Request": "Reboot", "Label": self.label})
88
91
 
89
92
  async def send(self, message: dict) -> None:
90
93
  await self.service.aio_send_plist(message)