anyenv 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {anyenv-0.3.2 → anyenv-0.3.4}/PKG-INFO +1 -1
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/__init__.py +1 -1
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/download/aiohttp_backend.py +4 -14
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/download/base.py +4 -2
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/download/functional.py +95 -14
- {anyenv-0.3.2 → anyenv-0.3.4}/.copier-answers.yml +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/.github/FUNDING.yml +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/.github/copilot-instructions.md +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/.github/dependabot.yml +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/.github/workflows/build.yml +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/.github/workflows/documentation.yml +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/.gitignore +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/.pre-commit-config.yaml +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/LICENSE +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/README.md +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/docs/.empty +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/duties.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/mkdocs.yml +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/overrides/_dummy.txt +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/pyproject.toml +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/async_run.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/download/__init__.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/download/exceptions.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/download/httpx_backend.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/download/httpx_serializer.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/download/pyodide_backend.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/json_tools/__init__.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/json_tools/dumping.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/json_tools/loading.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/package_install/__init__.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/package_install/base.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/package_install/functional.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/package_install/micropip_install.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/package_install/pip_install.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/py.typed +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/testing.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/threadgroup/__init__.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/src/anyenv/threadgroup/threadgroup.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/tests/__init__.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/tests/conftest.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/tests/test_download.py +0 -0
- {anyenv-0.3.2 → anyenv-0.3.4}/tests/test_threadgroup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anyenv
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Compatibility layer for some basic operations to allow painless operation in PyOdide and Python pre-releases
|
|
5
5
|
Project-URL: Documentation, https://phil65.github.io/anyenv/
|
|
6
6
|
Project-URL: Source, https://github.com/phil65/anyenv
|
|
@@ -103,22 +103,12 @@ class AiohttpBackend(HttpBackend):
|
|
|
103
103
|
headers: dict[str, str] | None = None,
|
|
104
104
|
) -> CachedSession:
|
|
105
105
|
if cache:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
)
|
|
110
|
-
return CachedSession(
|
|
111
|
-
cache=cache_backend,
|
|
112
|
-
headers=headers,
|
|
113
|
-
base_url=base_url,
|
|
114
|
-
)
|
|
106
|
+
path = str(self.cache_dir / "http_cache.db")
|
|
107
|
+
cache_backend = SQLiteBackend(cache_name=path, expire_after=self.cache_ttl)
|
|
108
|
+
return CachedSession(cache=cache_backend, headers=headers, base_url=base_url)
|
|
115
109
|
|
|
116
110
|
# Even when not caching, we use CachedSession for consistent interface
|
|
117
|
-
return CachedSession(
|
|
118
|
-
expire_after=0, # Disable caching
|
|
119
|
-
headers=headers,
|
|
120
|
-
base_url=base_url,
|
|
121
|
-
)
|
|
111
|
+
return CachedSession(expire_after=0, headers=headers, base_url=base_url)
|
|
122
112
|
|
|
123
113
|
async def request(
|
|
124
114
|
self,
|
|
@@ -19,6 +19,7 @@ if TYPE_CHECKING:
|
|
|
19
19
|
T = TypeVar("T")
|
|
20
20
|
ProgressCallback = Callable[[int, int], Any] # current, total -> Any
|
|
21
21
|
Method = Literal["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"]
|
|
22
|
+
DEFAULT_TTL = 3600
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class HttpResponse(abc.ABC):
|
|
@@ -117,7 +118,7 @@ class HttpBackend(abc.ABC):
|
|
|
117
118
|
def __init__(
|
|
118
119
|
self,
|
|
119
120
|
cache_dir: str | PathLike[str] | None = None,
|
|
120
|
-
cache_ttl: int =
|
|
121
|
+
cache_ttl: int | None = None,
|
|
121
122
|
):
|
|
122
123
|
"""Initialize HTTP backend.
|
|
123
124
|
|
|
@@ -126,7 +127,8 @@ class HttpBackend(abc.ABC):
|
|
|
126
127
|
uses platform-specific user cache directory.
|
|
127
128
|
cache_ttl: Time-to-live for cached responses in seconds.
|
|
128
129
|
"""
|
|
129
|
-
|
|
130
|
+
cache_ttl = cache_ttl or DEFAULT_TTL
|
|
131
|
+
dir_ = cache_dir or user_cache_dir("anyenv", False)
|
|
130
132
|
self.cache_dir = pathlib.Path(dir_)
|
|
131
133
|
self.cache_ttl = cache_ttl
|
|
132
134
|
|
|
@@ -19,15 +19,13 @@ BackendType = Literal["httpx", "aiohttp", "pyodide"]
|
|
|
19
19
|
def _get_default_backend() -> HttpBackend:
|
|
20
20
|
"""Get the best available HTTP backend."""
|
|
21
21
|
# Try httpx first
|
|
22
|
-
if importlib.util.find_spec("httpx")
|
|
22
|
+
if importlib.util.find_spec("httpx"):
|
|
23
23
|
from anyenv.download.httpx_backend import HttpxBackend
|
|
24
24
|
|
|
25
25
|
return HttpxBackend()
|
|
26
26
|
|
|
27
27
|
# Try aiohttp next
|
|
28
|
-
if importlib.util.find_spec("aiohttp")
|
|
29
|
-
"aiohttp_client_cache"
|
|
30
|
-
):
|
|
28
|
+
if importlib.util.find_spec("aiohttp"):
|
|
31
29
|
from anyenv.download.aiohttp_backend import AiohttpBackend
|
|
32
30
|
|
|
33
31
|
return AiohttpBackend()
|
|
@@ -46,11 +44,17 @@ def _get_default_backend() -> HttpBackend:
|
|
|
46
44
|
raise ImportError(msg)
|
|
47
45
|
|
|
48
46
|
|
|
49
|
-
def get_backend(
|
|
47
|
+
def get_backend(
|
|
48
|
+
backend_type: BackendType | None = None,
|
|
49
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
50
|
+
cache_ttl: int | None = None,
|
|
51
|
+
) -> HttpBackend:
|
|
50
52
|
"""Get a specific HTTP backend or the best available one.
|
|
51
53
|
|
|
52
54
|
Args:
|
|
53
55
|
backend_type: Optional backend type to use. If None, uses the best available.
|
|
56
|
+
cache_dir: Optional path to use for caching. If None, uses a default path.
|
|
57
|
+
cache_ttl: Optional TTL for cached responses. If None, uses a default TTL.
|
|
54
58
|
|
|
55
59
|
Returns:
|
|
56
60
|
An instance of the selected HTTP backend.
|
|
@@ -65,7 +69,7 @@ def get_backend(backend_type: BackendType | None = None) -> HttpBackend:
|
|
|
65
69
|
if importlib.util.find_spec("httpx") and importlib.util.find_spec("hishel"):
|
|
66
70
|
from anyenv.download.httpx_backend import HttpxBackend
|
|
67
71
|
|
|
68
|
-
return HttpxBackend()
|
|
72
|
+
return HttpxBackend(cache_dir=cache_dir, cache_ttl=cache_ttl)
|
|
69
73
|
msg = "httpx backend requested but httpx or hishel not installed"
|
|
70
74
|
raise ImportError(msg)
|
|
71
75
|
|
|
@@ -75,7 +79,7 @@ def get_backend(backend_type: BackendType | None = None) -> HttpBackend:
|
|
|
75
79
|
):
|
|
76
80
|
from anyenv.download.aiohttp_backend import AiohttpBackend
|
|
77
81
|
|
|
78
|
-
return AiohttpBackend()
|
|
82
|
+
return AiohttpBackend(cache_dir=cache_dir, cache_ttl=cache_ttl)
|
|
79
83
|
msg = (
|
|
80
84
|
"aiohttp backend requested but aiohttp or aiohttp_client_cache not installed"
|
|
81
85
|
)
|
|
@@ -107,6 +111,8 @@ async def request(
|
|
|
107
111
|
timeout: float | None = None,
|
|
108
112
|
cache: bool = False,
|
|
109
113
|
backend: BackendType | None = None,
|
|
114
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
115
|
+
cache_ttl: int | None = None,
|
|
110
116
|
) -> HttpResponse:
|
|
111
117
|
"""Make an HTTP request.
|
|
112
118
|
|
|
@@ -120,11 +126,13 @@ async def request(
|
|
|
120
126
|
timeout: Optional request timeout in seconds
|
|
121
127
|
cache: Whether to use cached responses
|
|
122
128
|
backend: Optional specific backend to use
|
|
129
|
+
cache_dir: Optional directory to store cached responses
|
|
130
|
+
cache_ttl: Optional time-to-live for cached responses in seconds
|
|
123
131
|
|
|
124
132
|
Returns:
|
|
125
133
|
An HttpResponse object
|
|
126
134
|
"""
|
|
127
|
-
http_backend = get_backend(backend)
|
|
135
|
+
http_backend = get_backend(backend, cache_dir=cache_dir, cache_ttl=cache_ttl)
|
|
128
136
|
return await http_backend.request(
|
|
129
137
|
method,
|
|
130
138
|
url,
|
|
@@ -145,6 +153,8 @@ async def get(
|
|
|
145
153
|
timeout: float | None = None,
|
|
146
154
|
cache: bool = False,
|
|
147
155
|
backend: BackendType | None = None,
|
|
156
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
157
|
+
cache_ttl: int | None = None,
|
|
148
158
|
) -> HttpResponse:
|
|
149
159
|
"""Make a GET request.
|
|
150
160
|
|
|
@@ -155,6 +165,8 @@ async def get(
|
|
|
155
165
|
timeout: Optional request timeout in seconds
|
|
156
166
|
cache: Whether to use cached responses
|
|
157
167
|
backend: Optional specific backend to use
|
|
168
|
+
cache_dir: Optional directory to store cached responses
|
|
169
|
+
cache_ttl: Optional time-to-live for cached responses in seconds
|
|
158
170
|
|
|
159
171
|
Returns:
|
|
160
172
|
An HttpResponse object
|
|
@@ -167,6 +179,8 @@ async def get(
|
|
|
167
179
|
timeout=timeout,
|
|
168
180
|
cache=cache,
|
|
169
181
|
backend=backend,
|
|
182
|
+
cache_dir=cache_dir,
|
|
183
|
+
cache_ttl=cache_ttl,
|
|
170
184
|
)
|
|
171
185
|
|
|
172
186
|
|
|
@@ -180,6 +194,8 @@ async def post(
|
|
|
180
194
|
timeout: float | None = None,
|
|
181
195
|
cache: bool = False,
|
|
182
196
|
backend: BackendType | None = None,
|
|
197
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
198
|
+
cache_ttl: int | None = None,
|
|
183
199
|
) -> HttpResponse:
|
|
184
200
|
"""Make a POST request.
|
|
185
201
|
|
|
@@ -192,6 +208,8 @@ async def post(
|
|
|
192
208
|
timeout: Optional request timeout in seconds
|
|
193
209
|
cache: Whether to use cached responses
|
|
194
210
|
backend: Optional specific backend to use
|
|
211
|
+
cache_dir: Optional path to use for caching
|
|
212
|
+
cache_ttl: Optional time-to-live for cached responses
|
|
195
213
|
|
|
196
214
|
Returns:
|
|
197
215
|
An HttpResponse object
|
|
@@ -206,6 +224,8 @@ async def post(
|
|
|
206
224
|
timeout=timeout,
|
|
207
225
|
cache=cache,
|
|
208
226
|
backend=backend,
|
|
227
|
+
cache_dir=cache_dir,
|
|
228
|
+
cache_ttl=cache_ttl,
|
|
209
229
|
)
|
|
210
230
|
|
|
211
231
|
|
|
@@ -217,6 +237,8 @@ async def download(
|
|
|
217
237
|
progress_callback: ProgressCallback | None = None,
|
|
218
238
|
cache: bool = False,
|
|
219
239
|
backend: BackendType | None = None,
|
|
240
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
241
|
+
cache_ttl: int | None = None,
|
|
220
242
|
) -> None:
|
|
221
243
|
"""Download a file with optional progress reporting.
|
|
222
244
|
|
|
@@ -227,8 +249,10 @@ async def download(
|
|
|
227
249
|
progress_callback: Optional callback for progress reporting
|
|
228
250
|
cache: Whether to use cached responses
|
|
229
251
|
backend: Optional specific backend to use
|
|
252
|
+
cache_dir: Optional directory to use for caching
|
|
253
|
+
cache_ttl: Optional time-to-live for cached responses
|
|
230
254
|
"""
|
|
231
|
-
http_backend = get_backend(backend)
|
|
255
|
+
http_backend = get_backend(backend, cache_dir=cache_dir, cache_ttl=cache_ttl)
|
|
232
256
|
await http_backend.download(
|
|
233
257
|
url,
|
|
234
258
|
path,
|
|
@@ -249,6 +273,8 @@ async def get_text(
|
|
|
249
273
|
timeout: float | None = None,
|
|
250
274
|
cache: bool = False,
|
|
251
275
|
backend: BackendType | None = None,
|
|
276
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
277
|
+
cache_ttl: int | None = None,
|
|
252
278
|
) -> str:
|
|
253
279
|
"""Make a GET request and return the response text.
|
|
254
280
|
|
|
@@ -259,12 +285,21 @@ async def get_text(
|
|
|
259
285
|
timeout: Optional request timeout in seconds
|
|
260
286
|
cache: Whether to use cached responses
|
|
261
287
|
backend: Optional specific backend to use
|
|
288
|
+
cache_dir: Optional directory to store cached responses
|
|
289
|
+
cache_ttl: Optional time-to-live for cached responses
|
|
262
290
|
|
|
263
291
|
Returns:
|
|
264
292
|
The response body as text
|
|
265
293
|
"""
|
|
266
294
|
response = await get(
|
|
267
|
-
url,
|
|
295
|
+
url,
|
|
296
|
+
params=params,
|
|
297
|
+
headers=headers,
|
|
298
|
+
timeout=timeout,
|
|
299
|
+
cache=cache,
|
|
300
|
+
backend=backend,
|
|
301
|
+
cache_dir=cache_dir,
|
|
302
|
+
cache_ttl=cache_ttl,
|
|
268
303
|
)
|
|
269
304
|
return await response.text()
|
|
270
305
|
|
|
@@ -277,6 +312,8 @@ async def get_json(
|
|
|
277
312
|
timeout: float | None = None,
|
|
278
313
|
cache: bool = False,
|
|
279
314
|
backend: BackendType | None = None,
|
|
315
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
316
|
+
cache_ttl: int | None = None,
|
|
280
317
|
) -> Any:
|
|
281
318
|
"""Make a GET request and return the response as JSON.
|
|
282
319
|
|
|
@@ -287,12 +324,21 @@ async def get_json(
|
|
|
287
324
|
timeout: Optional request timeout in seconds
|
|
288
325
|
cache: Whether to use cached responses
|
|
289
326
|
backend: Optional specific backend to use
|
|
327
|
+
cache_dir: Optional directory to store cached responses
|
|
328
|
+
cache_ttl: Optional time-to-live for cached responses
|
|
290
329
|
|
|
291
330
|
Returns:
|
|
292
331
|
The response body parsed as JSON
|
|
293
332
|
"""
|
|
294
333
|
response = await get(
|
|
295
|
-
url,
|
|
334
|
+
url,
|
|
335
|
+
params=params,
|
|
336
|
+
headers=headers,
|
|
337
|
+
timeout=timeout,
|
|
338
|
+
cache=cache,
|
|
339
|
+
backend=backend,
|
|
340
|
+
cache_dir=cache_dir,
|
|
341
|
+
cache_ttl=cache_ttl,
|
|
296
342
|
)
|
|
297
343
|
return await response.json()
|
|
298
344
|
|
|
@@ -305,6 +351,8 @@ async def get_bytes(
|
|
|
305
351
|
timeout: float | None = None,
|
|
306
352
|
cache: bool = False,
|
|
307
353
|
backend: BackendType | None = None,
|
|
354
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
355
|
+
cache_ttl: int | None = None,
|
|
308
356
|
) -> bytes:
|
|
309
357
|
"""Make a GET request and return the response as bytes.
|
|
310
358
|
|
|
@@ -315,12 +363,21 @@ async def get_bytes(
|
|
|
315
363
|
timeout: Optional request timeout in seconds
|
|
316
364
|
cache: Whether to use cached responses
|
|
317
365
|
backend: Optional specific backend to use
|
|
366
|
+
cache_dir: Optional directory to store cached responses
|
|
367
|
+
cache_ttl: Optional time-to-live for cached responses
|
|
318
368
|
|
|
319
369
|
Returns:
|
|
320
370
|
The response body as bytes
|
|
321
371
|
"""
|
|
322
372
|
response = await get(
|
|
323
|
-
url,
|
|
373
|
+
url,
|
|
374
|
+
params=params,
|
|
375
|
+
headers=headers,
|
|
376
|
+
timeout=timeout,
|
|
377
|
+
cache=cache,
|
|
378
|
+
backend=backend,
|
|
379
|
+
cache_dir=cache_dir,
|
|
380
|
+
cache_ttl=cache_ttl,
|
|
324
381
|
)
|
|
325
382
|
return await response.bytes()
|
|
326
383
|
|
|
@@ -339,9 +396,11 @@ def request_sync(
|
|
|
339
396
|
timeout: float | None = None,
|
|
340
397
|
cache: bool = False,
|
|
341
398
|
backend: BackendType | None = None,
|
|
399
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
400
|
+
cache_ttl: int | None = None,
|
|
342
401
|
) -> HttpResponse:
|
|
343
402
|
"""Synchronous version of request."""
|
|
344
|
-
http_backend = get_backend(backend)
|
|
403
|
+
http_backend = get_backend(backend, cache_dir=cache_dir, cache_ttl=cache_ttl)
|
|
345
404
|
return http_backend.request_sync(
|
|
346
405
|
method,
|
|
347
406
|
url,
|
|
@@ -362,6 +421,8 @@ def get_sync(
|
|
|
362
421
|
timeout: float | None = None,
|
|
363
422
|
cache: bool = False,
|
|
364
423
|
backend: BackendType | None = None,
|
|
424
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
425
|
+
cache_ttl: int | None = None,
|
|
365
426
|
) -> HttpResponse:
|
|
366
427
|
"""Synchronous version of get."""
|
|
367
428
|
return request_sync(
|
|
@@ -372,6 +433,8 @@ def get_sync(
|
|
|
372
433
|
timeout=timeout,
|
|
373
434
|
cache=cache,
|
|
374
435
|
backend=backend,
|
|
436
|
+
cache_dir=cache_dir,
|
|
437
|
+
cache_ttl=cache_ttl,
|
|
375
438
|
)
|
|
376
439
|
|
|
377
440
|
|
|
@@ -385,6 +448,8 @@ def post_sync(
|
|
|
385
448
|
timeout: float | None = None,
|
|
386
449
|
cache: bool = False,
|
|
387
450
|
backend: BackendType | None = None,
|
|
451
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
452
|
+
cache_ttl: int | None = None,
|
|
388
453
|
) -> HttpResponse:
|
|
389
454
|
"""Synchronous version of post."""
|
|
390
455
|
return request_sync(
|
|
@@ -397,6 +462,8 @@ def post_sync(
|
|
|
397
462
|
timeout=timeout,
|
|
398
463
|
cache=cache,
|
|
399
464
|
backend=backend,
|
|
465
|
+
cache_dir=cache_dir,
|
|
466
|
+
cache_ttl=cache_ttl,
|
|
400
467
|
)
|
|
401
468
|
|
|
402
469
|
|
|
@@ -408,9 +475,11 @@ def download_sync(
|
|
|
408
475
|
progress_callback: ProgressCallback | None = None,
|
|
409
476
|
cache: bool = False,
|
|
410
477
|
backend: BackendType | None = None,
|
|
478
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
479
|
+
cache_ttl: int | None = None,
|
|
411
480
|
) -> None:
|
|
412
481
|
"""Synchronous version of download."""
|
|
413
|
-
http_backend = get_backend(backend)
|
|
482
|
+
http_backend = get_backend(backend, cache_dir=cache_dir, cache_ttl=cache_ttl)
|
|
414
483
|
http_backend.download_sync(
|
|
415
484
|
url,
|
|
416
485
|
path,
|
|
@@ -428,6 +497,8 @@ def get_text_sync(
|
|
|
428
497
|
timeout: float | None = None,
|
|
429
498
|
cache: bool = False,
|
|
430
499
|
backend: BackendType | None = None,
|
|
500
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
501
|
+
cache_ttl: int | None = None,
|
|
431
502
|
) -> str:
|
|
432
503
|
"""Synchronous version of get_text."""
|
|
433
504
|
from anyenv.async_run import run_sync
|
|
@@ -440,6 +511,8 @@ def get_text_sync(
|
|
|
440
511
|
timeout=timeout,
|
|
441
512
|
cache=cache,
|
|
442
513
|
backend=backend,
|
|
514
|
+
cache_dir=cache_dir,
|
|
515
|
+
cache_ttl=cache_ttl,
|
|
443
516
|
)
|
|
444
517
|
)
|
|
445
518
|
|
|
@@ -452,6 +525,8 @@ def get_json_sync(
|
|
|
452
525
|
timeout: float | None = None,
|
|
453
526
|
cache: bool = False,
|
|
454
527
|
backend: BackendType | None = None,
|
|
528
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
529
|
+
cache_ttl: int | None = None,
|
|
455
530
|
) -> Any:
|
|
456
531
|
"""Synchronous version of get_json."""
|
|
457
532
|
from anyenv.async_run import run_sync
|
|
@@ -464,6 +539,8 @@ def get_json_sync(
|
|
|
464
539
|
timeout=timeout,
|
|
465
540
|
cache=cache,
|
|
466
541
|
backend=backend,
|
|
542
|
+
cache_dir=cache_dir,
|
|
543
|
+
cache_ttl=cache_ttl,
|
|
467
544
|
)
|
|
468
545
|
)
|
|
469
546
|
|
|
@@ -476,6 +553,8 @@ def get_bytes_sync(
|
|
|
476
553
|
timeout: float | None = None,
|
|
477
554
|
cache: bool = False,
|
|
478
555
|
backend: BackendType | None = None,
|
|
556
|
+
cache_dir: str | os.PathLike[str] | None = None,
|
|
557
|
+
cache_ttl: int | None = None,
|
|
479
558
|
) -> bytes:
|
|
480
559
|
"""Synchronous version of get_bytes."""
|
|
481
560
|
from anyenv.async_run import run_sync
|
|
@@ -488,5 +567,7 @@ def get_bytes_sync(
|
|
|
488
567
|
timeout=timeout,
|
|
489
568
|
cache=cache,
|
|
490
569
|
backend=backend,
|
|
570
|
+
cache_dir=cache_dir,
|
|
571
|
+
cache_ttl=cache_ttl,
|
|
491
572
|
)
|
|
492
573
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|