Skip to content

Commit 6fa9500

Browse files
authored
chore: fix api generation under Python 3.13 (#2970)
1 parent 8ab311b commit 6fa9500

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

scripts/documentation_provider.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import pathlib
1617
import re
1718
import subprocess
1819
from sys import stderr
@@ -359,6 +360,8 @@ def serialize_python_type(self, value: Any, direction: str) -> str:
359360
match = re.match(r"^<class '((?:pathlib\.)?\w+)'>$", str_value)
360361
if match:
361362
return match.group(1)
363+
if str_value == str(pathlib.Path):
364+
return "pathlib.Path"
362365
match = re.match(
363366
r"playwright._impl._event_context_manager.EventContextManagerImpl\[playwright._impl.[^.]+.(.*)\]",
364367
str_value,

scripts/generate_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
def process_type(value: Any, param: bool = False) -> str:
5959
value = str(value)
60+
value = re.sub("pathlib._local.Path", "pathlib.Path", value)
6061
value = re.sub(r"<class '([^']+)'>", r"\1", value)
6162
value = re.sub(r"NoneType", "None", value)
6263
value = re.sub(r"playwright\._impl\._api_structures.([\w]+)", r"\1", value)

0 commit comments

Comments
 (0)