contree-sdk 0.4.0.dev4__py3-none-any.whl → 0.4.0.dev5__py3-none-any.whl
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.
- contree_sdk/sdk/objects/image_like/_async.py +43 -2
- contree_sdk/sdk/objects/image_like/_base.py +27 -3
- contree_sdk/sdk/objects/image_like/_sync.py +45 -2
- {contree_sdk-0.4.0.dev4.dist-info → contree_sdk-0.4.0.dev5.dist-info}/METADATA +2 -2
- {contree_sdk-0.4.0.dev4.dist-info → contree_sdk-0.4.0.dev5.dist-info}/RECORD +7 -7
- {contree_sdk-0.4.0.dev4.dist-info → contree_sdk-0.4.0.dev5.dist-info}/WHEEL +0 -0
- {contree_sdk-0.4.0.dev4.dist-info → contree_sdk-0.4.0.dev5.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from collections.abc import AsyncIterator
|
|
1
|
+
from collections.abc import AsyncIterator, Sequence
|
|
2
2
|
from pathlib import Path, PurePosixPath
|
|
3
|
-
from typing import TypeVar
|
|
3
|
+
from typing import Literal, TypeVar
|
|
4
|
+
|
|
5
|
+
from contree_client.models import GrepResult
|
|
4
6
|
|
|
5
7
|
from contree_sdk._internals.io.operation_waiter import OutputChunk
|
|
6
8
|
from contree_sdk._internals.utils.typing import keep_signature
|
|
@@ -36,6 +38,45 @@ class _ImageLike(_ImageLikeBase):
|
|
|
36
38
|
"""
|
|
37
39
|
return await self._ls(path, ImageFile, ImageDirectory)
|
|
38
40
|
|
|
41
|
+
async def grep(
|
|
42
|
+
self,
|
|
43
|
+
pattern: str | Sequence[str],
|
|
44
|
+
*,
|
|
45
|
+
path: str | Sequence[str] | None = None,
|
|
46
|
+
glob: str | Sequence[str] | None = None,
|
|
47
|
+
max_count: int | None = None,
|
|
48
|
+
max_total: int | None = None,
|
|
49
|
+
case: Literal["sensitive", "insensitive", "smart"] | None = None,
|
|
50
|
+
before: int | None = None,
|
|
51
|
+
after: int | None = None,
|
|
52
|
+
) -> GrepResult:
|
|
53
|
+
"""Search file contents in the image.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
pattern: Search pattern or patterns.
|
|
57
|
+
path: Path or paths to search. Defaults to the image root.
|
|
58
|
+
glob: Glob filter or filters.
|
|
59
|
+
max_count: Maximum matches per file.
|
|
60
|
+
max_total: Maximum matches across all files.
|
|
61
|
+
case: Case matching mode.
|
|
62
|
+
before: Number of context lines before each match.
|
|
63
|
+
after: Number of context lines after each match.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
Typed grep result with matches and truncation status.
|
|
67
|
+
|
|
68
|
+
"""
|
|
69
|
+
return await self._grep(
|
|
70
|
+
pattern,
|
|
71
|
+
path=path,
|
|
72
|
+
glob=glob,
|
|
73
|
+
max_count=max_count,
|
|
74
|
+
max_total=max_total,
|
|
75
|
+
case=case,
|
|
76
|
+
before=before,
|
|
77
|
+
after=after,
|
|
78
|
+
)
|
|
79
|
+
|
|
39
80
|
async def download(self, image_path: str | PurePosixPath, local_path: str | Path | None = None) -> Path | None:
|
|
40
81
|
"""Download a file from the image to local filesystem.
|
|
41
82
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from asyncio import create_task, gather, to_thread
|
|
4
|
-
from collections.abc import AsyncGenerator, Iterable
|
|
4
|
+
from collections.abc import AsyncGenerator, Iterable, Sequence
|
|
5
5
|
from contextlib import aclosing
|
|
6
6
|
from copy import copy
|
|
7
7
|
from dataclasses import replace
|
|
8
8
|
from datetime import timedelta
|
|
9
9
|
from math import ceil
|
|
10
10
|
from pathlib import Path, PurePosixPath
|
|
11
|
-
from typing import TYPE_CHECKING, BinaryIO, TypeVar, cast, overload
|
|
11
|
+
from typing import TYPE_CHECKING, BinaryIO, Literal, TypeVar, cast, overload
|
|
12
12
|
from uuid import UUID
|
|
13
13
|
|
|
14
|
-
from contree_client.models import FileSpec
|
|
14
|
+
from contree_client.models import FileSpec, GrepResult
|
|
15
15
|
|
|
16
16
|
from contree_sdk._internals.io.operation_waiter import MAIN_SPID, OutputChunk
|
|
17
17
|
from contree_sdk._internals.io.typing import INPUT_TYPES, OUTPUT_REQUEST_TYPES, OUTPUT_TYPES
|
|
@@ -379,6 +379,30 @@ class _ImageLikeBase:
|
|
|
379
379
|
)
|
|
380
380
|
return result
|
|
381
381
|
|
|
382
|
+
async def _grep(
|
|
383
|
+
self,
|
|
384
|
+
pattern: str | Sequence[str],
|
|
385
|
+
*,
|
|
386
|
+
path: str | Sequence[str] | None = None,
|
|
387
|
+
glob: str | Sequence[str] | None = None,
|
|
388
|
+
max_count: int | None = None,
|
|
389
|
+
max_total: int | None = None,
|
|
390
|
+
case: Literal["sensitive", "insensitive", "smart"] | None = None,
|
|
391
|
+
before: int | None = None,
|
|
392
|
+
after: int | None = None,
|
|
393
|
+
) -> GrepResult:
|
|
394
|
+
return await self._client._api.inspect_image_grep(
|
|
395
|
+
await self._resolved_uuid(),
|
|
396
|
+
pattern,
|
|
397
|
+
path=path,
|
|
398
|
+
glob=glob,
|
|
399
|
+
max_count=max_count,
|
|
400
|
+
max_total=max_total,
|
|
401
|
+
case=case,
|
|
402
|
+
before=before,
|
|
403
|
+
after=after,
|
|
404
|
+
)
|
|
405
|
+
|
|
382
406
|
async def _read_file(self, path: str | PurePosixPath) -> bytes:
|
|
383
407
|
return await self._client._api.inspect_image_download(await self._resolved_uuid(), str(path))
|
|
384
408
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from collections.abc import Iterator
|
|
3
|
+
from collections.abc import Iterator, Sequence
|
|
4
4
|
from pathlib import Path, PurePosixPath
|
|
5
|
-
from typing import TypeVar
|
|
5
|
+
from typing import Literal, TypeVar
|
|
6
|
+
|
|
7
|
+
from contree_client.models import GrepResult
|
|
6
8
|
|
|
7
9
|
from contree_sdk._internals.io.operation_waiter import OutputChunk
|
|
8
10
|
from contree_sdk._internals.io.typing import INPUT_TYPES, OUTPUT_REQUEST_TYPES
|
|
@@ -47,6 +49,47 @@ class _ImageLikeSync(_ImageLikeBase):
|
|
|
47
49
|
"""
|
|
48
50
|
return coro_sync(self._ls(path, ImageFileSync, ImageDirectorySync))
|
|
49
51
|
|
|
52
|
+
def grep(
|
|
53
|
+
self,
|
|
54
|
+
pattern: str | Sequence[str],
|
|
55
|
+
*,
|
|
56
|
+
path: str | Sequence[str] | None = None,
|
|
57
|
+
glob: str | Sequence[str] | None = None,
|
|
58
|
+
max_count: int | None = None,
|
|
59
|
+
max_total: int | None = None,
|
|
60
|
+
case: Literal["sensitive", "insensitive", "smart"] | None = None,
|
|
61
|
+
before: int | None = None,
|
|
62
|
+
after: int | None = None,
|
|
63
|
+
) -> GrepResult:
|
|
64
|
+
"""Search file contents in the image.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
pattern: Search pattern or patterns.
|
|
68
|
+
path: Path or paths to search. Defaults to the image root.
|
|
69
|
+
glob: Glob filter or filters.
|
|
70
|
+
max_count: Maximum matches per file.
|
|
71
|
+
max_total: Maximum matches across all files.
|
|
72
|
+
case: Case matching mode.
|
|
73
|
+
before: Number of context lines before each match.
|
|
74
|
+
after: Number of context lines after each match.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
Typed grep result with matches and truncation status.
|
|
78
|
+
|
|
79
|
+
"""
|
|
80
|
+
return coro_sync(
|
|
81
|
+
self._grep(
|
|
82
|
+
pattern,
|
|
83
|
+
path=path,
|
|
84
|
+
glob=glob,
|
|
85
|
+
max_count=max_count,
|
|
86
|
+
max_total=max_total,
|
|
87
|
+
case=case,
|
|
88
|
+
before=before,
|
|
89
|
+
after=after,
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
|
|
50
93
|
def download(self, image_path: str | PurePosixPath, local_path: str | Path | None = None) -> Path | None:
|
|
51
94
|
"""Download a file from the image to local filesystem.
|
|
52
95
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: contree-sdk
|
|
3
|
-
Version: 0.4.0.
|
|
3
|
+
Version: 0.4.0.dev5
|
|
4
4
|
Summary: SDK for ConTree container runtime with versioned filesystem state
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -16,7 +16,7 @@ Requires-Python: <3.15,>=3.10
|
|
|
16
16
|
Requires-Dist: aiofiles
|
|
17
17
|
Requires-Dist: async-timeout; python_version < '3.11'
|
|
18
18
|
Requires-Dist: cattrs
|
|
19
|
-
Requires-Dist: contree-client~=0.2.1
|
|
19
|
+
Requires-Dist: contree-client~=0.2.1
|
|
20
20
|
Requires-Dist: strenum
|
|
21
21
|
Requires-Dist: typing-extensions; python_version < '3.13'
|
|
22
22
|
Provides-Extra: aiohttp
|
|
@@ -57,9 +57,9 @@ contree_sdk/sdk/objects/image_fs/_async.py,sha256=aREtHK3H3Wo4uRIOmMvInIKHRkDwZq
|
|
|
57
57
|
contree_sdk/sdk/objects/image_fs/_base.py,sha256=K07WZ75dHNYVsS-PHVM4ha8z8EcSBFdRra2LAgrcv7I,1094
|
|
58
58
|
contree_sdk/sdk/objects/image_fs/_sync.py,sha256=cJUkPd00d8B6rZDFBce3GlK-4RynE569g9uZjj6FR3k,778
|
|
59
59
|
contree_sdk/sdk/objects/image_like/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
|
-
contree_sdk/sdk/objects/image_like/_async.py,sha256=
|
|
61
|
-
contree_sdk/sdk/objects/image_like/_base.py,sha256=
|
|
62
|
-
contree_sdk/sdk/objects/image_like/_sync.py,sha256=
|
|
60
|
+
contree_sdk/sdk/objects/image_like/_async.py,sha256=izss4GGbvkqlgiXmEkQ5LR4sFbgZJI4U1LNddgh1UMA,3692
|
|
61
|
+
contree_sdk/sdk/objects/image_like/_base.py,sha256=Ye4a93FZzZ-Z29HPoByzFrEpbyGVY3wDjg_f0qBiueM,18062
|
|
62
|
+
contree_sdk/sdk/objects/image_like/_sync.py,sha256=Lloh9usg55Vk-Nva14vjpkelHuOIKBLZ9Cf9Uoy7yns,6139
|
|
63
63
|
contree_sdk/sdk/objects/image_like/result.py,sha256=imcmFNquy7fczl-y_lZ2kXFtMNTds98JdY_pF43qHA8,1089
|
|
64
64
|
contree_sdk/sdk/objects/image_like/state.py,sha256=UUFOLu2fdbIkxw7f77iVtz8FGH_o5U-AcPxbUGetF9s,2125
|
|
65
65
|
contree_sdk/sdk/objects/session/__init__.py,sha256=ws5Q7tr1GBsxujaWaaVVnKVilw-_nSPtsgV452Yd7Qg,188
|
|
@@ -81,7 +81,7 @@ contree_sdk/utils/models/file.py,sha256=9izWiiCiH1t2AU6GgY0pHaIztHDVdjVoUZQP3NOL
|
|
|
81
81
|
contree_sdk/utils/models/image.py,sha256=bhFHRO8FTKKtCwU2efxNuST7rAnr5sMeP3jAS_BQcgc,88
|
|
82
82
|
contree_sdk/utils/models/operation.py,sha256=0hQi-IGbAP6_Ao32YBJHJ9KwXK2unHWpRLjmlacu0ow,523
|
|
83
83
|
contree_sdk/utils/models/stream.py,sha256=Ckorhu_-5dVQPfaaFpr7HVjoN00a_c9d7fqTisOyz3c,315
|
|
84
|
-
contree_sdk-0.4.0.
|
|
85
|
-
contree_sdk-0.4.0.
|
|
86
|
-
contree_sdk-0.4.0.
|
|
87
|
-
contree_sdk-0.4.0.
|
|
84
|
+
contree_sdk-0.4.0.dev5.dist-info/METADATA,sha256=gZcIEXVfP02J3zfM5qHfpePqM5z9vwd9J21jHvmSoGw,17486
|
|
85
|
+
contree_sdk-0.4.0.dev5.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
86
|
+
contree_sdk-0.4.0.dev5.dist-info/licenses/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
|
|
87
|
+
contree_sdk-0.4.0.dev5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|