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
@@ -22,15 +22,15 @@ class AXAuditInspectorFocus_v1(SerializedObject):
22
22
 
23
23
  @property
24
24
  def caption(self) -> str:
25
- return self._fields.get('CaptionTextValue_v1')
25
+ return self._fields.get("CaptionTextValue_v1")
26
26
 
27
27
  @property
28
28
  def spoken_description(self) -> str:
29
- return self._fields.get('SpokenDescriptionValue_v1')
29
+ return self._fields.get("SpokenDescriptionValue_v1")
30
30
 
31
31
  @property
32
32
  def element(self) -> bytes:
33
- return self._fields.get('ElementValue_v1')
33
+ return self._fields.get("ElementValue_v1")
34
34
 
35
35
  @property
36
36
  def platform_identifier(self) -> str:
@@ -66,14 +66,14 @@ class AXAuditInspectorFocus_v1(SerializedObject):
66
66
  def to_dict(self) -> dict:
67
67
  """Serializes the focus element into a dictionary."""
68
68
  return {
69
- 'platform_identifier': self.platform_identifier,
70
- 'estimated_uid': self.estimated_uid,
71
- 'caption': self.caption,
72
- 'spoken_description': self.spoken_description
69
+ "platform_identifier": self.platform_identifier,
70
+ "estimated_uid": self.estimated_uid,
71
+ "caption": self.caption,
72
+ "spoken_description": self.spoken_description,
73
73
  }
74
74
 
75
75
  def __str__(self):
76
- return f'<Focused ElementCaption: {self.caption}>'
76
+ return f"<Focused ElementCaption: {self.caption}>"
77
77
 
78
78
 
79
79
  class AXAuditElement_v1(SerializedObject):
@@ -82,10 +82,10 @@ class AXAuditElement_v1(SerializedObject):
82
82
 
83
83
  @property
84
84
  def identifier(self) -> bytes:
85
- return self._fields['PlatformElementValue_v1']
85
+ return self._fields["PlatformElementValue_v1"]
86
86
 
87
87
  def __repr__(self):
88
- return f'<Element: {self.identifier}>'
88
+ return f"<Element: {self.identifier}>"
89
89
 
90
90
 
91
91
  class AXAuditInspectorSection_v1(SerializedObject):
@@ -99,7 +99,7 @@ class AXAuditElementAttribute_v1(SerializedObject):
99
99
 
100
100
 
101
101
  class AXAuditDeviceSetting_v1(SerializedObject):
102
- FIELDS = ('IdentiifierValue_v1', 'CurrentValueNumber_v1')
102
+ FIELDS = ("IdentiifierValue_v1", "CurrentValueNumber_v1")
103
103
 
104
104
  def __init__(self, fields):
105
105
  super().__init__(fields)
@@ -109,14 +109,14 @@ class AXAuditDeviceSetting_v1(SerializedObject):
109
109
 
110
110
  @property
111
111
  def key(self) -> str:
112
- return self._fields['IdentiifierValue_v1']
112
+ return self._fields["IdentiifierValue_v1"]
113
113
 
114
114
  @property
115
115
  def value(self) -> typing.Any:
116
- return self._fields['CurrentValueNumber_v1']
116
+ return self._fields["CurrentValueNumber_v1"]
117
117
 
118
118
  def __str__(self) -> str:
119
- return f'<AXAuditDeviceSetting_v1 {self.key} = {self.value}>'
119
+ return f"<AXAuditDeviceSetting_v1 {self.key} = {self.value}>"
120
120
 
121
121
 
122
122
  class AuditType(IntEnum):
@@ -131,21 +131,27 @@ class AuditType(IntEnum):
131
131
 
132
132
 
133
133
  AUDIT_TYPE_DESCRIPTIONS = {
134
- AuditType.DYNAMIC_TEXT: 'testTypeDynamicText',
135
- AuditType.DYNAMIC_TEXT_ALT: 'testTypeDynamicText',
136
- AuditType.TEXT_CLIPPED: 'testTypeTextClipped',
137
- AuditType.ELEMENT_DETECTION: 'testTypeElementDetection',
138
- AuditType.SUFFICIENT_ELEMENT_DESCRIPTION: 'testTypeSufficientElementDescription',
139
- AuditType.HIT_REGION: 'testTypeHitRegion',
140
- AuditType.CONTRAST: 'testTypeContrast',
141
- AuditType.CONTRAST_ALT: 'testTypeContrast'
134
+ AuditType.DYNAMIC_TEXT: "testTypeDynamicText",
135
+ AuditType.DYNAMIC_TEXT_ALT: "testTypeDynamicText",
136
+ AuditType.TEXT_CLIPPED: "testTypeTextClipped",
137
+ AuditType.ELEMENT_DETECTION: "testTypeElementDetection",
138
+ AuditType.SUFFICIENT_ELEMENT_DESCRIPTION: "testTypeSufficientElementDescription",
139
+ AuditType.HIT_REGION: "testTypeHitRegion",
140
+ AuditType.CONTRAST: "testTypeContrast",
141
+ AuditType.CONTRAST_ALT: "testTypeContrast",
142
142
  }
