codeset 0.4.4__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.
Files changed (63) hide show
  1. codeset/__init__.py +92 -0
  2. codeset/_base_client.py +2001 -0
  3. codeset/_client.py +572 -0
  4. codeset/_compat.py +219 -0
  5. codeset/_constants.py +14 -0
  6. codeset/_exceptions.py +108 -0
  7. codeset/_files.py +123 -0
  8. codeset/_models.py +857 -0
  9. codeset/_qs.py +150 -0
  10. codeset/_resource.py +43 -0
  11. codeset/_response.py +830 -0
  12. codeset/_streaming.py +333 -0
  13. codeset/_types.py +261 -0
  14. codeset/_utils/__init__.py +66 -0
  15. codeset/_utils/_compat.py +45 -0
  16. codeset/_utils/_datetime_parse.py +136 -0
  17. codeset/_utils/_logs.py +25 -0
  18. codeset/_utils/_proxy.py +65 -0
  19. codeset/_utils/_reflection.py +42 -0
  20. codeset/_utils/_resources_proxy.py +24 -0
  21. codeset/_utils/_streams.py +12 -0
  22. codeset/_utils/_sync.py +58 -0
  23. codeset/_utils/_transform.py +457 -0
  24. codeset/_utils/_typing.py +156 -0
  25. codeset/_utils/_utils.py +474 -0
  26. codeset/_version.py +4 -0
  27. codeset/lib/.keep +4 -0
  28. codeset/py.typed +0 -0
  29. codeset/resources/__init__.py +61 -0
  30. codeset/resources/datasets.py +135 -0
  31. codeset/resources/health.py +135 -0
  32. codeset/resources/samples.py +303 -0
  33. codeset/resources/sessions/__init__.py +33 -0
  34. codeset/resources/sessions/sessions.py +891 -0
  35. codeset/resources/sessions/verify.py +335 -0
  36. codeset/types/__init__.py +22 -0
  37. codeset/types/container_info.py +32 -0
  38. codeset/types/dataset_list_response.py +28 -0
  39. codeset/types/error_info.py +15 -0
  40. codeset/types/health_check_response.py +21 -0
  41. codeset/types/interaction.py +37 -0
  42. codeset/types/interaction_status.py +7 -0
  43. codeset/types/sample_download_params.py +14 -0
  44. codeset/types/sample_list_params.py +22 -0
  45. codeset/types/sample_list_response.py +95 -0
  46. codeset/types/session.py +48 -0
  47. codeset/types/session_close_response.py +15 -0
  48. codeset/types/session_create_params.py +18 -0
  49. codeset/types/session_create_response.py +21 -0
  50. codeset/types/session_execute_command_params.py +15 -0
  51. codeset/types/session_execute_command_response.py +15 -0
  52. codeset/types/session_list_response.py +20 -0
  53. codeset/types/session_status.py +7 -0
  54. codeset/types/session_str_replace_params.py +18 -0
  55. codeset/types/session_str_replace_response.py +15 -0
  56. codeset/types/sessions/__init__.py +7 -0
  57. codeset/types/sessions/job_status.py +7 -0
  58. codeset/types/sessions/verify_start_response.py +21 -0
  59. codeset/types/sessions/verify_status_response.py +79 -0
  60. codeset-0.4.4.dist-info/METADATA +399 -0
  61. codeset-0.4.4.dist-info/RECORD +63 -0
  62. codeset-0.4.4.dist-info/WHEEL +4 -0
  63. codeset-0.4.4.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,135 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import httpx
