From 1e8535391152d648fc97cb81021ded23c94905dc Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 9 Sep 2025 10:46:49 +0200 Subject: [PATCH] chore: fix api generation under Python 3.13 --- scripts/documentation_provider.py | 3 +++ scripts/generate_api.py | 1 + 2 files changed, 4 insertions(+) diff --git a/scripts/documentation_provider.py b/scripts/documentation_provider.py index 6ea931fac..a842a1aad 100644 --- a/scripts/documentation_provider.py +++ b/scripts/documentation_provider.py @@ -13,6 +13,7 @@ # limitations under the License. import json +import pathlib import re import subprocess from sys import stderr @@ -359,6 +360,8 @@ def serialize_python_type(self, value: Any, direction: str) -> str: match = re.match(r"^$", str_value) if match: return match.group(1) + if str_value == str(pathlib.Path): + return "pathlib.Path" match = re.match( r"playwright._impl._event_context_manager.EventContextManagerImpl\[playwright._impl.[^.]+.(.*)\]", str_value, diff --git a/scripts/generate_api.py b/scripts/generate_api.py index 01f8f525a..b0e7e2a32 100644 --- a/scripts/generate_api.py +++ b/scripts/generate_api.py @@ -57,6 +57,7 @@ def process_type(value: Any, param: bool = False) -> str: value = str(value) + value = re.sub("pathlib._local.Path", "pathlib.Path", value) value = re.sub(r"", r"\1", value) value = re.sub(r"NoneType", "None", value) value = re.sub(r"playwright\._impl\._api_structures.([\w]+)", r"\1", value)