Skip to content

Commit 5462469

Browse files
committed
Adding generation of deprecation warnings/docs.
1 parent 6473298 commit 5462469

8 files changed

Lines changed: 112 additions & 5 deletions

File tree

cdp/dom_snapshot.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from . import dom
1717
from . import dom_debugger
1818
from . import page
19+
from deprecated.sphinx import deprecated
1920

2021

2122
@dataclass
@@ -738,13 +739,16 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
738739
json = yield cmd_dict
739740

740741

742+
@deprecated(version="1.3")
741743
def get_snapshot(
742744
computed_style_whitelist: typing.List[str],
743745
include_event_listeners: typing.Optional[bool] = None,
744746
include_paint_order: typing.Optional[bool] = None,
745747
include_user_agent_shadow_tree: typing.Optional[bool] = None
746748
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List['DOMNode'], typing.List['LayoutTreeNode'], typing.List['ComputedStyle']]]:
747749
'''
750+
.. deprecated:: 1.3
751+
748752
Returns a document snapshot, including the full DOM tree of the root node (including iframes,
749753
template contents, and imported documents) in a flattened array, as well as layout and
750754
white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is

cdp/emulation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from . import dom
1717
from . import network
1818
from . import page
19+
from deprecated.sphinx import deprecated
1920

2021

2122
@dataclass
@@ -311,10 +312,13 @@ def set_geolocation_override(
311312
json = yield cmd_dict
312313

313314

315+
@deprecated(version="1.3")
314316
def set_navigator_overrides(
315317
platform: str
316318
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
317319
'''
320+
.. deprecated:: 1.3
321+
318322
Overrides value returned by the javascript navigator object.
319323
320324
:param platform: The platform navigator.platform should return.
@@ -436,11 +440,14 @@ def set_timezone_override(
436440
json = yield cmd_dict
437441

438442

443+
@deprecated(version="1.3")
439444
def set_visible_size(
440445
width: int,
441446
height: int
442447
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
443448
'''
449+
.. deprecated:: 1.3
450+
444451
Resizes the frame/viewport of the page. Note that this does not affect the frame's container
445452
(e.g. browser window). Can be used to produce screenshots of the specified size. Not supported
446453
on Android.

cdp/network.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from . import page
1919
from . import runtime
2020
from . import security
21+
from deprecated.sphinx import deprecated
2122

2223

2324
class ResourceType(enum.Enum):
@@ -1423,8 +1424,11 @@ def from_json(cls, json: T_JSON_DICT) -> 'SignedExchangeInfo':
14231424
)
14241425

14251426

1427+
@deprecated(version="1.3")
14261428
def can_clear_browser_cache() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]:
14271429
'''
1430+
.. deprecated:: 1.3
1431+
14281432
Tells whether clearing browser cache is supported.
14291433
14301434
:returns: True if browser cache can be cleared.
@@ -1436,8 +1440,11 @@ def can_clear_browser_cache() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]:
14361440
return bool(json['result'])
14371441

14381442

1443+
@deprecated(version="1.3")
14391444
def can_clear_browser_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]:
14401445
'''
1446+
.. deprecated:: 1.3
1447+
14411448
Tells whether clearing browser cookies is supported.
14421449
14431450
:returns: True if browser cookies can be cleared.
@@ -1449,8 +1456,11 @@ def can_clear_browser_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool
14491456
return bool(json['result'])
14501457

14511458

1459+
@deprecated(version="1.3")
14521460
def can_emulate_network_conditions() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]:
14531461
'''
1462+
.. deprecated:: 1.3
1463+
14541464
Tells whether emulation of network conditions is supported.
14551465
14561466
:returns: True if emulation of network conditions is supported.
@@ -1482,6 +1492,7 @@ def clear_browser_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
14821492
json = yield cmd_dict
14831493

14841494