6
+
7
+ from .._types import Body, Query, Headers, NotGiven, not_given
8
+ from .._compat import cached_property
9
+ from .._resource import SyncAPIResource, AsyncAPIResource
10
+ from .._response import (
11
+ to_raw_response_wrapper,
12
+ to_streamed_response_wrapper,
13
+ async_to_raw_response_wrapper,
14
+ async_to_streamed_response_wrapper,
15
+ )
16
+ from .._base_client import make_request_options
17
+ from ..types.health_check_response import HealthCheckResponse
18
+
19
+ __all__ = ["HealthResource", "AsyncHealthResource"]
20
+
21
+
22
+ class HealthResource(SyncAPIResource):
23
+ @cached_property
24
+ def with_raw_response(self) -> HealthResourceWithRawResponse:
25
+ """
26
+ This property can be used as a prefix for any HTTP method call to return
27
+ the raw response object instead of the parsed content.
28
+
29
+ For more information, see https://www.github.com/codeset-ai/codeset-sdk#accessing-raw-response-data-eg-headers
30
+ """
31
+ return HealthResourceWithRawResponse(self)
32
+
33
+ @cached_property
34
+ def with_streaming_response(self) -> HealthResourceWithStreamingResponse:
35
+ """
36
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
37
+
38
+ For more information, see https://www.github.com/codeset-ai/codeset-sdk#with_streaming_response
39
+ """
40
+ return HealthResourceWithStreamingResponse(self)
41
+
42
+ def check(
43
+ self,
44
+ *,
45
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
46
+ # The extra values given here take precedence over values defined on the client or passed to this method.
47
+ extra_headers: Headers | None = None,
48
+ extra_query: Query | None = None,
49
+ extra_body: Body | None = None,
50
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
51
+ ) -> HealthCheckResponse:
52
+ """Health check endpoint"""
53
+ return self._get(
54
+ "/health",
55
+ options=make_request_options(
56
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
57
+ ),
58
+ cast_to=HealthCheckResponse,
59
+ )
60
+
61
+
62
+ class AsyncHealthResource(AsyncAPIResource):
63
+ @cached_property
64
+ def with_raw_response(self) -> AsyncHealthResourceWithRawResponse:
65
+ """
66
+ This property can be used as a prefix for any HTTP method call to return
67
+ the raw response object instead of the parsed content.
68
+
69
+ For more information, see https://www.github.com/codeset-ai/codeset-sdk#accessing-raw-response-data-eg-headers
70
+ """
71
+ return AsyncHealthResourceWithRawResponse(self)
72
+
73
+ @cached_property
74
+ def with_streaming_response(self) -> AsyncHealthResourceWithStreamingResponse:
75
+ """
76
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
77
+
78
+ For more information, see https://www.github.com/codeset-ai/codeset-sdk#with_streaming_response
79
+ """
80
+ return AsyncHealthResourceWithStreamingResponse(self)
81
+
82
+ async def check(
83
+ self,
84
+ *,
85
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
86
+ # The extra values given here take precedence over values defined on the client or passed to this method.
87
+ extra_headers: Headers | None = None,
88
+ extra_query: Query | None = None,
89
+ extra_body: Body | None = None,
90
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
91
+ ) -> HealthCheckResponse:
92
+ """Health check endpoint"""
93
+ return await self._get(
94
+ "/health",
95
+ options=make_request_options(
96
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
97
+ ),
98
+ cast_to=HealthCheckResponse,
99
+ )
100
+
101
+
102
+ class HealthResourceWithRawResponse:
103
+ def __init__(self, health: HealthResource) -> None:
104
+ self._health = health
105
+
106
+ self.check = to_raw_response_wrapper(
107
+ health.check,
108
+ )
109
+
110
+
111
+ class AsyncHealthResourceWithRawResponse:
112
+ def __init__(self, health: AsyncHealthResource) -> None:
113
+ self._health = health
114
+
115
+ self.check = async_to_raw_response_wrapper(
116
+ health.check,
117
+ )
118
+
119
+
120
+ class HealthResourceWithStreamingResponse:
121
+ def __init__(self, health: HealthResource) -> None:
122
+ self._health = health
123
+
124
+ self.check = to_streamed_response_wrapper(
125
+ health.check,
126
+ )
127
+
128
+
129
+ class AsyncHealthResourceWithStreamingResponse:
130
+ def __init__(self, health: AsyncHealthResource) -> None:
131
+ self._health = health
132
+
133
+ self.check = async_to_streamed_response_wrapper(
134
+ health.check,
135
+ )
@@ -0,0 +1,303 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+
7
+ import httpx
8
+
9
+ from ..types import sample_list_params, sample_download_params
10
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
+ from .._utils import maybe_transform, async_maybe_transform
12
+ from .._compat import cached_property
13
+ from .._resource import SyncAPIResource, AsyncAPIResource
14
+ from .._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from .._base_client import make_request_options
21
+ from ..types.sample_list_response import SampleListResponse
22
+
23
+ __all__ = ["SamplesResource", "AsyncSamplesResource"]
24
+
25
+
26
+ class SamplesResource(SyncAPIResource):
27
+ @cached_property
28
+ def with_raw_response(self) -> SamplesResourceWithRawResponse:
29
+ """
30
+ This property can be used as a prefix for any HTTP method call to return
31
+ the raw response object instead of the parsed content.
32
+
33
+ For more information, see https://www.github.com/codeset-ai/codeset-sdk#accessing-raw-response-data-eg-headers
34
+ """
35
+ return SamplesResourceWithRawResponse(self)
36
+
37
+ @cached_property
38
+ def with_streaming_response(self) -> SamplesResourceWithStreamingResponse:
39
+ """
40
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41
+
42
+ For more information, see https://www.github.com/codeset-ai/codeset-sdk#with_streaming_response
43
+ """
44
+ return SamplesResourceWithStreamingResponse(self)
45
+
46
+ def list(
47
+ self,
48
+ *,
49
+ dataset: Optional[str] | Omit = omit,
50
+ page: Optional[int] | Omit = omit,
51
+ page_size: Optional[int] | Omit = omit,
52
+ search: Optional[str] | Omit = omit,
53
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54
+ # The extra values given here take precedence over values defined on the client or passed to this method.
55
+ extra_headers: Headers | None = None,
56
+ extra_query: Query | None = None,
57
+ extra_body: Body | None = None,
58
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
59
+ ) -> SampleListResponse:
60
+ """
61
+ List available samples with optional pagination, optionally filtered by dataset
62
+
63
+ Args:
64
+ dataset: Filter samples by dataset name
65
+
66
+ page: Page number (1-based). If not provided, returns all samples
67
+
68
+ page_size: Number of samples per page (max 100). If not provided, returns all samples
69
+
70
+ search: Search for samples by instance_id
71
+
72
+ extra_headers: Send extra headers
73
+
74
+ extra_query: Add additional query parameters to the request
75
+
76
+ extra_body: Add additional JSON properties to the request
77
+
78
+ timeout: Override the client-level default timeout for this request, in seconds
79
+ """
80
+ return self._get(
81
+ "/samples",
82
+ options=make_request_options(
83
+ extra_headers=extra_headers,
84
+ extra_query=extra_query,
85
+ extra_body=extra_body,
86
+ timeout=timeout,
87
+ query=maybe_transform(
88
+ {
89
+ "dataset": dataset,
90
+ "page": page,
91
+ "page_size": page_size,
92
+ "search": search,
93
+ },
94
+ sample_list_params.SampleListParams,
95
+ ),
96
+ ),
97
+ cast_to=SampleListResponse,
98
+ )
99
+
100
+ def download(
101
+ self,
102
+ sample_id: str,
103
+ *,
104
+ dataset: str,
105
+ version: Optional[int] | Omit = omit,
106
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
107
+ # The extra values given here take precedence over values defined on the client or passed to this method.
108
+ extra_headers: Headers | None = None,
109
+ extra_query: Query | None = None,
110
+ extra_body: Body | None = None,
111
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
112
+ ) -> object:
113
+ """
114
+ Download the gz file for a specific sample
115
+
116
+ Args:
117
+ extra_headers: Send extra headers
118
+
119
+ extra_query: Add additional query parameters to the request
120
+
121
+ extra_body: Add additional JSON properties to the request
122
+
123
+ timeout: Override the client-level default timeout for this request, in seconds
124
+ """
125
+ if not dataset:
126
+ raise ValueError(f"Expected a non-empty value for `dataset` but received {dataset!r}")
127
+ if not sample_id:
128
+ raise ValueError(f"Expected a non-empty value for `sample_id` but received {sample_id!r}")
129
+ return self._get(
130
+ f"/samples/{dataset}/{sample_id}/download",
131
+ options=make_request_options(
132
+ extra_headers=extra_headers,
133
+ extra_query=extra_query,
134
+ extra_body=extra_body,
135
+ timeout=timeout,
136
+ query=maybe_transform({"version": version}, sample_download_params.SampleDownloadParams),
137
+ ),
138
+ cast_to=object,
139
+ )
140
+
141
+
142
+ class AsyncSamplesResource(AsyncAPIResource):
143
+ @cached_property
144
+ def with_raw_response(self) -> AsyncSamplesResourceWithRawResponse:
145
+ """
146
+ This property can be used as a prefix for any HTTP method call to return
147
+ the raw response object instead of the parsed content.
148
+
149
+ For more information, see https://www.github.com/codeset-ai/codeset-sdk#accessing-raw-response-data-eg-headers
150
+ """
151
+ return AsyncSamplesResourceWithRawResponse(self)
152
+
153
+ @cached_property
154
+ def with_streaming_response(self) -> AsyncSamplesResourceWithStreamingResponse:
155
+ """
156
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
157
+
158
+ For more information, see https://www.github.com/codeset-ai/codeset-sdk#with_streaming_response
159
+ """
160
+ return AsyncSamplesResourceWithStreamingResponse(self)
161
+
162
+ async def list(
163
+ self,
164
+ *,
165
+ dataset: Optional[str] | Omit = omit,
166
+ page: Optional[int] | Omit = omit,
167
+ page_size: Optional[int] | Omit = omit,
168
+ search: Optional[str] | Omit = omit,
169
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
170
+ # The extra values given here take precedence over values defined on the client or passed to this method.
171
+ extra_headers: Headers | None = None,
172
+ extra_query: Query | None = None,
173
+ extra_body: Body | None = None,
174
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
175
+ ) -> SampleListResponse:
176
+ """
177
+ List available samples with optional pagination, optionally filtered by dataset
178
+
179
+ Args:
180
+ dataset: Filter samples by dataset name
181
+
182
+ page: Page number (1-based). If not provided, returns all samples
183
+
184
+ page_size: Number of samples per page (max 100). If not provided, returns all samples
185
+
186
+ search: Search for samples by instance_id
187
+
188
+ extra_headers: Send extra headers
189
+
190
+ extra_query: Add additional query parameters to the request
191
+
192
+ extra_body: Add additional JSON properties to the request
193
+
194
+ timeout: Override the client-level default timeout for this request, in seconds
195
+ """
196
+ return await self._get(
197
+ "/samples",
198
+ options=make_request_options(
199
+ extra_headers=extra_headers,
200
+ extra_query=extra_query,
201
+ extra_body=extra_body,
202
+ timeout=timeout,
203
+ query=await async_maybe_transform(
204
+ {
205
+ "dataset": dataset,
206
+ "page": page,
207
+ "page_size": page_size,
208
+ "search": search,
209
+ },
210
+ sample_list_params.SampleListParams,
211
+ ),
212
+ ),
213
+ cast_to=SampleListResponse,
214
+ )
215
+
216
+ async def download(
217
+ self,
218
+ sample_id: str,
219
+ *,
220
+ dataset: str,
221
+ version: Optional[int] | Omit = omit,
222
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
223
+ # The extra values given here take precedence over values defined on the client or passed to this method.
224
+ extra_headers: Headers | None = None,
225
+ extra_query: Query | None = None,
226
+ extra_body: Body | None = None,
227
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
228
+ ) -> object:
229
+ """
230
+ Download the gz file for a specific sample
231
+
232
+ Args:
233
+ extra_headers: Send extra headers
234
+
235
+ extra_query: Add additional query parameters to the request
236
+
237
+ extra_body: Add additional JSON properties to the request
238
+
239
+ timeout: Override the client-level default timeout for this request, in seconds
240
+ """
241
+ if not dataset:
242
+ raise ValueError(f"Expected a non-empty value for `dataset` but received {dataset!r}")
243
+ if not sample_id:
244
+ raise ValueError(f"Expected a non-empty value for `sample_id` but received {sample_id!r}")
245
+ return await self._get(
246
+ f"/samples/{dataset}/{sample_id}/download",
247
+ options=make_request_options(
248
+ extra_headers=extra_headers,
249
+ extra_query=extra_query,
250
+ extra_body=extra_body,
251
+ timeout=timeout,
252
+ query=await async_maybe_transform({"version": version}, sample_download_params.SampleDownloadParams),
253
+ ),
254
+ cast_to=object,
255
+ )
256
+
257
+
258
+ class SamplesResourceWithRawResponse:
259
+ def __init__(self, samples: SamplesResource) -> None:
260
+ self._samples = samples
261
+
262
+ self.list = to_raw_response_wrapper(
263
+ samples.list,
264
+ )
265
+ self.download = to_raw_response_wrapper(
266
+ samples.download,
267
+ )
268
+
269
+
270
+ class AsyncSamplesResourceWithRawResponse:
271
+ def __init__(self, samples: AsyncSamplesResource) -> None:
272
+ self._samples = samples
273
+
274
+ self.list = async_to_raw_response_wrapper(
275
+ samples.list,
276
+ )
277
+ self.download = async_to_raw_response_wrapper(
278
+ samples.download,
279
+ )
280
+
281
+
282
+ class SamplesResourceWithStreamingResponse:
283
+ def __init__(self, samples: SamplesResource) -> None:
284
+ self._samples = samples
285
+
286
+ self.list = to_streamed_response_wrapper(
287
+ samples.list,
288
+ )
289
+ self.download = to_streamed_response_wrapper(
290
+ samples.download,
291
+ )
292
+
293
+
294
+ class AsyncSamplesResourceWithStreamingResponse:
295
+ def __init__(self, samples: AsyncSamplesResource) -> None:
296
+ self._samples = samples
297
+
298
+ self.list = async_to_streamed_response_wrapper(
299
+ samples.list,
300
+ )
301
+ self.download = async_to_streamed_response_wrapper(
302
+ samples.download,
303
+ )
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .verify import (
4
+ VerifyResource,
5
+ AsyncVerifyResource,
6
+ VerifyResourceWithRawResponse,
7
+ AsyncVerifyResourceWithRawResponse,
8
+ VerifyResourceWithStreamingResponse,
9
+ AsyncVerifyResourceWithStreamingResponse,
10
+ )
11
+ from .sessions import (
12
+ SessionsResource,
13
+ AsyncSessionsResource,
14
+ SessionsResourceWithRawResponse,
15
+ AsyncSessionsResourceWithRawResponse,
16
+ SessionsResourceWithStreamingResponse,
17
+ AsyncSessionsResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "VerifyResource",
22
+ "AsyncVerifyResource",
23
+ "VerifyResourceWithRawResponse",
24
+ "AsyncVerifyResourceWithRawResponse",
25
+ "VerifyResourceWithStreamingResponse",
26
+ "AsyncVerifyResourceWithStreamingResponse",
27
+ "SessionsResource",
28
+ "AsyncSessionsResource",
29
+ "SessionsResourceWithRawResponse",
30
+ "AsyncSessionsResourceWithRawResponse",
31
+ "SessionsResourceWithStreamingResponse",
32
+ "AsyncSessionsResourceWithStreamingResponse",
33
+ ]