143
143
 
144
144
 
145
145
  class AXAuditIssue_v1(SerializedObject):
146
- FIELDS = ('ElementRectValue_v1', 'IssueClassificationValue_v1',
147
- 'FontSizeValue_v1', 'MLGeneratedDescriptionValue_v1', 'ElementLongDescExtraInfo_v1',
148
- 'BackgroundColorValue_v1', 'ForegroundColorValue_v1')
146
+ FIELDS = (
147
+ "ElementRectValue_v1",
148
+ "IssueClassificationValue_v1",
149
+ "FontSizeValue_v1",
150
+ "MLGeneratedDescriptionValue_v1",
151
+ "ElementLongDescExtraInfo_v1",
152
+ "BackgroundColorValue_v1",
153
+ "ForegroundColorValue_v1",
154
+ )
149
155
 
150
156
  def __init__(self, fields):
151
157
  super().__init__(fields)
@@ -156,11 +162,11 @@ class AXAuditIssue_v1(SerializedObject):
156
162
 
157
163
  @property
158
164
  def rect(self) -> str:
159
- return self._fields['ElementRectValue_v1']
165
+ return self._fields["ElementRectValue_v1"]
160
166
 
161
167
  @property
162
168
  def issue_type(self) -> typing.Any:
163
- issue_classification = self._fields['IssueClassificationValue_v1']
169
+ issue_classification = self._fields["IssueClassificationValue_v1"]
164
170
  if issue_classification in AUDIT_TYPE_DESCRIPTIONS:
165
171
  return AUDIT_TYPE_DESCRIPTIONS[AuditType(issue_classification)]
166
172
  else:
@@ -168,36 +174,36 @@ class AXAuditIssue_v1(SerializedObject):
168
174
 
169
175
  @property
170
176
  def ml_generated_description(self) -> typing.Any:
171
- return self._fields['MLGeneratedDescriptionValue_v1']
177
+ return self._fields["MLGeneratedDescriptionValue_v1"]
172
178
 
173
179
  @property
174
180
  def long_description_extra_info(self) -> typing.Any:
175
- return self._fields['ElementLongDescExtraInfo_v1']
181
+ return self._fields["ElementLongDescExtraInfo_v1"]
176
182
 
177
183
  @property
178
184
  def font_size(self) -> typing.Any:
179
- return self._fields['FontSizeValue_v1']
185
+ return self._fields["FontSizeValue_v1"]
180
186
 
181
187
  @property
182
188
  def foreground_color(self) -> typing.Any:
183
- return self._fields['ForegroundColorValue_v1']
189
+ return self._fields["ForegroundColorValue_v1"]
184
190
 
185
191
  @property
186
192
  def background_color(self) -> typing.Any:
187
- return self._fields['BackgroundColorValue_v1']
193
+ return self._fields["BackgroundColorValue_v1"]
188
194
 
189
195
  def json(self) -> dict:
190
196
  resp = {
191
- 'element_rect_value': self.rect,
192
- 'issue_classification': self.issue_type,
193
- 'font_size': self.font_size,
194
- 'ml_generated_description': self.ml_generated_description,
195
- 'long_description_extra_info': self.long_description_extra_info
197
+ "element_rect_value": self.rect,
198
+ "issue_classification": self.issue_type,
199
+ "font_size": self.font_size,
200
+ "ml_generated_description": self.ml_generated_description,
201
+ "long_description_extra_info": self.long_description_extra_info,
196
202
  }
197
203
  # Include foreground and background colors when issue type is 'testTypeContrast'
198
- if self._fields['IssueClassificationValue_v1'] in {AuditType.CONTRAST, AuditType.CONTRAST_ALT}:
199
- resp['foreground_color'] = self.foreground_color
200
- resp['background_color'] = self.background_color
204
+ if self._fields["IssueClassificationValue_v1"] in {AuditType.CONTRAST, AuditType.CONTRAST_ALT}:
205
+ resp["foreground_color"] = self.foreground_color
206
+ resp["background_color"] = self.background_color
201
207
  return resp
