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,327 @@
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: SystemInfo (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
+
15
+ @dataclass
16
+ class GPUDevice:
17
+ '''
18
+ Describes a single graphics processor (GPU).
19
+ '''
20
+ #: PCI ID of the GPU vendor, if available; 0 otherwise.
21
+ vendor_id: float
22
+
23
+ #: PCI ID of the GPU device, if available; 0 otherwise.
24
+ device_id: float
25
+
26
+ #: String description of the GPU vendor, if the PCI ID is not available.
27
+ vendor_string: str
28
+
29
+ #: String description of the GPU device, if the PCI ID is not available.
30
+ device_string: str
31
+
32
+ #: String description of the GPU driver vendor.
33
+ driver_vendor: str
34
+
35
+ #: String description of the GPU driver version.
36
+ driver_version: str
37
+
38
+ #: Sub sys ID of the GPU, only available on Windows.
39
+ sub_sys_id: typing.Optional[float] = None
40
+
41
+ #: Revision of the GPU, only available on Windows.
42
+ revision: typing.Optional[float] = None
43
+
44
+ def to_json(self) -> T_JSON_DICT:
45
+ json: T_JSON_DICT = dict()
46
+ json['vendorId'] = self.vendor_id
47
+ json['deviceId'] = self.device_id
48
+ json['vendorString'] = self.vendor_string
49
+ json['deviceString'] = self.device_string
50
+ json['driverVendor'] = self.driver_vendor
51
+ json['driverVersion'] = self.driver_version
52
+ if self.sub_sys_id is not None:
53
+ json['subSysId'] = self.sub_sys_id
54
+ if self.revision is not None:
55
+ json['revision'] = self.revision
56
+ return json
57
+
58
+ @classmethod
59
+ def from_json(cls, json: T_JSON_DICT) -> GPUDevice:
60
+ return cls(
61
+ vendor_id=float(json['vendorId']),
62
+ device_id=float(json['deviceId']),
63
+ vendor_string=str(json['vendorString']),
64
+ device_string=str(json['deviceString']),
65
+ driver_vendor=str(json['driverVendor']),
66
+ driver_version=str(json['driverVersion']),
67
+ sub_sys_id=float(json['subSysId']) if json.get('subSysId', None) is not None else None,
68
+ revision=float(json['revision']) if json.get('revision', None) is not None else None,
69
+ )
70
+
71
+
72
+ @dataclass
73
+ class Size:
74
+ '''
75
+ Describes the width and height dimensions of an entity.
76
+ '''
77
+ #: Width in pixels.
78
+ width: int
79
+
80
+ #: Height in pixels.
81
+ height: int
82
+
83
+ def to_json(self) -> T_JSON_DICT:
84
+ json: T_JSON_DICT = dict()
85
+ json['width'] = self.width
86
+ json['height'] = self.height
87
+ return json
88
+
89
+ @classmethod
90
+ def from_json(cls, json: T_JSON_DICT) -> Size:
91
+ return cls(
92
+ width=int(json['width']),
93
+ height=int(json['height']),
94
+ )
95
+
96
+
97
+ @dataclass
98
+ class VideoDecodeAcceleratorCapability:
99
+ '''
100
+ Describes a supported video decoding profile with its associated minimum and
101
+ maximum resolutions.
102
+ '''
103
+ #: Video codec profile that is supported, e.g. VP9 Profile 2.
104
+ profile: str
105
+
106
+ #: Maximum video dimensions in pixels supported for this ``profile``.
107
+ max_resolution: Size
108
+
109
+ #: Minimum video dimensions in pixels supported for this ``profile``.
110
+ min_resolution: Size
111
+
112
+ def to_json(self) -> T_JSON_DICT:
113
+ json: T_JSON_DICT = dict()
114
+ json['profile'] = self.profile
115
+ json['maxResolution'] = self.max_resolution.to_json()
116
+ json['minResolution'] = self.min_resolution.to_json()
117
+ return json
118
+
119
+ @classmethod
120
+ def from_json(cls, json: T_JSON_DICT) -> VideoDecodeAcceleratorCapability:
121
+ return cls(
122
+ profile=str(json['profile']),
123
+ max_resolution=Size.from_json(json['maxResolution']),
124
+ min_resolution=Size.from_json(json['minResolution']),
125
+ )
126
+
127
+
128
+ @dataclass
129
+ class VideoEncodeAcceleratorCapability:
130
+ '''
131
+ Describes a supported video encoding profile with its associated maximum
132
+ resolution and maximum framerate.
133
+ '''
134
+ #: Video codec profile that is supported, e.g H264 Main.
135
+ profile: str
136
+
137
+ #: Maximum video dimensions in pixels supported for this ``profile``.
138
+ max_resolution: Size
139
+
140
+ #: Maximum encoding framerate in frames per second supported for this
141
+ #: ``profile``, as fraction's numerator and denominator, e.g. 24/1 fps,
142
+ #: 24000/1001 fps, etc.
143
+ max_framerate_numerator: int
144
+
145
+ max_framerate_denominator: int
146
+
147
+ def to_json(self) -> T_JSON_DICT:
148
+ json: T_JSON_DICT = dict()
149
+ json['profile'] = self.profile
150
+ json['maxResolution'] = self.max_resolution.to_json()
151
+ json['maxFramerateNumerator'] = self.max_framerate_numerator
152
+ json['maxFramerateDenominator'] = self.max_framerate_denominator
153
+ return json
154
+
155
+ @classmethod
156
+ def from_json(cls, json: T_JSON_DICT) -> VideoEncodeAcceleratorCapability:
157
+ return cls(
158
+ profile=str(json['profile']),
159
+ max_resolution=Size.from_json(json['maxResolution']),
160
+ max_framerate_numerator=int(json['maxFramerateNumerator']),
161
+ max_framerate_denominator=int(json['maxFramerateDenominator']),
162
+ )
163
+
164
+
165
+ class SubsamplingFormat(enum.Enum):
166
+ '''
167
+ YUV subsampling type of the pixels of a given image.
168
+ '''
169
+ YUV420 = "yuv420"
170
+ YUV422 = "yuv422"
171
+ YUV444 = "yuv444"
172
+
173
+ def to_json(self) -> str:
174
+ return self.value
175
+
176
+ @classmethod
177
+ def from_json(cls, json: str) -> SubsamplingFormat:
178
+ return cls(json)
179
+
180
+
181
+ class ImageType(enum.Enum):
182
+ '''
183
+ Image format of a given image.
184
+ '''
185
+ JPEG = "jpeg"
186
+ WEBP = "webp"
187
+ UNKNOWN = "unknown"
188
+
189
+ def to_json(self) -> str:
190
+ return self.value
191
+
192
+ @classmethod
193
+ def from_json(cls, json: str) -> ImageType:
194
+ return cls(json)
195
+
196
+
197
+ @dataclass
198
+ class GPUInfo:
199
+ '''
200
+ Provides information about the GPU(s) on the system.
201
+ '''
202
+ #: The graphics devices on the system. Element 0 is the primary GPU.
203
+ devices: typing.List[GPUDevice]
204
+
205
+ #: An optional array of GPU driver bug workarounds.
206
+ driver_bug_workarounds: typing.List[str]
207
+
208
+ #: Supported accelerated video decoding capabilities.
209
+ video_decoding: typing.List[VideoDecodeAcceleratorCapability]
210
+
211
+ #: Supported accelerated video encoding capabilities.
212
+ video_encoding: typing.List[VideoEncodeAcceleratorCapability]
213
+
214
+ #: An optional dictionary of additional GPU related attributes.
215
+ aux_attributes: typing.Optional[dict] = None
216
+
217
+ #: An optional dictionary of graphics features and their status.
218
+ feature_status: typing.Optional[dict] = None
219
+
220
+ def to_json(self) -> T_JSON_DICT:
221
+ json: T_JSON_DICT = dict()
222
+ json['devices'] = [i.to_json() for i in self.devices]
223
+ json['driverBugWorkarounds'] = [i for i in self.driver_bug_workarounds]
224
+ json['videoDecoding'] = [i.to_json() for i in self.video_decoding]
225
+ json['videoEncoding'] = [i.to_json() for i in self.video_encoding]
226
+ if self.aux_attributes is not None:
227
+ json['auxAttributes'] = self.aux_attributes
228
+ if self.feature_status is not None:
229
+ json['featureStatus'] = self.feature_status
230
+ return json
231
+
232
+ @classmethod
233
+ def from_json(cls, json: T_JSON_DICT) -> GPUInfo:
234
+ return cls(
235
+ devices=[GPUDevice.from_json(i) for i in json['devices']],
236
+ driver_bug_workarounds=[str(i) for i in json['driverBugWorkarounds']],
237
+ video_decoding=[VideoDecodeAcceleratorCapability.from_json(i) for i in json['videoDecoding']],
238
+ video_encoding=[VideoEncodeAcceleratorCapability.from_json(i) for i in json['videoEncoding']],
239
+ aux_attributes=dict(json['auxAttributes']) if json.get('auxAttributes', None) is not None else None,
240
+ feature_status=dict(json['featureStatus']) if json.get('featureStatus', None) is not None else None,
241
+ )
242
+
243
+
244
+ @dataclass
245
+ class ProcessInfo:
246
+ '''
247
+ Represents process info.
248
+ '''
249
+ #: Specifies process type.
250
+ type_: str
251
+
252
+ #: Specifies process id.
253
+ id_: int
254
+
255
+ #: Specifies cumulative CPU usage in seconds across all threads of the
256
+ #: process since the process start.
257
+ cpu_time: float
258
+
259
+ def to_json(self) -> T_JSON_DICT:
260
+ json: T_JSON_DICT = dict()
261
+ json['type'] = self.type_
262
+ json['id'] = self.id_
263
+ json['cpuTime'] = self.cpu_time
264
+ return json
265
+
266
+ @classmethod
267
+ def from_json(cls, json: T_JSON_DICT) -> ProcessInfo:
268
+ return cls(
269
+ type_=str(json['type']),
270
+ id_=int(json['id']),
271
+ cpu_time=float(json['cpuTime']),
272
+ )
273
+
274
+
275
+ def get_info() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[GPUInfo, str, str, str]]:
276
+ '''
277
+ Returns information about the system.
278
+
279
+ :returns: A tuple with the following items:
280
+
281
+ 0. **gpu** - Information about the GPUs on the system.
282
+ 1. **modelName** - A platform-dependent description of the model of the machine. On Mac OS, this is, for example, 'MacBookPro'. Will be the empty string if not supported.
283
+ 2. **modelVersion** - A platform-dependent description of the version of the machine. On Mac OS, this is, for example, '10.1'. Will be the empty string if not supported.
284
+ 3. **commandLine** - The command line string used to launch the browser. Will be the empty string if not supported.
285
+ '''
286
+ cmd_dict: T_JSON_DICT = {
287
+ 'method': 'SystemInfo.getInfo',
288
+ }
289
+ json = yield cmd_dict
290
+ return (
291
+ GPUInfo.from_json(json['gpu']),
292
+ str(json['modelName']),
293
+ str(json['modelVersion']),
294
+ str(json['commandLine'])
295
+ )
296
+
297
+
298
+ def get_feature_state(
299
+ feature_state: str
300
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]:
301
+ '''
302
+ Returns information about the feature state.
303
+
304
+ :param feature_state:
305
+ :returns:
306
+ '''
307
+ params: T_JSON_DICT = dict()
308
+ params['featureState'] = feature_state
309
+ cmd_dict: T_JSON_DICT = {
310
+ 'method': 'SystemInfo.getFeatureState',
311
+ 'params': params,
312
+ }
313
+ json = yield cmd_dict
314
+ return bool(json['featureEnabled'])
315
+
316
+
317
+ def get_process_info() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[ProcessInfo]]:
318
+ '''
319
+ Returns information about all running processes.
320
+
321
+ :returns: An array of process info blocks.
322
+ '''
323
+ cmd_dict: T_JSON_DICT = {
324
+ 'method': 'SystemInfo.getProcessInfo',
325
+ }
326
+ json = yield cmd_dict
327
+ return [ProcessInfo.from_json(i) for i in json['processInfo']]