Skip to content

Commit 4478925

Browse files
authored
chore: update pre-commit (microsoft#1750)
1 parent 6939e0f commit 4478925

File tree

11 files changed

+41
-29
lines changed

11 files changed

+41
-29
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
5+
rev: v4.4.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
@@ -15,7 +15,7 @@ repos:
1515
- id: check-executables-have-shebangs
1616
- id: check-merge-conflict
1717
- repo: https://github.com/psf/black
18-
rev: 22.10.0
18+
rev: 23.1.0
1919
hooks:
2020
- id: black
2121
- repo: https://github.com/pre-commit/mirrors-mypy
@@ -28,7 +28,7 @@ repos:
2828
hooks:
2929
- id: flake8
3030
- repo: https://github.com/pycqa/isort
31-
rev: 5.10.1
31+
rev: 5.12.0
3232
hooks:
3333
- id: isort
3434
- repo: local

playwright/_impl/_browser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848

4949

5050
class Browser(ChannelOwner):
51-
5251
Events = SimpleNamespace(
5352
Disconnected="disconnected",
5453
)

playwright/_impl/_browser_context.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373

7474

7575
class BrowserContext(ChannelOwner):
76-
7776
Events = SimpleNamespace(
7877
BackgroundPage="backgroundpage",
7978
Close="close",

playwright/_impl/_network.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ def frame(self) -> "Frame":
545545

546546

547547
class WebSocket(ChannelOwner):
548-
549548
Events = SimpleNamespace(
550549
Close="close",
551550
FrameReceived="framereceived",

playwright/_impl/_page.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102

103103

104104
class Page(ChannelOwner):
105-
106105
Events = SimpleNamespace(
107106
Close="close",
108107
Crash="crash",

playwright/async_api/_generated.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7331,7 +7331,8 @@ def on(
73317331
page.on(\"dialog\", lambda dialog: dialog.accept())
73327332
```
73337333

7334-
**NOTE** When no `page.on('dialog')` listeners are present, all dialogs are automatically dismissed."""
7334+
**NOTE** When no `page.on('dialog')` listeners are present, all dialogs are automatically dismissed.
7335+
"""
73357336

73367337
@typing.overload
73377338
def on(
@@ -7341,7 +7342,8 @@ def on(
73417342
) -> None:
73427343
"""
73437344
Emitted when the JavaScript
7344-
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched."""
7345+
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
7346+
"""
73457347

73467348
@typing.overload
73477349
def on(
@@ -7403,7 +7405,8 @@ def on(
74037405
f: typing.Callable[["Page"], "typing.Union[typing.Awaitable[None], None]"],
74047406
) -> None:
74057407
"""
7406-
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched."""
7408+
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.
7409+
"""
74077410

74087411
@typing.overload
74097412
def on(
@@ -7628,7 +7631,8 @@ def once(
76287631
page.on(\"dialog\", lambda dialog: dialog.accept())
76297632
```
76307633

7631-
**NOTE** When no `page.on('dialog')` listeners are present, all dialogs are automatically dismissed."""
7634+
**NOTE** When no `page.on('dialog')` listeners are present, all dialogs are automatically dismissed.
7635+
"""
76327636

76337637
@typing.overload
76347638
def once(
@@ -7638,7 +7642,8 @@ def once(
76387642
) -> None:
76397643
"""
76407644
Emitted when the JavaScript
7641-
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched."""
7645+
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
7646+
"""
76427647

76437648
@typing.overload
76447649
def once(
@@ -7700,7 +7705,8 @@ def once(
77007705
f: typing.Callable[["Page"], "typing.Union[typing.Awaitable[None], None]"],
77017706
) -> None:
77027707
"""
7703-
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched."""
7708+
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.
7709+
"""
77047710

77057711
@typing.overload
77067712
def once(
@@ -12421,7 +12427,8 @@ def on(
1242112427
Emitted when a request is issued from any pages created through this context. The [request] object is read-only. To
1242212428
only listen for requests from a particular page, use `page.on('request')`.
1242312429

12424-
In order to intercept and mutate requests, see `browser_context.route()` or `page.route()`."""
12430+
In order to intercept and mutate requests, see `browser_context.route()` or `page.route()`.
12431+
"""
1242512432

1242612433
@typing.overload
1242712434
def on(
@@ -12552,7 +12559,8 @@ def once(
1255212559
Emitted when a request is issued from any pages created through this context. The [request] object is read-only. To
1255312560
only listen for requests from a particular page, use `page.on('request')`.
1255412561

12555-
In order to intercept and mutate requests, see `browser_context.route()` or `page.route()`."""
12562+
In order to intercept and mutate requests, see `browser_context.route()` or `page.route()`.
12563+
"""
1255612564

1255712565
@typing.overload
1255812566
def once(
@@ -14847,7 +14855,6 @@ def request(self) -> "APIRequest":
1484714855
return mapping.from_impl(self._impl_obj.request)
1484814856

1484914857
def __getitem__(self, value: str) -> "BrowserType":
14850-
1485114858
return mapping.from_impl(self._impl_obj.__getitem__(value=value))
1485214859

1485314860
def stop(self) -> None:

playwright/sync_api/_context_manager.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import asyncio
1616
import sys
17-
from typing import Any, Optional, cast
17+
from typing import TYPE_CHECKING, Any, Optional, cast
1818

1919
from greenlet import greenlet
2020

@@ -26,13 +26,16 @@
2626
from playwright._impl._transport import PipeTransport
2727
from playwright.sync_api._generated import Playwright as SyncPlaywright
2828

29+
if TYPE_CHECKING:
30+
from asyncio.unix_events import AbstractChildWatcher
31+
2932

3033
class PlaywrightContextManager:
3134
def __init__(self) -> None:
3235
self._playwright: SyncPlaywright
3336
self._loop: asyncio.AbstractEventLoop
3437
self._own_loop = False
35-
self._watcher: Optional[asyncio.AbstractChildWatcher] = None
38+
self._watcher: Optional[AbstractChildWatcher] = None
3639

3740
def __enter__(self) -> SyncPlaywright:
3841
try:

playwright/sync_api/_generated.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7433,15 +7433,17 @@ def on(
74337433
page.on(\"dialog\", lambda dialog: dialog.accept())
74347434
```
74357435

7436-
**NOTE** When no `page.on('dialog')` listeners are present, all dialogs are automatically dismissed."""
7436+
**NOTE** When no `page.on('dialog')` listeners are present, all dialogs are automatically dismissed.
7437+
"""
74377438

74387439
@typing.overload
74397440
def on(
74407441
self, event: Literal["domcontentloaded"], f: typing.Callable[["Page"], "None"]
74417442
) -> None:
74427443
"""
74437444
Emitted when the JavaScript
7444-
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched."""
7445+
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
7446+
"""
74457447

74467448
@typing.overload
74477449
def on(
@@ -7487,7 +7489,8 @@ def on(
74877489
@typing.overload
74887490
def on(self, event: Literal["load"], f: typing.Callable[["Page"], "None"]) -> None:
74897491
"""
7490-
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched."""
7492+
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.
7493+
"""
74917494

74927495
@typing.overload
74937496
def on(
@@ -7680,15 +7683,17 @@ def once(
76807683
page.on(\"dialog\", lambda dialog: dialog.accept())
76817684
```
76827685

7683-
**NOTE** When no `page.on('dialog')` listeners are present, all dialogs are automatically dismissed."""
7686+
**NOTE** When no `page.on('dialog')` listeners are present, all dialogs are automatically dismissed.
7687+
"""
76847688

76857689
@typing.overload
76867690
def once(
76877691
self, event: Literal["domcontentloaded"], f: typing.Callable[["Page"], "None"]
76887692
) -> None:
76897693
"""
76907694
Emitted when the JavaScript
7691-
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched."""
7695+
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
7696+
"""
76927697

76937698
@typing.overload
76947699
def once(
@@ -7736,7 +7741,8 @@ def once(
77367741
self, event: Literal["load"], f: typing.Callable[["Page"], "None"]
77377742
) -> None:
77387743
"""
7739-
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched."""
7744+
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.
7745+
"""
77407746

77417747
@typing.overload
77427748
def once(
@@ -12515,7 +12521,8 @@ def on(
1251512521
Emitted when a request is issued from any pages created through this context. The [request] object is read-only. To
1251612522
only listen for requests from a particular page, use `page.on('request')`.
1251712523

12518-
In order to intercept and mutate requests, see `browser_context.route()` or `page.route()`."""
12524+
In order to intercept and mutate requests, see `browser_context.route()` or `page.route()`.
12525+
"""
1251912526

1252012527
@typing.overload
1252112528
def on(
@@ -12624,7 +12631,8 @@ def once(
1262412631
Emitted when a request is issued from any pages created through this context. The [request] object is read-only. To
1262512632
only listen for requests from a particular page, use `page.on('request')`.
1262612633

12627-
In order to intercept and mutate requests, see `browser_context.route()` or `page.route()`."""
12634+
In order to intercept and mutate requests, see `browser_context.route()` or `page.route()`.
12635+
"""
1262812636

1262912637
@typing.overload
1263012638
def once(
@@ -14931,7 +14939,6 @@ def request(self) -> "APIRequest":
1493114939
return mapping.from_impl(self._impl_obj.request)
1493214940

1493314941
def __getitem__(self, value: str) -> "BrowserType":
14934-
1493514942
return mapping.from_impl(self._impl_obj.__getitem__(value=value))
1493614943

1493714944
def stop(self) -> None:

scripts/generate_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def return_value(value: Any) -> List[str]:
289289
api_globals = globals()
290290
assert Serializable
291291

292+
292293
# Python 3.11+ does not treat default args with None as Optional anymore, this wrapper will still wrap them.
293294
# https://github.com/python/cpython/issues/90353
294295
def get_type_hints(func: Any, globalns: Any) -> Dict[str, Any]:

tests/async/test_har.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ async def test_should_fulfill_from_har_with_content_in_a_file(
486486
async def test_should_round_trip_har_zip(
487487
browser: Browser, server: Server, assetdir: Path, tmpdir: Path
488488
) -> None:
489-
490489
har_path = tmpdir / "har.zip"
491490
context_1 = await browser.new_context(
492491
record_har_mode="minimal", record_har_path=har_path

tests/sync/test_har.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ def test_should_fulfill_from_har_with_content_in_a_file(
425425
def test_should_round_trip_har_zip(
426426
browser: Browser, server: Server, assetdir: Path, tmpdir: Path
427427
) -> None:
428-
429428
har_path = tmpdir / "har.zip"
430429
context_1 = browser.new_context(record_har_mode="minimal", record_har_path=har_path)
431430
page_1 = context_1.new_page()

0 commit comments

Comments
 (0)