202
208
 
203
209
  def __str__(self) -> str:
@@ -205,12 +211,12 @@ class AXAuditIssue_v1(SerializedObject):
205
211
 
206
212
 
207
213
  SERIALIZABLE_OBJECTS = {
208
- 'AXAuditDeviceSetting_v1': AXAuditDeviceSetting_v1,
209
- 'AXAuditInspectorFocus_v1': AXAuditInspectorFocus_v1,
210
- 'AXAuditElement_v1': AXAuditElement_v1,
211
- 'AXAuditInspectorSection_v1': AXAuditInspectorSection_v1,
212
- 'AXAuditElementAttribute_v1': AXAuditElementAttribute_v1,
213
- 'AXAuditIssue_v1': AXAuditIssue_v1
214
+ "AXAuditDeviceSetting_v1": AXAuditDeviceSetting_v1,
215
+ "AXAuditInspectorFocus_v1": AXAuditInspectorFocus_v1,
216
+ "AXAuditElement_v1": AXAuditElement_v1,
217
+ "AXAuditInspectorSection_v1": AXAuditInspectorSection_v1,
218
+ "AXAuditElementAttribute_v1": AXAuditElementAttribute_v1,
219
+ "AXAuditIssue_v1": AXAuditIssue_v1,
214
220
  }
215
221
 
216
222
 
@@ -233,22 +239,22 @@ def deserialize_object(d):
233
239
  return [deserialize_object(x) for x in d]
234
240
  return d
235
241
 
236
- if 'ObjectType' not in d:
242
+ if "ObjectType" not in d:
237
243
  # simple dictionary
238
244
  new_dict = {}
239
245
  for k, v in d.items():
240
246
  new_dict[k] = deserialize_object(v)
241
247
  return new_dict
242
248
 
243
- if d['ObjectType'] == 'passthrough':
244
- return deserialize_object(d['Value'])
249
+ if d["ObjectType"] == "passthrough":
250
+ return deserialize_object(d["Value"])
245
251
  else:
246
- return SERIALIZABLE_OBJECTS[d['ObjectType']](deserialize_object(d['Value']))
252
+ return SERIALIZABLE_OBJECTS[d["ObjectType"]](deserialize_object(d["Value"]))
247
253
 
248
254
 
249
255
  class AccessibilityAudit(RemoteServer):
250
- SERVICE_NAME = 'com.apple.accessibility.axAuditDaemon.remoteserver'
251
- RSD_SERVICE_NAME = 'com.apple.accessibility.axAuditDaemon.remoteserver.shim.remote'
256
+ SERVICE_NAME = "com.apple.accessibility.axAuditDaemon.remoteserver"
257
+ RSD_SERVICE_NAME = "com.apple.accessibility.axAuditDaemon.remoteserver.shim.remote"
252
258
 
253
259
  def __init__(self, lockdown: LockdownServiceProvider):
254
260
  if isinstance(lockdown, LockdownClient):
@@ -259,7 +265,7 @@ class AccessibilityAudit(RemoteServer):
259
265
  # flush previously received messages
260
266
  self.recv_plist()
261
267
  self.product_version = Version(lockdown.product_version)
262
- if Version(lockdown.product_version) >= Version('15.0'):
268
+ if Version(lockdown.product_version) >= Version("15.0"):
263
269
  self.recv_plist()
264
270
 
265
271
  @property
@@ -268,19 +274,19 @@ class AccessibilityAudit(RemoteServer):
268
274
  return self.recv_plist()[0]
269
275
 
270
276
  def run_audit(self, value: list) -> list[AXAuditIssue_v1]:
271
- if self.product_version >= Version('15.0'):
277
+ if self.product_version >= Version("15.0"):
272
278
  self.broadcast.deviceBeginAuditTypes_(MessageAux().append_obj(value))
273
279
  else:
274
280
  self.broadcast.deviceBeginAuditCaseIDs_(MessageAux().append_obj(value))
275
281
 
276
282
  while True:
277
283
  message = self.recv_plist()
278
- if message[1] is None or message[0] != 'hostDeviceDidCompleteAuditCategoriesWithAuditIssues:':
284
+ if message[1] is None or message[0] != "hostDeviceDidCompleteAuditCategoriesWithAuditIssues:":
279
285
  continue
280
- return deserialize_object(message[1])[0]['value']
286
+ return deserialize_object(message[1])[0]["value"]
281
287
 
282
288
  def supported_audits_types(self) -> None:
283
- if self.product_version >= Version('15.0'):
289
+ if self.product_version >= Version("15.0"):
284
290
  self.broadcast.deviceAllSupportedAuditTypes()
