From 00cf631bc70386429e26ac9117495865193ecf85 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 22 Jul 2025 11:58:33 +0200 Subject: [PATCH] chore: update pre-commit / linters --- .pre-commit-config.yaml | 12 ++++++------ local-requirements.txt | 2 +- playwright/_impl/_clock.py | 2 +- playwright/_impl/_set_input_files_helpers.py | 2 +- tests/async/test_page.py | 3 +-- tests/async/test_page_add_locator_handler.py | 1 - tests/async/test_worker.py | 2 +- tests/common/test_signals.py | 1 - tests/sync/test_page_add_locator_handler.py | 1 - 9 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c8c8f1db..57fdca816 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,20 +15,20 @@ repos: - id: check-executables-have-shebangs - id: check-merge-conflict - repo: https://github.com/psf/black - rev: 24.8.0 + rev: 25.1.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.2 + rev: v1.17.0 hooks: - id: mypy - additional_dependencies: [types-pyOpenSSL==24.1.0.20240722, types-requests==2.32.0.20240914] + additional_dependencies: [types-pyOpenSSL==24.1.0.20240722, types-requests==2.32.4.20250611] - repo: https://github.com/pycqa/flake8 - rev: 7.1.1 + rev: 7.3.0 hooks: - id: flake8 - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 6.0.1 hooks: - id: isort - repo: local @@ -39,7 +39,7 @@ repos: language: node pass_filenames: false types: [python] - additional_dependencies: ["pyright@1.1.384"] + additional_dependencies: ["pyright@1.1.403"] - repo: local hooks: - id: check-license-header diff --git a/local-requirements.txt b/local-requirements.txt index e19488956..28f60ba65 100644 --- a/local-requirements.txt +++ b/local-requirements.txt @@ -2,7 +2,7 @@ autobahn==23.1.2 black==25.1.0 build==1.2.2.post1 flake8==7.2.0 -mypy==1.16.0 +mypy==1.17.0 objgraph==3.6.2 Pillow==11.2.1 pixelmatch==0.3.0 diff --git a/playwright/_impl/_clock.py b/playwright/_impl/_clock.py index 928536019..f6eb7c42d 100644 --- a/playwright/_impl/_clock.py +++ b/playwright/_impl/_clock.py @@ -89,7 +89,7 @@ async def set_system_time( def parse_time( - time: Union[float, str, datetime.datetime] + time: Union[float, str, datetime.datetime], ) -> Dict[str, Union[int, str]]: if isinstance(time, (float, int)): return {"timeNumber": int(time * 1_000)} diff --git a/playwright/_impl/_set_input_files_helpers.py b/playwright/_impl/_set_input_files_helpers.py index f868886a3..0f40d5b99 100644 --- a/playwright/_impl/_set_input_files_helpers.py +++ b/playwright/_impl/_set_input_files_helpers.py @@ -139,7 +139,7 @@ async def convert_input_files( def resolve_paths_and_directory_for_input_files( - items: Sequence[Union[str, Path]] + items: Sequence[Union[str, Path]], ) -> Tuple[Optional[List[str]], Optional[str]]: local_paths: Optional[List[str]] = None local_directory: Optional[str] = None diff --git a/tests/async/test_page.py b/tests/async/test_page.py index 03907c4b9..607c86fb3 100644 --- a/tests/async/test_page.py +++ b/tests/async/test_page.py @@ -662,7 +662,7 @@ async def load() -> None: async def test_set_content_should_work_with_tricky_content(page: Page) -> None: - await page.set_content("
hello world
" + "\x7F") + await page.set_content("
hello world
" + "\x7f") assert await page.eval_on_selector("div", "div => div.textContent") == "hello world" @@ -1403,7 +1403,6 @@ async def test_should_not_throw_when_continuing_after_page_is_closed( async def handle_route(route: Route) -> None: await page.close() await route.continue_() - nonlocal done done.set_result(True) await page.route("**/*", handle_route) diff --git a/tests/async/test_page_add_locator_handler.py b/tests/async/test_page_add_locator_handler.py index 4a5a44323..5f44170f8 100644 --- a/tests/async/test_page_add_locator_handler.py +++ b/tests/async/test_page_add_locator_handler.py @@ -30,7 +30,6 @@ async def test_should_work(page: Page, server: Server) -> None: original_locator = page.get_by_text("This interstitial covers the button") async def handler(locator: Locator) -> None: - nonlocal original_locator assert locator == original_locator nonlocal before_count nonlocal after_count diff --git a/tests/async/test_worker.py b/tests/async/test_worker.py index de1a858e8..bba22fc0d 100644 --- a/tests/async/test_worker.py +++ b/tests/async/test_worker.py @@ -199,5 +199,5 @@ async def test_workers_should_format_number_using_context_locale( "() => new Worker(URL.createObjectURL(new Blob(['console.log(1)'], {type: 'application/javascript'})))" ) worker = await worker_info.value - assert await worker.evaluate("() => (10000.20).toLocaleString()") == "10\u00A0000,2" + assert await worker.evaluate("() => (10000.20).toLocaleString()") == "10\u00a0000,2" await context.close() diff --git a/tests/common/test_signals.py b/tests/common/test_signals.py index 174eaf6f2..ba600b44d 100644 --- a/tests/common/test_signals.py +++ b/tests/common/test_signals.py @@ -50,7 +50,6 @@ async def main() -> None: page = await context.new_page() notified = False try: - nonlocal sigint_received while not sigint_received: if not notified: wait_queue.put("ready") diff --git a/tests/sync/test_page_add_locator_handler.py b/tests/sync/test_page_add_locator_handler.py index b2d037f07..7a2b6a438 100644 --- a/tests/sync/test_page_add_locator_handler.py +++ b/tests/sync/test_page_add_locator_handler.py @@ -29,7 +29,6 @@ def test_should_work(page: Page, server: Server) -> None: original_locator = page.get_by_text("This interstitial covers the button") def handler(locator: Locator) -> None: - nonlocal original_locator assert locator == original_locator nonlocal before_count nonlocal after_count