mithwire 0.50.3__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.
Files changed (76) hide show
  1. mithwire/__init__.py +32 -0
  2. mithwire/cdp/README.md +4 -0
  3. mithwire/cdp/__init__.py +6 -0
  4. mithwire/cdp/accessibility.py +668 -0
  5. mithwire/cdp/animation.py +494 -0
  6. mithwire/cdp/audits.py +1995 -0
  7. mithwire/cdp/autofill.py +292 -0
  8. mithwire/cdp/background_service.py +215 -0
  9. mithwire/cdp/bluetooth_emulation.py +626 -0
  10. mithwire/cdp/browser.py +821 -0
  11. mithwire/cdp/cache_storage.py +311 -0
  12. mithwire/cdp/cast.py +172 -0
  13. mithwire/cdp/console.py +107 -0
  14. mithwire/cdp/crash_report_context.py +55 -0
  15. mithwire/cdp/css.py +2750 -0
  16. mithwire/cdp/database.py +179 -0
  17. mithwire/cdp/debugger.py +1405 -0
  18. mithwire/cdp/device_access.py +141 -0
  19. mithwire/cdp/device_orientation.py +45 -0
  20. mithwire/cdp/dom.py +2257 -0
  21. mithwire/cdp/dom_debugger.py +321 -0
  22. mithwire/cdp/dom_snapshot.py +876 -0
  23. mithwire/cdp/dom_storage.py +222 -0
  24. mithwire/cdp/emulation.py +1779 -0
  25. mithwire/cdp/event_breakpoints.py +56 -0
  26. mithwire/cdp/extensions.py +238 -0
  27. mithwire/cdp/fed_cm.py +283 -0
  28. mithwire/cdp/fetch.py +507 -0
  29. mithwire/cdp/file_system.py +115 -0
  30. mithwire/cdp/headless_experimental.py +115 -0
  31. mithwire/cdp/heap_profiler.py +401 -0
  32. mithwire/cdp/indexed_db.py +528 -0
  33. mithwire/cdp/input_.py +701 -0
  34. mithwire/cdp/inspector.py +95 -0
  35. mithwire/cdp/io.py +101 -0
  36. mithwire/cdp/layer_tree.py +464 -0
  37. mithwire/cdp/log.py +190 -0
  38. mithwire/cdp/media.py +313 -0
  39. mithwire/cdp/memory.py +305 -0
  40. mithwire/cdp/network.py +5342 -0
  41. mithwire/cdp/overlay.py +1468 -0
  42. mithwire/cdp/page.py +3972 -0
  43. mithwire/cdp/performance.py +124 -0
  44. mithwire/cdp/performance_timeline.py +200 -0
  45. mithwire/cdp/preload.py +575 -0
  46. mithwire/cdp/profiler.py +420 -0
  47. mithwire/cdp/pwa.py +278 -0
  48. mithwire/cdp/py.typed +0 -0
  49. mithwire/cdp/runtime.py +1589 -0
  50. mithwire/cdp/schema.py +50 -0
  51. mithwire/cdp/security.py +518 -0
  52. mithwire/cdp/service_worker.py +401 -0
  53. mithwire/cdp/smart_card_emulation.py +891 -0
  54. mithwire/cdp/storage.py +1573 -0
  55. mithwire/cdp/system_info.py +327 -0
  56. mithwire/cdp/target.py +829 -0
  57. mithwire/cdp/tethering.py +65 -0
  58. mithwire/cdp/tracing.py +377 -0
  59. mithwire/cdp/util.py +18 -0
  60. mithwire/cdp/web_audio.py +606 -0
  61. mithwire/cdp/web_authn.py +598 -0
  62. mithwire/cdp/web_mcp.py +293 -0
  63. mithwire/core/_contradict.py +142 -0
  64. mithwire/core/browser.py +923 -0
  65. mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
  66. mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
  67. mithwire/core/config.py +323 -0
  68. mithwire/core/connection.py +564 -0
  69. mithwire/core/element.py +1205 -0
  70. mithwire/core/tab.py +2202 -0
  71. mithwire/core/util.py +5063 -0
  72. mithwire-0.50.3.dist-info/METADATA +1049 -0
  73. mithwire-0.50.3.dist-info/RECORD +76 -0
  74. mithwire-0.50.3.dist-info/WHEEL +5 -0
  75. mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
  76. mithwire-0.50.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,494 @@