285
291
  else:
286
292
  self.broadcast.deviceAllAuditCaseIDs()
@@ -298,7 +304,7 @@ class AccessibilityAudit(RemoteServer):
298
304
  def set_app_monitoring_enabled(self, value: bool) -> None:
299
305
  self.broadcast.deviceSetAppMonitoringEnabled_(MessageAux().append_obj(value), expects_reply=False)
300
306
 
301
- def set_monitored_event_type(self, event_type: int = None) -> None:
307
+ def set_monitored_event_type(self, event_type: typing.Optional[int] = None) -> None:
302
308
  if event_type is None:
303
309
  event_type = 0
304
310
  self.broadcast.deviceInspectorSetMonitoredEventType_(MessageAux().append_obj(event_type), expects_reply=False)
@@ -309,9 +315,9 @@ class AccessibilityAudit(RemoteServer):
309
315
  def set_show_visuals(self, value: bool) -> None:
310
316
  self.broadcast.deviceInspectorShowVisuals_(MessageAux().append_obj(int(value)), expects_reply=False)
311
317
 
312
- def iter_events(self, app_monitoring_enabled=True, monitored_event_type: int = None) -> \
313
- typing.Generator[Event, None, None]:
314
-
318
+ def iter_events(
319
+ self, app_monitoring_enabled=True, monitored_event_type: typing.Optional[int] = None
320
+ ) -> typing.Generator[Event, None, None]:
315
321
  self.set_app_monitoring_enabled(app_monitoring_enabled)
316
322
  self.set_monitored_event_type(monitored_event_type)
317
323
 
@@ -319,101 +325,105 @@ class AccessibilityAudit(RemoteServer):
319
325
  message = self.recv_plist()
320
326
  if message[1] is None:
321
327
  continue
322
- data = [x['value'] for x in message[1]]
328
+ data = [x["value"] for x in message[1]]
323
329
  yield Event(name=message[0], data=deserialize_object(data))
324
330
 
325
331
  def move_focus_next(self) -> None:
326
332
  self.move_focus(Direction.Next)
327
333
 
328
334
  def perform_press(self, element: bytes) -> None:
329
- """ simulate click (can be used only for processes with task_for_pid-allow """
335
+ """simulate click (can be used only for processes with task_for_pid-allow"""
330
336
  element = {
331
- 'ObjectType': 'AXAuditElement_v1',
332
- 'Value': {
333
- 'ObjectType': 'passthrough',
334
- 'Value': {
335
- 'PlatformElementValue_v1': {
336
- 'ObjectType': 'passthrough'
337
- },
338
- 'Value': element,
339
- }
340
- }
337
+ "ObjectType": "AXAuditElement_v1",
338
+ "Value": {
339
+ "ObjectType": "passthrough",
340
+ "Value": {
341
+ "PlatformElementValue_v1": {"ObjectType": "passthrough"},
342
+ "Value": element,
343
+ },
344
+ },
341
345
  }
342
346
 
