-
Notifications
You must be signed in to change notification settings - Fork 6
/
gen_sync.py
41 lines (37 loc) · 1.1 KB
/
gen_sync.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from pathlib import Path
from unasync import unasync_files, Rule
directories = [
Path("httpx_caching"),
Path("tests"),
]
file_paths = set()
for directory in directories:
for p in directory.rglob("*.py"):
file_paths.add(str(p))
unasync_files(
file_paths,
rules=[
Rule(
fromdir="/_async/",
todir="/_sync/",
additional_replacements={
"AsyncBaseTransport": "BaseTransport",
"AsyncHTTPTransport": "HTTPTransport",
"async_client": "client",
"AsyncClient": "Client",
"make_async_client": "make_client",
"asyncio": "sync",
"aclose": "close",
'"aclose"': '"close"',
"aread": "read",
"arun": "run",
"aio_handler": "io_handler",
"handle_async_request": "handle_request",
'"handle_async_request"': '"handle_request"',
"aget": "get",
"aset": "set",
"adelete": "delete",
}
),
],
)