1495+
@deprecated(version="1.3")
14851496
def continue_intercepted_request(
14861497
interception_id: 'InterceptionId',
14871498
error_reason: typing.Optional['ErrorReason'] = None,
@@ -1493,6 +1504,8 @@ def continue_intercepted_request(
14931504
auth_challenge_response: typing.Optional['AuthChallengeResponse'] = None
14941505
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
14951506
'''
1507+
.. deprecated:: 1.3
1508+
14961509
Response to Network.requestIntercepted which either modifies the request to continue with any
14971510
modifications, or blocks it, or completes it with the provided response bytes. If a network
14981511
fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted
@@ -1973,10 +1986,13 @@ def set_extra_http_headers(
19731986
json = yield cmd_dict
19741987

19751988

1989+
@deprecated(version="1.3")
19761990
def set_request_interception(
19771991
patterns: typing.List['RequestPattern']
19781992
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
19791993
'''
1994+
.. deprecated:: 1.3
1995+
19801996
Sets the requests to intercept that match the provided patterns and optionally resource types.
19811997
Deprecated, please use Fetch.enable instead.
19821998
@@ -2126,6 +2142,7 @@ def from_json(cls, json: T_JSON_DICT) -> 'LoadingFinished':
21262142
)
21272143

21282144

2145+
@deprecated(version="1.3")
21292146
@event_class('Network.requestIntercepted')
21302147
@dataclass
21312148
class RequestIntercepted:

cdp/page.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from . import io
2020
from . import network
2121
from . import runtime
22+
from deprecated.sphinx import deprecated
2223

2324

2425
class FrameId(str):
@@ -627,10 +628,13 @@ def from_json(cls, json: str) -> 'ClientNavigationReason':
627628
return cls(json)
628629

629630

631+
@deprecated(version="1.3")
630632
def add_script_to_evaluate_on_load(
631633
script_source: str
632634
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,'ScriptIdentifier']:
633635
'''
636+
.. deprecated:: 1.3
637+
634638
Deprecated, please use addScriptToEvaluateOnNewDocument instead.
635639
636640
:param script_source:
@@ -732,8 +736,11 @@ def capture_snapshot(
732736
return str(json['data'])
733737

734738

739+
@deprecated(version="1.3")
735740
def clear_device_metrics_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
736741
'''
742+
.. deprecated:: 1.3
743+
737744
Clears the overriden device metrics.
738745
'''
739746
cmd_dict: T_JSON_DICT = {
@@ -742,8 +749,11 @@ def clear_device_metrics_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,
742749
json = yield cmd_dict
743750

744751

752+
@deprecated(version="1.3")
745753
def clear_device_orientation_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
746754
'''
755+
.. deprecated:: 1.3
756+
747757
Clears the overridden Device Orientation.
748758
'''
749759
cmd_dict: T_JSON_DICT = {
@@ -752,8 +762,11 @@ def clear_device_orientation_override() -> typing.Generator[T_JSON_DICT,T_JSON_D
752762
json = yield cmd_dict
753763

754764

765+
@deprecated(version="1.3")
755766
def clear_geolocation_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
756767
'''
768+
.. deprecated:: 1.3
769+
757770
Clears the overriden Geolocation Position and Error.
758771
'''
759772
cmd_dict: T_JSON_DICT = {
@@ -789,11 +802,14 @@ def create_isolated_world(
789802
return runtime.ExecutionContextId.from_json(json['executionContextId'])
790803

791804

805+
@deprecated(version="1.3")
792806
def delete_cookie(
793807
cookie_name: str,
794808
url: str
795809
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
796810
'''
811+
.. deprecated:: 1.3
812+
797813
Deletes browser cookie with given name, domain and path.
798814
799815
:param cookie_name: Name of the cookie to remove.
@@ -862,8 +878,11 @@ def get_installability_errors() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typi
862878
return [str(i) for i in json['errors']]
863879

864880

881+
@deprecated(version="1.3")
865882
def get_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List['network.Cookie']]:
866883
'''
884+
.. deprecated:: 1.3
885+
867886
Returns all browser cookies. Depending on the backend support, will return detailed cookie
868887
information in the `cookies` field.
869888
@@ -1160,10 +1179,13 @@ def reload(
11601179
json = yield cmd_dict
11611180

11621181

1182+
@deprecated(version="1.3")
11631183
def remove_script_to_evaluate_on_load(
11641184
identifier: 'ScriptIdentifier'
11651185
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
11661186
'''
1187+
.. deprecated:: 1.3
1188+
11671189
Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
11681190
11691191
:param identifier:
@@ -1278,6 +1300,7 @@ def set_bypass_csp(
12781300
json = yield cmd_dict
12791301

12801302

1303+
@deprecated(version="1.3")
12811304
def set_device_metrics_override(
12821305
width: int,
12831306
height: int,
@@ -1293,6 +1316,8 @@ def set_device_metrics_override(
12931316
viewport: typing.Optional['Viewport'] = None
12941317
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
12951318
'''
1319+
.. deprecated:: 1.3
1320+
12961321
Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
12971322
window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
12981323
query results).
@@ -1338,12 +1363,15 @@ def set_device_metrics_override(
13381363
json = yield cmd_dict
13391364

13401365

1366+
@deprecated(version="1.3")
13411367
def set_device_orientation_override(
13421368
alpha: float,
13431369
beta: float,
13441370
gamma: float
13451371
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
13461372
'''
1373+
.. deprecated:: 1.3
1374+
13471375
Overrides the Device Orientation.
13481376
13491377
:param alpha: Mock alpha
@@ -1436,12 +1464,15 @@ def set_download_behavior(
14361464
json = yield cmd_dict
14371465

14381466

1467+
@deprecated(version="1.3")
14391468
def set_geolocation_override(
14401469
latitude: typing.Optional[float] = None,
14411470
longitude: typing.Optional[float] = None,
14421471
accuracy: typing.Optional[float] = None
14431472
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
14441473
'''
1474+
.. deprecated:: 1.3
1475+
14451476
Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position
14461477
unavailable.
14471478
@@ -1480,11 +1511,14 @@ def set_lifecycle_events_enabled(
14801511
json = yield cmd_dict
14811512

14821513

1514+
@deprecated(version="1.3")
14831515
def set_touch_emulation_enabled(
14841516
enabled: bool,
14851517
configuration: typing.Optional[str] = None
14861518
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
14871519
'''
1520+
.. deprecated:: 1.3
1521+
14881522
Toggles mouse event-based touch event emulation.
14891523
14901524
:param enabled: Whether the touch event emulation should be enabled.
@@ -1763,6 +1797,7 @@ def from_json(cls, json: T_JSON_DICT) -> 'FrameAttached':
17631797
)
17641798

17651799

1800+
@deprecated(version="1.3")
17661801
@event_class('Page.frameClearedScheduledNavigation')
17671802
@dataclass
17681803
class FrameClearedScheduledNavigation:
@@ -1846,6 +1881,7 @@ def from_json(cls, json: T_JSON_DICT) -> 'FrameRequestedNavigation':
18461881
)
18471882

18481883

1884+
@deprecated(version="1.3")
18491885
@event_class('Page.frameScheduledNavigation')
18501886
@dataclass
18511887
class FrameScheduledNavigation:

cdp/security.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
import typing
1515

1616

17+
from deprecated.sphinx import deprecated
18+
19+
1720
class CertificateId(int):
1821
'''
1922
An internal certificate ID value.
@@ -218,11 +221,14 @@ def set_ignore_certificate_errors(
218221
json = yield cmd_dict
219222

220223

224+
@deprecated(version="1.3")
221225
def handle_certificate_error(
222226
event_id: int,
223227
action: 'CertificateErrorAction'
224228
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
225229
'''
230+
.. deprecated:: 1.3
231+
226232
Handles a certificate error that fired a certificateError event.
227233
228234
:param event_id: The ID of the event.
@@ -238,10 +244,13 @@ def handle_certificate_error(
238244
json = yield cmd_dict
239245

240246

247+
@deprecated(version="1.3")
241248
def set_override_certificate_errors(
242249
override: bool
243250
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
244251
'''
252+
.. deprecated:: 1.3
253+
245254
Enable/disable overriding certificate errors. If enabled, all certificate error events need to
246255
be handled by the DevTools client and should be answered with `handleCertificateError` commands.
247256
@@ -256,6 +265,7 @@ def set_override_certificate_errors(
256265
json = yield cmd_dict
257266

258267

268+
@deprecated(version="1.3")
259269
@event_class('Security.certificateError')
260270
@dataclass
261271
class CertificateError:

0 commit comments

Comments
 (0)