1
+ # DO NOT EDIT THIS FILE!
2
+ #
3
+ # This file is generated from the CDP specification. If you need to make
4
+ # changes, edit the generator and regenerate all of the modules.
5
+ #
6
+ # CDP domain: Animation (experimental)
7
+
8
+ from __future__ import annotations
9
+ import enum
10
+ import typing
11
+ from dataclasses import dataclass
12
+ from .util import event_class, T_JSON_DICT
13
+
14
+ from . import dom
15
+ from . import runtime
16
+
17
+
18
+ @dataclass
19
+ class Animation:
20
+ '''
21
+ Animation instance.
22
+ '''
23
+ #: ``Animation``'s id.
24
+ id_: str
25
+
26
+ #: ``Animation``'s name.
27
+ name: str
28
+
29
+ #: ``Animation``'s internal paused state.
30
+ paused_state: bool
31
+
32
+ #: ``Animation``'s play state.
33
+ play_state: str
34
+
35
+ #: ``Animation``'s playback rate.
36
+ playback_rate: float
37
+
38
+ #: ``Animation``'s start time.
39
+ #: Milliseconds for time based animations and
40
+ #: percentage [0 - 100] for scroll driven animations
41
+ #: (i.e. when viewOrScrollTimeline exists).
42
+ start_time: float
43
+
44
+ #: ``Animation``'s current time.
45
+ current_time: float
46
+
47
+ #: Animation type of ``Animation``.
48
+ type_: str
49
+
50
+ #: ``Animation``'s source animation node.
51
+ source: typing.Optional[AnimationEffect] = None
52
+
53
+ #: A unique ID for ``Animation`` representing the sources that triggered this CSS
54
+ #: animation/transition.
55
+ css_id: typing.Optional[str] = None
56
+
57
+ #: View or scroll timeline
58
+ view_or_scroll_timeline: typing.Optional[ViewOrScrollTimeline] = None
59
+
60
+ def to_json(self) -> T_JSON_DICT:
61
+ json: T_JSON_DICT = dict()
62
+ json['id'] = self.id_
63
+ json['name'] = self.name
64
+ json['pausedState'] = self.paused_state
65
+ json['playState'] = self.play_state
66
+ json['playbackRate'] = self.playback_rate
67
+ json['startTime'] = self.start_time
68
+ json['currentTime'] = self.current_time
69
+ json['type'] = self.type_
70
+ if self.source is not None:
71
+ json['source'] = self.source.to_json()
72
+ if self.css_id is not None:
73
+ json['cssId'] = self.css_id
74
+ if self.view_or_scroll_timeline is not None:
75
+ json['viewOrScrollTimeline'] = self.view_or_scroll_timeline.to_json()
76
+ return json
77
+
78
+ @classmethod
79
+ def from_json(cls, json: T_JSON_DICT) -> Animation:
80
+ return cls(
81
+ id_=str(json['id']),
82
+ name=str(json['name']),
83
+ paused_state=bool(json['pausedState']),
84
+ play_state=str(json['playState']),
85
+ playback_rate=float(json['playbackRate']),
86
+ start_time=float(json['startTime']),
87
+ current_time=float(json['currentTime']),
88
+ type_=str(json['type']),
89
+ source=AnimationEffect.from_json(json['source']) if json.get('source', None) is not None else None,
90
+ css_id=str(json['cssId']) if json.get('cssId', None) is not None else None,
91
+ view_or_scroll_timeline=ViewOrScrollTimeline.from_json(json['viewOrScrollTimeline']) if json.get('viewOrScrollTimeline', None) is not None else None,
92
+ )
93
+
94
+
95
+ @dataclass
96
+ class ViewOrScrollTimeline:
97
+ '''
98
+ Timeline instance
99
+ '''
100
+ #: Orientation of the scroll
101
+ axis: dom.ScrollOrientation
102
+
103
+ #: Scroll container node
104
+ source_node_id: typing.Optional[dom.BackendNodeId] = None
105
+
106
+ #: Represents the starting scroll position of the timeline
107
+ #: as a length offset in pixels from scroll origin.
108
+ start_offset: typing.Optional[float] = None
109
+
110
+ #: Represents the ending scroll position of the timeline
111
+ #: as a length offset in pixels from scroll origin.
112
+ end_offset: typing.Optional[float] = None
113
+
114
+ #: The element whose principal box's visibility in the
115
+ #: scrollport defined the progress of the timeline.
116
+ #: Does not exist for animations with ScrollTimeline
117
+ subject_node_id: typing.Optional[dom.BackendNodeId] = None
118
+
119
+ def to_json(self) -> T_JSON_DICT:
120
+ json: T_JSON_DICT = dict()
121
+ json['axis'] = self.axis.to_json()
122
+ if self.source_node_id is not None:
123
+ json['sourceNodeId'] = self.source_node_id.to_json()
124
+ if self.start_offset is not None:
125
+ json['startOffset'] = self.start_offset
126
+ if self.end_offset is not None:
127
+ json['endOffset'] = self.end_offset
128
+ if self.subject_node_id is not None:
129
+ json['subjectNodeId'] = self.subject_node_id.to_json()
130
+ return json
131
+
132
+ @classmethod
133
+ def from_json(cls, json: T_JSON_DICT) -> ViewOrScrollTimeline:
134
+ return cls(
135
+ axis=dom.ScrollOrientation.from_json(json['axis']),
136
+ source_node_id=dom.BackendNodeId.from_json(json['sourceNodeId']) if json.get('sourceNodeId', None) is not None else None,
137
+ start_offset=float(json['startOffset']) if json.get('startOffset', None) is not None else None,
138
+ end_offset=float(json['endOffset']) if json.get('endOffset', None) is not None else None,
139
+ subject_node_id=dom.BackendNodeId.from_json(json['subjectNodeId']) if json.get('subjectNodeId', None) is not None else None,
140
+ )
141
+
142
+
143
+ @dataclass
144
+ class AnimationEffect:
145
+ '''
146
+ AnimationEffect instance
147
+ '''
148
+ #: ``AnimationEffect``'s delay.
149
+ delay: float
150
+
151
+ #: ``AnimationEffect``'s end delay.
152
+ end_delay: float
153
+
154
+ #: ``AnimationEffect``'s iteration start.
155
+ iteration_start: float
156
+
157
+ #: ``AnimationEffect``'s iteration duration.
158
+ #: Milliseconds for time based animations and
159
+ #: percentage [0 - 100] for scroll driven animations
160
+ #: (i.e. when viewOrScrollTimeline exists).
161
+ duration: float
162
+
163
+ #: ``AnimationEffect``'s playback direction.
164
+ direction: str
165
+
166
+ #: ``AnimationEffect``'s fill mode.
167
+ fill: str
168
+
169
+ #: ``AnimationEffect``'s timing function.
170
+ easing: str
171
+
172
+ #: ``AnimationEffect``'s iterations. Omitted if the value is infinite.
173
+ iterations: typing.Optional[float] = None
174
+
175
+ #: ``AnimationEffect``'s target node.
176
+ backend_node_id: typing.Optional[dom.BackendNodeId] = None
177
+
178
+ #: ``AnimationEffect``'s keyframes.
179
+ keyframes_rule: typing.Optional[KeyframesRule] = None
180
+
181
+ def to_json(self) -> T_JSON_DICT:
182
+ json: T_JSON_DICT = dict()
183
+ json['delay'] = self.delay
184
+ json['endDelay'] = self.end_delay
185
+ json['iterationStart'] = self.iteration_start
186
+ json['duration'] = self.duration
187
+ json['direction'] = self.direction
188
+ json['fill'] = self.fill
189
+ json['easing'] = self.easing
190
+ if self.iterations is not None:
191
+ json['iterations'] = self.iterations
192
+ if self.backend_node_id is not None:
193
+ json['backendNodeId'] = self.backend_node_id.to_json()
194
+ if self.keyframes_rule is not None:
195
+ json['keyframesRule'] = self.keyframes_rule.to_json()
196
+ return json
197
+
198
+ @classmethod
199
+ def from_json(cls, json: T_JSON_DICT) -> AnimationEffect:
200
+ return cls(
201
+ delay=float(json['delay']),
202
+ end_delay=float(json['endDelay']),
203
+ iteration_start=float(json['iterationStart']),
204
+ duration=float(json['duration']),
205
+ direction=str(json['direction']),
206
+ fill=str(json['fill']),
207
+ easing=str(json['easing']),
208
+ iterations=float(json['iterations']) if json.get('iterations', None) is not None else None,
209
+ backend_node_id=dom.BackendNodeId.from_json(json['backendNodeId']) if json.get('backendNodeId', None) is not None else None,
210
+ keyframes_rule=KeyframesRule.from_json(json['keyframesRule']) if json.get('keyframesRule', None) is not None else None,
211
+ )
212
+
213
+
214
+ @dataclass
215
+ class KeyframesRule:
216
+ '''
217
+ Keyframes Rule
218
+ '''
219
+ #: List of animation keyframes.
220
+ keyframes: typing.List[KeyframeStyle]
221
+
222
+ #: CSS keyframed animation's name.
223
+ name: typing.Optional[str] = None
224
+
225
+ def to_json(self) -> T_JSON_DICT:
226
+ json: T_JSON_DICT = dict()
227
+ json['keyframes'] = [i.to_json() for i in self.keyframes]
228
+ if self.name is not None:
229
+ json['name'] = self.name
230
+ return json
231
+
232
+ @classmethod
233
+ def from_json(cls, json: T_JSON_DICT) -> KeyframesRule:
234
+ return cls(
235
+ keyframes=[KeyframeStyle.from_json(i) for i in json['keyframes']],
236
+ name=str(json['name']) if json.get('name', None) is not None else None,
237
+ )
238
+
239
+
240
+ @dataclass
241
+ class KeyframeStyle:
242
+ '''
243
+ Keyframe Style
244
+ '''
245
+ #: Keyframe's time offset.
246
+ offset: str
247
+
248
+ #: ``AnimationEffect``'s timing function.
249
+ easing: str
250
+
251
+ def to_json(self) -> T_JSON_DICT:
252
+ json: T_JSON_DICT = dict()
253
+ json['offset'] = self.offset
254
+ json['easing'] = self.easing
255
+ return json
256
+
257
+ @classmethod
258
+ def from_json(cls, json: T_JSON_DICT) -> KeyframeStyle:
259
+ return cls(
260
+ offset=str(json['offset']),
261
+ easing=str(json['easing']),
262
+ )
263
+
264
+
265
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
266
+ '''
267
+ Disables animation domain notifications.
268
+ '''
269
+ cmd_dict: T_JSON_DICT = {
270
+ 'method': 'Animation.disable',
271
+ }
272
+ json = yield cmd_dict
273
+
274
+
275
+ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
276
+ '''
277
+ Enables animation domain notifications.
278
+ '''
279
+ cmd_dict: T_JSON_DICT = {
280
+ 'method': 'Animation.enable',
281
+ }
282
+ json = yield cmd_dict
283
+
284
+
285
+ def get_current_time(
286
+ id_: str
287
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]:
288
+ '''
289
+ Returns the current time of the an animation.
290
+
291
+ :param id_: Id of animation.
292
+ :returns: Current time of the page.
293
+ '''
294
+ params: T_JSON_DICT = dict()
295
+ params['id'] = id_
296
+ cmd_dict: T_JSON_DICT = {
297
+ 'method': 'Animation.getCurrentTime',
298
+ 'params': params,
299
+ }
300
+ json = yield cmd_dict
301
+ return float(json['currentTime'])
302
+
303
+
304
+ def get_playback_rate() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]:
305
+ '''
306
+ Gets the playback rate of the document timeline.
307
+
308
+ :returns: Playback rate for animations on page.
309
+ '''
310
+ cmd_dict: T_JSON_DICT = {
311
+ 'method': 'Animation.getPlaybackRate',
312
+ }
313
+ json = yield cmd_dict
314
+ return float(json['playbackRate'])
315
+
316
+
317
+ def release_animations(
318
+ animations: typing.List[str]
319
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
320
+ '''
321
+ Releases a set of animations to no longer be manipulated.
322
+
323
+ :param animations: List of animation ids to seek.
324
+ '''
325
+ params: T_JSON_DICT = dict()
326
+ params['animations'] = [i for i in animations]
327
+ cmd_dict: T_JSON_DICT = {
328
+ 'method': 'Animation.releaseAnimations',
329
+ 'params': params,
330
+ }
331
+ json = yield cmd_dict
332
+
333
+
334
+ def resolve_animation(
335
+ animation_id: str
336
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.RemoteObject]:
337
+ '''
338
+ Gets the remote object of the Animation.
339
+
340
+ :param animation_id: Animation id.
341
+ :returns: Corresponding remote object.
342
+ '''
343
+ params: T_JSON_DICT = dict()
344
+ params['animationId'] = animation_id
345
+ cmd_dict: T_JSON_DICT = {
346
+ 'method': 'Animation.resolveAnimation',
347
+ 'params': params,
348
+ }
349
+ json = yield cmd_dict
350
+ return runtime.RemoteObject.from_json(json['remoteObject'])
351
+
352
+
353
+ def seek_animations(
354
+ animations: typing.List[str],
355
+ current_time: float
356
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
357
+ '''
358
+ Seek a set of animations to a particular time within each animation.
359
+
360
+ :param animations: List of animation ids to seek.
361
+ :param current_time: Set the current time of each animation.
362
+ '''
363
+ params: T_JSON_DICT = dict()
364
+ params['animations'] = [i for i in animations]
365
+ params['currentTime'] = current_time
366
+ cmd_dict: T_JSON_DICT = {
367
+ 'method': 'Animation.seekAnimations',
368
+ 'params': params,
369
+ }
370
+ json = yield cmd_dict
371
+
372
+
373
+ def set_paused(
374
+ animations: typing.List[str],
375
+ paused: bool
376
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
377
+ '''
378
+ Sets the paused state of a set of animations.
379
+
380
+ :param animations: Animations to set the pause state of.
381
+ :param paused: Paused state to set to.
382
+ '''
383
+ params: T_JSON_DICT = dict()
384
+ params['animations'] = [i for i in animations]
385
+ params['paused'] = paused
386
+ cmd_dict: T_JSON_DICT = {
387
+ 'method': 'Animation.setPaused',
388
+ 'params': params,
389
+ }
390
+ json = yield cmd_dict
391
+
392
+
393
+ def set_playback_rate(
394
+ playback_rate: float
395
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
396
+ '''
397
+ Sets the playback rate of the document timeline.
398
+
399
+ :param playback_rate: Playback rate for animations on page
400
+ '''
401
+ params: T_JSON_DICT = dict()
402
+ params['playbackRate'] = playback_rate
403
+ cmd_dict: T_JSON_DICT = {
404
+ 'method': 'Animation.setPlaybackRate',
405
+ 'params': params,
406
+ }
407
+ json = yield cmd_dict
408
+
409
+
410
+ def set_timing(
411
+ animation_id: str,
412
+ duration: float,
413
+ delay: float
414
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
415
+ '''
416
+ Sets the timing of an animation node.
417
+
418
+ :param animation_id: Animation id.
419
+ :param duration: Duration of the animation.
420
+ :param delay: Delay of the animation.
421
+ '''
422
+ params: T_JSON_DICT = dict()
423
+ params['animationId'] = animation_id
424
+ params['duration'] = duration
425
+ params['delay'] = delay
426
+ cmd_dict: T_JSON_DICT = {
427
+ 'method': 'Animation.setTiming',
428
+ 'params': params,
429
+ }
430
+ json = yield cmd_dict
431
+
432
+
433
+ @event_class('Animation.animationCanceled')
434
+ @dataclass
435
+ class AnimationCanceled:
436
+ '''
437
+ Event for when an animation has been cancelled.
438
+ '''
439
+ #: Id of the animation that was cancelled.
440
+ id_: str
441
+
442
+ @classmethod
443
+ def from_json(cls, json: T_JSON_DICT) -> AnimationCanceled:
444
+ return cls(
445
+ id_=str(json['id'])
446
+ )
447
+
448
+
449
+ @event_class('Animation.animationCreated')
450
+ @dataclass
451
+ class AnimationCreated:
452
+ '''
453
+ Event for each animation that has been created.
454
+ '''
455
+ #: Id of the animation that was created.
456
+ id_: str
457
+
458
+ @classmethod
459
+ def from_json(cls, json: T_JSON_DICT) -> AnimationCreated:
460
+ return cls(
461
+ id_=str(json['id'])
462
+ )
463
+
464
+
465
+ @event_class('Animation.animationStarted')
466
+ @dataclass
467
+ class AnimationStarted:
468
+ '''
469
+ Event for animation that has been started.
470
+ '''
471
+ #: Animation that was started.
472
+ animation: Animation
473
+
474
+ @classmethod
475
+ def from_json(cls, json: T_JSON_DICT) -> AnimationStarted:
476
+ return cls(
477
+ animation=Animation.from_json(json['animation'])
478
+ )
479
+
480
+
481
+ @event_class('Animation.animationUpdated')
482
+ @dataclass
483
+ class AnimationUpdated:
484
+ '''
485
+ Event for animation that has been updated.
486
+ '''
487
+ #: Animation that was updated.
488
+ animation: Animation
489
+
490
+ @classmethod
491
+ def from_json(cls, json: T_JSON_DICT) -> AnimationUpdated:
492
+ return cls(
493
+ animation=Animation.from_json(json['animation'])
494
+ )