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,124 @@
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: Performance
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
+ from deprecated.sphinx import deprecated # type: ignore
16
+
17
+
18
+ @dataclass
19
+ class Metric:
20
+ '''
21
+ Run-time execution metric.
22
+ '''
23
+ #: Metric name.
24
+ name: str
25
+
26
+ #: Metric value.
27
+ value: float
28
+
29
+ def to_json(self) -> T_JSON_DICT:
30
+ json: T_JSON_DICT = dict()
31
+ json['name'] = self.name
32
+ json['value'] = self.value
33
+ return json
34
+
35
+ @classmethod
36
+ def from_json(cls, json: T_JSON_DICT) -> Metric:
37
+ return cls(
38
+ name=str(json['name']),
39
+ value=float(json['value']),
40
+ )
41
+
42
+
43
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
44
+ '''
45
+ Disable collecting and reporting metrics.
46
+ '''
47
+ cmd_dict: T_JSON_DICT = {
48
+ 'method': 'Performance.disable',
49
+ }
50
+ json = yield cmd_dict
51
+
52
+
53
+ def enable(
54
+ time_domain: typing.Optional[str] = None
55
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
56
+ '''
57
+ Enable collecting and reporting metrics.
58
+
59
+ :param time_domain: *(Optional)* Time domain to use for collecting and reporting duration metrics.
60
+ '''
61
+ params: T_JSON_DICT = dict()
62
+ if time_domain is not None:
63
+ params['timeDomain'] = time_domain
64
+ cmd_dict: T_JSON_DICT = {
65
+ 'method': 'Performance.enable',
66
+ 'params': params,
67
+ }
68
+ json = yield cmd_dict
69
+
70
+
71
+ @deprecated(version="1.3")
72
+ def set_time_domain(
73
+ time_domain: str
74
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
75
+ '''
76
+ Sets time domain to use for collecting and reporting duration metrics.
77
+ Note that this must be called before enabling metrics collection. Calling
78
+ this method while metrics collection is enabled returns an error.
79
+
80
+ .. deprecated:: 1.3
81
+
82
+ **EXPERIMENTAL**
83
+
84
+ :param time_domain: Time domain
85
+ '''
86
+ params: T_JSON_DICT = dict()
87
+ params['timeDomain'] = time_domain
88
+ cmd_dict: T_JSON_DICT = {
89
+ 'method': 'Performance.setTimeDomain',
90
+ 'params': params,
91
+ }
92
+ json = yield cmd_dict
93
+
94
+
95
+ def get_metrics() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Metric]]:
96
+ '''
97
+ Retrieve current values of run-time metrics.
98
+
99
+ :returns: Current values for run-time metrics.
100
+ '''
101
+ cmd_dict: T_JSON_DICT = {
102
+ 'method': 'Performance.getMetrics',
103
+ }
104
+ json = yield cmd_dict
105
+ return [Metric.from_json(i) for i in json['metrics']]
106
+
107
+
108
+ @event_class('Performance.metrics')
109
+ @dataclass
110
+ class Metrics:
111
+ '''
112
+ Current values of the metrics.
113
+ '''
114
+ #: Current values of the metrics.
115
+ metrics: typing.List[Metric]
116
+ #: Timestamp title.
117
+ title: str
118
+
119
+ @classmethod
120
+ def from_json(cls, json: T_JSON_DICT) -> Metrics:
121
+ return cls(
122
+ metrics=[Metric.from_json(i) for i in json['metrics']],
123
+ title=str(json['title'])
124
+ )
@@ -0,0 +1,200 @@
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: PerformanceTimeline (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 network
16
+ from . import page
17
+
18
+
19
+ @dataclass
20
+ class LargestContentfulPaint:
21
+ '''
22
+ See https://github.com/WICG/LargestContentfulPaint and largest_contentful_paint.idl
23
+ '''
24
+ render_time: network.TimeSinceEpoch
25
+
26
+ load_time: network.TimeSinceEpoch
27
+
28
+ #: The number of pixels being painted.
29
+ size: float
30
+
31
+ #: The id attribute of the element, if available.
32
+ element_id: typing.Optional[str] = None
33
+
34
+ #: The URL of the image (may be trimmed).
35
+ url: typing.Optional[str] = None
36
+
37
+ node_id: typing.Optional[dom.BackendNodeId] = None
38
+
39
+ def to_json(self) -> T_JSON_DICT:
40
+ json: T_JSON_DICT = dict()
41
+ json['renderTime'] = self.render_time.to_json()
42
+ json['loadTime'] = self.load_time.to_json()
43
+ json['size'] = self.size
44
+ if self.element_id is not None:
45
+ json['elementId'] = self.element_id
46
+ if self.url is not None:
47
+ json['url'] = self.url
48
+ if self.node_id is not None:
49
+ json['nodeId'] = self.node_id.to_json()
50
+ return json
51
+
52
+ @classmethod
53
+ def from_json(cls, json: T_JSON_DICT) -> LargestContentfulPaint:
54
+ return cls(
55
+ render_time=network.TimeSinceEpoch.from_json(json['renderTime']),
56
+ load_time=network.TimeSinceEpoch.from_json(json['loadTime']),
57
+ size=float(json['size']),
58
+ element_id=str(json['elementId']) if json.get('elementId', None) is not None else None,
59
+ url=str(json['url']) if json.get('url', None) is not None else None,
60
+ node_id=dom.BackendNodeId.from_json(json['nodeId']) if json.get('nodeId', None) is not None else None,
61
+ )
62
+
63
+
64
+ @dataclass
65
+ class LayoutShiftAttribution:
66
+ previous_rect: dom.Rect
67
+
68
+ current_rect: dom.Rect
69
+
70
+ node_id: typing.Optional[dom.BackendNodeId] = None
71
+
72
+ def to_json(self) -> T_JSON_DICT:
73
+ json: T_JSON_DICT = dict()
74
+ json['previousRect'] = self.previous_rect.to_json()
75
+ json['currentRect'] = self.current_rect.to_json()
76
+ if self.node_id is not None:
77
+ json['nodeId'] = self.node_id.to_json()
78
+ return json
79
+
80
+ @classmethod
81
+ def from_json(cls, json: T_JSON_DICT) -> LayoutShiftAttribution:
82
+ return cls(
83
+ previous_rect=dom.Rect.from_json(json['previousRect']),
84
+ current_rect=dom.Rect.from_json(json['currentRect']),
85
+ node_id=dom.BackendNodeId.from_json(json['nodeId']) if json.get('nodeId', None) is not None else None,
86
+ )
87
+
88
+
89
+ @dataclass
90
+ class LayoutShift:
91
+ '''
92
+ See https://wicg.github.io/layout-instability/#sec-layout-shift and layout_shift.idl
93
+ '''
94
+ #: Score increment produced by this event.
95
+ value: float
96
+
97
+ had_recent_input: bool
98
+
99
+ last_input_time: network.TimeSinceEpoch
100
+
101
+ sources: typing.List[LayoutShiftAttribution]
102
+
103
+ def to_json(self) -> T_JSON_DICT:
104
+ json: T_JSON_DICT = dict()
105
+ json['value'] = self.value
106
+ json['hadRecentInput'] = self.had_recent_input
107
+ json['lastInputTime'] = self.last_input_time.to_json()
108
+ json['sources'] = [i.to_json() for i in self.sources]
109
+ return json
110
+
111
+ @classmethod
112
+ def from_json(cls, json: T_JSON_DICT) -> LayoutShift:
113
+ return cls(
114
+ value=float(json['value']),
115
+ had_recent_input=bool(json['hadRecentInput']),
116
+ last_input_time=network.TimeSinceEpoch.from_json(json['lastInputTime']),
117
+ sources=[LayoutShiftAttribution.from_json(i) for i in json['sources']],
118
+ )
119
+
120
+
121
+ @dataclass
122
+ class TimelineEvent:
123
+ #: Identifies the frame that this event is related to. Empty for non-frame targets.
124
+ frame_id: page.FrameId
125
+
126
+ #: The event type, as specified in https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype
127
+ #: This determines which of the optional "details" fields is present.
128
+ type_: str
129
+
130
+ #: Name may be empty depending on the type.
131
+ name: str
132
+
133
+ #: Time in seconds since Epoch, monotonically increasing within document lifetime.
134
+ time: network.TimeSinceEpoch
135
+
136
+ #: Event duration, if applicable.
137
+ duration: typing.Optional[float] = None
138
+
139
+ lcp_details: typing.Optional[LargestContentfulPaint] = None
140
+
141
+ layout_shift_details: typing.Optional[LayoutShift] = None
142
+
143
+ def to_json(self) -> T_JSON_DICT:
144
+ json: T_JSON_DICT = dict()
145
+ json['frameId'] = self.frame_id.to_json()
146
+ json['type'] = self.type_
147
+ json['name'] = self.name
148
+ json['time'] = self.time.to_json()
149
+ if self.duration is not None:
150
+ json['duration'] = self.duration
151
+ if self.lcp_details is not None:
152
+ json['lcpDetails'] = self.lcp_details.to_json()
153
+ if self.layout_shift_details is not None:
154
+ json['layoutShiftDetails'] = self.layout_shift_details.to_json()
155
+ return json
156
+
157
+ @classmethod
158
+ def from_json(cls, json: T_JSON_DICT) -> TimelineEvent:
159
+ return cls(
160
+ frame_id=page.FrameId.from_json(json['frameId']),
161
+ type_=str(json['type']),
162
+ name=str(json['name']),
163
+ time=network.TimeSinceEpoch.from_json(json['time']),
164
+ duration=float(json['duration']) if json.get('duration', None) is not None else None,
165
+ lcp_details=LargestContentfulPaint.from_json(json['lcpDetails']) if json.get('lcpDetails', None) is not None else None,
166
+ layout_shift_details=LayoutShift.from_json(json['layoutShiftDetails']) if json.get('layoutShiftDetails', None) is not None else None,
167
+ )
168
+
169
+
170
+ def enable(
171
+ event_types: typing.List[str]
172
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
173
+ '''
174
+ Previously buffered events would be reported before method returns.
175
+ See also: timelineEventAdded
176
+
177
+ :param event_types: The types of event to report, as specified in https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype The specified filter overrides any previous filters, passing empty filter disables recording. Note that not all types exposed to the web platform are currently supported.
178
+ '''
179
+ params: T_JSON_DICT = dict()
180
+ params['eventTypes'] = [i for i in event_types]
181
+ cmd_dict: T_JSON_DICT = {
182
+ 'method': 'PerformanceTimeline.enable',
183
+ 'params': params,
184
+ }
185
+ json = yield cmd_dict
186
+
187
+
188
+ @event_class('PerformanceTimeline.timelineEventAdded')
189
+ @dataclass
190
+ class TimelineEventAdded:
191
+ '''
192
+ Sent when a performance timeline event is added. See reportPerformanceTimeline method.
193
+ '''
194
+ event: TimelineEvent
195
+
196
+ @classmethod
197
+ def from_json(cls, json: T_JSON_DICT) -> TimelineEventAdded:
198
+ return cls(
199
+ event=TimelineEvent.from_json(json['event'])
200
+ )