343
347
  action = {
344
- 'ObjectType': 'AXAuditElementAttribute_v1',
345
- 'Value': {
346
- 'ObjectType': 'passthrough',
347
- 'Value': {
348
- 'AttributeNameValue_v1': {
349
- 'ObjectType': 'passthrough',
350
- 'Value': 'AXAction-2010',
348
+ "ObjectType": "AXAuditElementAttribute_v1",
349
+ "Value": {
350
+ "ObjectType": "passthrough",
351
+ "Value": {
352
+ "AttributeNameValue_v1": {
353
+ "ObjectType": "passthrough",
354
+ "Value": "AXAction-2010",
351
355
  },
352
- 'DisplayAsTree_v1': {
353
- 'ObjectType': 'passthrough',
354
- 'Value': 0,
356
+ "DisplayAsTree_v1": {
357
+ "ObjectType": "passthrough",
358
+ "Value": 0,
355
359
  },
356
- 'HumanReadableNameValue_v1': {
357
- 'ObjectType': 'passthrough',
358
- 'Value': 'Activate',
360
+ "HumanReadableNameValue_v1": {
361
+ "ObjectType": "passthrough",
362
+ "Value": "Activate",
359
363
  },
360
- 'IsInternal_v1': {
361
- 'ObjectType': 'passthrough',
362
- 'Value': 0,
364
+ "IsInternal_v1": {
365
+ "ObjectType": "passthrough",
366
+ "Value": 0,
363
367
  },
364
- 'PerformsActionValue_v1': {
365
- 'ObjectType': 'passthrough',
366
- 'Value': 1,
368
+ "PerformsActionValue_v1": {
369
+ "ObjectType": "passthrough",
370
+ "Value": 1,
367
371
  },
368
- 'SettableValue_v1': {
369
- 'ObjectType': 'passthrough',
370
- 'Value': 0,
372
+ "SettableValue_v1": {
373
+ "ObjectType": "passthrough",
374
+ "Value": 0,
371
375
  },
372
- 'ValueTypeValue_v1': {
373
- 'ObjectType': 'passthrough',
374
- 'Value': 1,
376
+ "ValueTypeValue_v1": {
377
+ "ObjectType": "passthrough",
378
+ "Value": 1,
375
379
  },
376
- }
377
- }
380
+ },
381
+ },
378
382
  }
379
383
 
380
384
  self.broadcast.deviceElement_performAction_withValue_(
381
- MessageAux().append_obj(element).append_obj(action).append_obj(0), expects_reply=False)
385
+ MessageAux().append_obj(element).append_obj(action).append_obj(0), expects_reply=False
386
+ )
382
387
 
383
388
  def move_focus(self, direction: Direction) -> None:
384
389
  options = {
385
- 'ObjectType': 'passthrough',
386
- 'Value': {
387
- 'allowNonAX': {
388
- 'ObjectType': 'passthrough',
389
- 'Value': 0,
390
+ "ObjectType": "passthrough",
391
+ "Value": {
392
+ "allowNonAX": {
393
+ "ObjectType": "passthrough",
394
+ "Value": 0,
390
395
  },
391
- 'direction': {
392
- 'ObjectType': 'passthrough',
393
- 'Value': direction.value,
396
+ "direction": {
397
+ "ObjectType": "passthrough",
398
+ "Value": direction.value,
394
399
  },
395
- 'includeContainers': {
396
- 'ObjectType': 'passthrough',
397
- 'Value': 1,
398
- }
399
- }
400
+ "includeContainers": {
401
+ "ObjectType": "passthrough",
402
+ "Value": 1,
403
+ },
404
+ },
400
405
  }
401
406
 
402
407
  self.broadcast.deviceInspectorMoveWithOptions_(MessageAux().append_obj(options), expects_reply=False)
403
408
 
404
409
  def set_setting(self, name: str, value: typing.Any) -> None:
405
- setting = {'ObjectType': 'AXAuditDeviceSetting_v1',
406
- 'Value': {'ObjectType': 'passthrough',
407
- 'Value': {'CurrentValueNumber_v1': {'ObjectType': 'passthrough',
408
- 'Value': True},
409
- 'EnabledValue_v1': {'ObjectType': 'passthrough', 'Value': True},
410
- 'IdentiifierValue_v1': {'ObjectType': 'passthrough',
411
- 'Value': name},
412
- 'SettingTypeValue_v1': {'ObjectType': 'passthrough', 'Value': 3},
413
- 'SliderTickMarksValue_v1': {'ObjectType': 'passthrough', 'Value': 0}}}}
410
+ setting = {
411
+ "ObjectType": "AXAuditDeviceSetting_v1",
412
+ "Value": {
413
+ "ObjectType": "passthrough",
414
+ "Value": {
415
+ "CurrentValueNumber_v1": {"ObjectType": "passthrough", "Value": True},
416
+ "EnabledValue_v1": {"ObjectType": "passthrough", "Value": True},
417
+ "IdentiifierValue_v1": {"ObjectType": "passthrough", "Value": name},
418
+ "SettingTypeValue_v1": {"ObjectType": "passthrough", "Value": 3},
419
+ "SliderTickMarksValue_v1": {"ObjectType": "passthrough", "Value": 0},
420
+ },
421
+ },
422
+ }
414
423
  self.broadcast.deviceUpdateAccessibilitySetting_withValue_(
415
- MessageAux().append_obj(setting).append_obj({'ObjectType': 'passthrough', 'Value': value}),
416
- expects_reply=False)
424
+ MessageAux().append_obj(setting).append_obj({"ObjectType": "passthrough", "Value": value}),
425
+ expects_reply=False,
426
+ )
417
427
 
418
428
  def reset_settings(self) -> None:
419
429
  self.broadcast.deviceResetToDefaultAccessibilitySettings()
@@ -427,7 +437,7 @@ class AccessibilityAudit(RemoteServer):
427
437
  visited_identifiers = set()
428
438
 
429
439
  for event in iterator:
430
- if event.name != 'hostInspectorCurrentElementChanged:':
440
+ if event.name != "hostInspectorCurrentElementChanged:":
431
441
  # ignore any other events
432
442
  continue
433
443