blaxel 0.2.26rc119__py3-none-any.whl → 0.2.27__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 (115) hide show
  1. blaxel/__init__.py +3 -5
  2. blaxel/core/__init__.py +9 -1
  3. blaxel/core/client/api/{privateclusters/create_private_cluster.py → images/cleanup_images.py} +31 -25
  4. blaxel/core/client/models/__init__.py +2 -4
  5. blaxel/core/client/models/agent.py +1 -0
  6. blaxel/core/client/models/agent_spec.py +1 -24
  7. blaxel/core/client/models/billable_time_metric.py +1 -0
  8. blaxel/core/{sandbox/client/models/find_match.py → client/models/cleanup_images_response_200.py} +19 -19
  9. blaxel/core/client/models/configuration.py +1 -0
  10. blaxel/core/client/models/core_event.py +9 -0
  11. blaxel/core/client/models/core_spec.py +1 -24
  12. blaxel/core/client/models/core_spec_configurations.py +1 -0
  13. blaxel/core/client/models/create_job_execution_request.py +1 -0
  14. blaxel/core/client/models/create_job_execution_response.py +1 -0
  15. blaxel/core/client/models/custom_domain.py +1 -0
  16. blaxel/core/client/models/custom_domain_metadata.py +1 -0
  17. blaxel/core/client/models/custom_domain_spec.py +1 -0
  18. blaxel/core/client/models/delete_volume_template_version_response_200.py +1 -0
  19. blaxel/core/client/models/entrypoint.py +1 -0
  20. blaxel/core/client/models/form.py +1 -0
  21. blaxel/core/client/models/function.py +1 -0
  22. blaxel/core/client/models/function_spec.py +1 -24
  23. blaxel/core/client/models/image.py +1 -0
  24. blaxel/core/client/models/image_spec.py +1 -0
  25. blaxel/core/client/models/integration.py +1 -0
  26. blaxel/core/client/models/integration_connection.py +1 -0
  27. blaxel/core/client/models/integration_connection_spec.py +1 -0
  28. blaxel/core/client/models/integration_endpoint.py +1 -0
  29. blaxel/core/client/models/integration_endpoints.py +2 -0
  30. blaxel/core/client/models/job.py +1 -0
  31. blaxel/core/client/models/job_execution.py +1 -0
  32. blaxel/core/client/models/job_execution_spec.py +1 -0
  33. blaxel/core/client/models/job_execution_task.py +1 -0
  34. blaxel/core/client/models/job_metrics.py +1 -0
  35. blaxel/core/client/models/job_spec.py +1 -24
  36. blaxel/core/client/models/jobs_network_chart.py +1 -0
  37. blaxel/core/client/models/jobs_success_failed_chart.py +1 -0
  38. blaxel/core/client/models/latency_metric.py +1 -0
  39. blaxel/core/client/models/location_response.py +1 -0
  40. blaxel/core/client/models/mcp_definition.py +1 -0
  41. blaxel/core/client/models/metadata.py +1 -0
  42. blaxel/core/client/models/metrics.py +34 -0
  43. blaxel/core/client/models/model.py +1 -0
  44. blaxel/core/client/models/model_spec.py +1 -24
  45. blaxel/core/client/models/pending_invitation_accept.py +1 -0
  46. blaxel/core/client/models/pending_invitation_render.py +1 -0
  47. blaxel/core/client/models/policy.py +1 -0
  48. blaxel/core/client/models/policy_spec.py +1 -0
  49. blaxel/core/client/models/preview.py +1 -0
  50. blaxel/core/client/models/preview_spec.py +1 -0
  51. blaxel/core/client/models/preview_token.py +1 -0
  52. blaxel/core/client/models/public_ips.py +1 -0
  53. blaxel/core/client/models/request_duration_over_time_metrics.py +1 -0
  54. blaxel/core/client/models/request_total_by_origin_metric.py +1 -0
  55. blaxel/core/client/models/request_total_metric.py +1 -0
  56. blaxel/core/client/models/resource_metrics.py +1 -0
  57. blaxel/core/client/models/revision_configuration.py +9 -0
  58. blaxel/core/client/models/runtime.py +1 -0
  59. blaxel/core/client/models/sandbox.py +1 -0
  60. blaxel/core/client/models/sandbox_definition.py +1 -0
  61. blaxel/core/client/models/sandbox_lifecycle.py +1 -0
  62. blaxel/core/client/models/sandbox_spec.py +1 -24
  63. blaxel/core/client/models/serverless_config.py +1 -0
  64. blaxel/core/client/models/start_sandbox.py +1 -0
  65. blaxel/core/client/models/stop_sandbox.py +1 -0
  66. blaxel/core/client/models/store_agent.py +1 -0
  67. blaxel/core/client/models/store_configuration.py +1 -0
  68. blaxel/core/client/models/template.py +1 -0
  69. blaxel/core/client/models/time_to_first_token_over_time_metrics.py +1 -0
  70. blaxel/core/client/models/token_rate_metrics.py +1 -0
  71. blaxel/core/client/models/trigger.py +10 -0
  72. blaxel/core/client/models/trigger_configuration.py +28 -0
  73. blaxel/core/client/models/volume.py +1 -0
  74. blaxel/core/client/models/volume_template.py +1 -0
  75. blaxel/core/client/models/websocket_channel.py +9 -0
  76. blaxel/core/client/models/workspace.py +1 -0
  77. blaxel/core/client/response_interceptor.py +0 -1
  78. blaxel/core/common/__init__.py +11 -2
  79. blaxel/core/common/autoload.py +1 -85
  80. blaxel/core/common/settings.py +56 -16
  81. blaxel/core/common/webhook.py +187 -0
  82. blaxel/core/jobs/__init__.py +352 -3
  83. blaxel/core/sandbox/client/models/__init__.py +0 -16
  84. blaxel/core/sandbox/default/action.py +10 -27
  85. blaxel/core/sandbox/default/filesystem.py +47 -185
  86. blaxel/core/sandbox/default/interpreter.py +55 -62
  87. blaxel/core/sandbox/default/process.py +46 -66
  88. {blaxel-0.2.26rc119.dist-info → blaxel-0.2.27.dist-info}/METADATA +2 -3
  89. {blaxel-0.2.26rc119.dist-info → blaxel-0.2.27.dist-info}/RECORD +91 -114
  90. blaxel/core/client/api/privateclusters/__init__.py +0 -0
  91. blaxel/core/client/api/privateclusters/delete_private_cluster.py +0 -152
  92. blaxel/core/client/api/privateclusters/get_private_cluster.py +0 -155
  93. blaxel/core/client/api/privateclusters/get_private_cluster_health.py +0 -97
  94. blaxel/core/client/api/privateclusters/list_private_clusters.py +0 -136
  95. blaxel/core/client/api/privateclusters/update_private_cluster.py +0 -152
  96. blaxel/core/client/api/privateclusters/update_private_cluster_health.py +0 -97
  97. blaxel/core/client/models/model_private_cluster.py +0 -79
  98. blaxel/core/client/models/private_cluster.py +0 -183
  99. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_tree_path.py +0 -188
  100. blaxel/core/sandbox/client/api/filesystem/get_filesystem_content_search_path.py +0 -265
  101. blaxel/core/sandbox/client/api/filesystem/get_filesystem_find_path.py +0 -248
  102. blaxel/core/sandbox/client/api/filesystem/get_filesystem_search_path.py +0 -237
  103. blaxel/core/sandbox/client/api/filesystem/get_filesystem_tree_path.py +0 -197
  104. blaxel/core/sandbox/client/api/filesystem/put_filesystem_tree_path.py +0 -223
  105. blaxel/core/sandbox/client/api/websocket/__init__.py +0 -0
  106. blaxel/core/sandbox/client/api/websocket/get_ws.py +0 -81
  107. blaxel/core/sandbox/client/models/content_search_match.py +0 -98
  108. blaxel/core/sandbox/client/models/content_search_response.py +0 -97
  109. blaxel/core/sandbox/client/models/find_response.py +0 -88
  110. blaxel/core/sandbox/client/models/fuzzy_search_match.py +0 -78
  111. blaxel/core/sandbox/client/models/fuzzy_search_response.py +0 -88
  112. blaxel/core/sandbox/client/models/tree_request.py +0 -76
  113. blaxel/core/sandbox/client/models/tree_request_files.py +0 -49
  114. {blaxel-0.2.26rc119.dist-info → blaxel-0.2.27.dist-info}/WHEEL +0 -0
  115. {blaxel-0.2.26rc119.dist-info → blaxel-0.2.27.dist-info}/licenses/LICENSE +0 -0
@@ -1,237 +0,0 @@
1
- from http import HTTPStatus
2
- from typing import Any, Union
3
-
4
- import httpx
5
-
6
- from ... import errors
7
- from ...client import Client
8
- from ...models.error_response import ErrorResponse
9
- from ...models.fuzzy_search_response import FuzzySearchResponse
10
- from ...types import UNSET, Response, Unset
11
-
12
-
13
- def _get_kwargs(
14
- path: str,
15
- *,
16
- max_results: Union[Unset, int] = UNSET,
17
- patterns: Union[Unset, str] = UNSET,
18
- exclude_dirs: Union[Unset, str] = UNSET,
19
- exclude_hidden: Union[Unset, bool] = UNSET,
20
- ) -> dict[str, Any]:
21
- params: dict[str, Any] = {}
22
-
23
- params["maxResults"] = max_results
24
-
25
- params["patterns"] = patterns
26
-
27
- params["excludeDirs"] = exclude_dirs
28
-
29
- params["excludeHidden"] = exclude_hidden
30
-
31
- params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
32
-
33
- _kwargs: dict[str, Any] = {
34
- "method": "get",
35
- "url": f"/filesystem-search/{path}",
36
- "params": params,
37
- }
38
-
39
- return _kwargs
40
-
41
-
42
- def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, FuzzySearchResponse] | None:
43
- if response.status_code == 200:
44
- response_200 = FuzzySearchResponse.from_dict(response.json())
45
-
46
- return response_200
47
- if response.status_code == 400:
48
- response_400 = ErrorResponse.from_dict(response.json())
49
-
50
- return response_400
51
- if response.status_code == 422:
52
- response_422 = ErrorResponse.from_dict(response.json())
53
-
54
- return response_422
55
- if response.status_code == 500:
56
- response_500 = ErrorResponse.from_dict(response.json())
57
-
58
- return response_500
59
- if client.raise_on_unexpected_status:
60
- raise errors.UnexpectedStatus(response.status_code, response.content)
61
- else:
62
- return None
63
-
64
-
65
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, FuzzySearchResponse]]:
66
- return Response(
67
- status_code=HTTPStatus(response.status_code),
68
- content=response.content,
69
- headers=response.headers,
70
- parsed=_parse_response(client=client, response=response),
71
- )
72
-
73
-
74
- def sync_detailed(
75
- path: str,
76
- *,
77
- client: Union[Client],
78
- max_results: Union[Unset, int] = UNSET,
79
- patterns: Union[Unset, str] = UNSET,
80
- exclude_dirs: Union[Unset, str] = UNSET,
81
- exclude_hidden: Union[Unset, bool] = UNSET,
82
- ) -> Response[Union[ErrorResponse, FuzzySearchResponse]]:
83
- """Fuzzy search for files and directories
84
-
85
- Performs fuzzy search on filesystem paths using fuzzy matching algorithm. Optimized alternative to
86
- find and grep commands.
87
-
88
- Args:
89
- path (str):
90
- max_results (Union[Unset, int]):
91
- patterns (Union[Unset, str]):
92
- exclude_dirs (Union[Unset, str]):
93
- exclude_hidden (Union[Unset, bool]):
94
-
95
- Raises:
96
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97
- httpx.TimeoutException: If the request takes longer than Client.timeout.
98
-
99
- Returns:
100
- Response[Union[ErrorResponse, FuzzySearchResponse]]
101
- """
102
-
103
- kwargs = _get_kwargs(
104
- path=path,
105
- max_results=max_results,
106
- patterns=patterns,
107
- exclude_dirs=exclude_dirs,
108
- exclude_hidden=exclude_hidden,
109
- )
110
-
111
- response = client.get_httpx_client().request(
112
- **kwargs,
113
- )
114
-
115
- return _build_response(client=client, response=response)
116
-
117
-
118
- def sync(
119
- path: str,
120
- *,
121
- client: Union[Client],
122
- max_results: Union[Unset, int] = UNSET,
123
- patterns: Union[Unset, str] = UNSET,
124
- exclude_dirs: Union[Unset, str] = UNSET,
125
- exclude_hidden: Union[Unset, bool] = UNSET,
126
- ) -> Union[ErrorResponse, FuzzySearchResponse] | None:
127
- """Fuzzy search for files and directories
128
-
129
- Performs fuzzy search on filesystem paths using fuzzy matching algorithm. Optimized alternative to
130
- find and grep commands.
131
-
132
- Args:
133
- path (str):
134
- max_results (Union[Unset, int]):
135
- patterns (Union[Unset, str]):
136
- exclude_dirs (Union[Unset, str]):
137
- exclude_hidden (Union[Unset, bool]):
138
-
139
- Raises:
140
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
141
- httpx.TimeoutException: If the request takes longer than Client.timeout.
142
-
143
- Returns:
144
- Union[ErrorResponse, FuzzySearchResponse]
145
- """
146
-
147
- return sync_detailed(
148
- path=path,
149
- client=client,
150
- max_results=max_results,
151
- patterns=patterns,
152
- exclude_dirs=exclude_dirs,
153
- exclude_hidden=exclude_hidden,
154
- ).parsed
155
-
156
-
157
- async def asyncio_detailed(
158
- path: str,
159
- *,
160
- client: Union[Client],
161
- max_results: Union[Unset, int] = UNSET,
162
- patterns: Union[Unset, str] = UNSET,
163
- exclude_dirs: Union[Unset, str] = UNSET,
164
- exclude_hidden: Union[Unset, bool] = UNSET,
165
- ) -> Response[Union[ErrorResponse, FuzzySearchResponse]]:
166
- """Fuzzy search for files and directories
167
-
168
- Performs fuzzy search on filesystem paths using fuzzy matching algorithm. Optimized alternative to
169
- find and grep commands.
170
-
171
- Args:
172
- path (str):
173
- max_results (Union[Unset, int]):
174
- patterns (Union[Unset, str]):
175
- exclude_dirs (Union[Unset, str]):
176
- exclude_hidden (Union[Unset, bool]):
177
-
178
- Raises:
179
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
180
- httpx.TimeoutException: If the request takes longer than Client.timeout.
181
-
182
- Returns:
183
- Response[Union[ErrorResponse, FuzzySearchResponse]]
184
- """
185
-
186
- kwargs = _get_kwargs(
187
- path=path,
188
- max_results=max_results,
189
- patterns=patterns,
190
- exclude_dirs=exclude_dirs,
191
- exclude_hidden=exclude_hidden,
192
- )
193
-
194
- response = await client.get_async_httpx_client().request(**kwargs)
195
-
196
- return _build_response(client=client, response=response)
197
-
198
-
199
- async def asyncio(
200
- path: str,
201
- *,
202
- client: Union[Client],
203
- max_results: Union[Unset, int] = UNSET,
204
- patterns: Union[Unset, str] = UNSET,
205
- exclude_dirs: Union[Unset, str] = UNSET,
206
- exclude_hidden: Union[Unset, bool] = UNSET,
207
- ) -> Union[ErrorResponse, FuzzySearchResponse] | None:
208
- """Fuzzy search for files and directories
209
-
210
- Performs fuzzy search on filesystem paths using fuzzy matching algorithm. Optimized alternative to
211
- find and grep commands.
212
-
213
- Args:
214
- path (str):
215
- max_results (Union[Unset, int]):
216
- patterns (Union[Unset, str]):
217
- exclude_dirs (Union[Unset, str]):
218
- exclude_hidden (Union[Unset, bool]):
219
-
220
- Raises:
221
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
222
- httpx.TimeoutException: If the request takes longer than Client.timeout.
223
-
224
- Returns:
225
- Union[ErrorResponse, FuzzySearchResponse]
226
- """
227
-
228
- return (
229
- await asyncio_detailed(
230
- path=path,
231
- client=client,
232
- max_results=max_results,
233
- patterns=patterns,
234
- exclude_dirs=exclude_dirs,
235
- exclude_hidden=exclude_hidden,
236
- )
237
- ).parsed
@@ -1,197 +0,0 @@
1
- from http import HTTPStatus
2
- from io import BytesIO
3
- from typing import Any, Union
4
-
5
- import httpx
6
-
7
- from ... import errors
8
- from ...client import Client
9
- from ...models.directory import Directory
10
- from ...models.error_response import ErrorResponse
11
- from ...models.file_with_content import FileWithContent
12
- from ...types import File, Response
13
-
14
-
15
- def _get_kwargs(
16
- path: str,
17
- ) -> dict[str, Any]:
18
- _kwargs: dict[str, Any] = {
19
- "method": "get",
20
- "url": f"/filesystem/tree/{path}",
21
- }
22
-
23
- return _kwargs
24
-
25
-
26
- def _parse_response(
27
- *, client: Client, response: httpx.Response
28
- ) -> Union[ErrorResponse, Union["Directory", "FileWithContent", File]] | None:
29
- if response.status_code == 200:
30
-
31
- def _parse_response_200(data: object) -> Union["Directory", "FileWithContent", File]:
32
- try:
33
- if not isinstance(data, dict):
34
- raise TypeError()
35
- response_200_type_0 = Directory.from_dict(data)
36
-
37
- return response_200_type_0
38
- except: # noqa: E722
39
- pass
40
- try:
41
- if not isinstance(data, dict):
42
- raise TypeError()
43
- response_200_type_1 = FileWithContent.from_dict(data)
44
-
45
- return response_200_type_1
46
- except: # noqa: E722
47
- pass
48
- if not isinstance(data, bytes):
49
- raise TypeError()
50
- response_200_type_2 = File(payload=BytesIO(data))
51
-
52
- return response_200_type_2
53
-
54
- response_200 = _parse_response_200(response.json())
55
-
56
- return response_200
57
- if response.status_code == 400:
58
- response_400 = ErrorResponse.from_dict(response.json())
59
-
60
- return response_400
61
- if response.status_code == 422:
62
- response_422 = ErrorResponse.from_dict(response.json())
63
-
64
- return response_422
65
- if response.status_code == 500:
66
- response_500 = ErrorResponse.from_dict(response.json())
67
-
68
- return response_500
69
- if client.raise_on_unexpected_status:
70
- raise errors.UnexpectedStatus(response.status_code, response.content)
71
- else:
72
- return None
73
-
74
-
75
- def _build_response(
76
- *, client: Client, response: httpx.Response
77
- ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent", File]]]:
78
- return Response(
79
- status_code=HTTPStatus(response.status_code),
80
- content=response.content,
81
- headers=response.headers,
82
- parsed=_parse_response(client=client, response=response),
83
- )
84
-
85
-
86
- def sync_detailed(
87
- path: str,
88
- *,
89
- client: Union[Client],
90
- ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent", File]]]:
91
- """Get directory tree
92
-
93
- Get a recursive directory tree structure starting from the specified path
94
-
95
- Args:
96
- path (str):
97
-
98
- Raises:
99
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100
- httpx.TimeoutException: If the request takes longer than Client.timeout.
101
-
102
- Returns:
103
- Response[Union[ErrorResponse, Union['Directory', 'FileWithContent', File]]]
104
- """
105
-
106
- kwargs = _get_kwargs(
107
- path=path,
108
- )
109
-
110
- response = client.get_httpx_client().request(
111
- **kwargs,
112
- )
113
-
114
- return _build_response(client=client, response=response)
115
-
116
-
117
- def sync(
118
- path: str,
119
- *,
120
- client: Union[Client],
121
- ) -> Union[ErrorResponse, Union["Directory", "FileWithContent", File]] | None:
122
- """Get directory tree
123
-
124
- Get a recursive directory tree structure starting from the specified path
125
-
126
- Args:
127
- path (str):
128
-
129
- Raises:
130
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
131
- httpx.TimeoutException: If the request takes longer than Client.timeout.
132
-
133
- Returns:
134
- Union[ErrorResponse, Union['Directory', 'FileWithContent', File]]
135
- """
136
-
137
- return sync_detailed(
138
- path=path,
139
- client=client,
140
- ).parsed
141
-
142
-
143
- async def asyncio_detailed(
144
- path: str,
145
- *,
146
- client: Union[Client],
147
- ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent", File]]]:
148
- """Get directory tree
149
-
150
- Get a recursive directory tree structure starting from the specified path
151
-
152
- Args:
153
- path (str):
154
-
155
- Raises:
156
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157
- httpx.TimeoutException: If the request takes longer than Client.timeout.
158
-
159
- Returns:
160
- Response[Union[ErrorResponse, Union['Directory', 'FileWithContent', File]]]
161
- """
162
-
163
- kwargs = _get_kwargs(
164
- path=path,
165
- )
166
-
167
- response = await client.get_async_httpx_client().request(**kwargs)
168
-
169
- return _build_response(client=client, response=response)
170
-
171
-
172
- async def asyncio(
173
- path: str,
174
- *,
175
- client: Union[Client],
176
- ) -> Union[ErrorResponse, Union["Directory", "FileWithContent", File]] | None:
177
- """Get directory tree
178
-
179
- Get a recursive directory tree structure starting from the specified path
180
-
181
- Args:
182
- path (str):
183
-
184
- Raises:
185
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
186
- httpx.TimeoutException: If the request takes longer than Client.timeout.
187
-
188
- Returns:
189
- Union[ErrorResponse, Union['Directory', 'FileWithContent', File]]
190
- """
191
-
192
- return (
193
- await asyncio_detailed(
194
- path=path,
195
- client=client,
196
- )
197
- ).parsed
@@ -1,223 +0,0 @@
1
- from http import HTTPStatus
2
- from io import BytesIO
3
- from typing import Any, Union
4
-
5
- import httpx
6
-
7
- from ... import errors
8
- from ...client import Client
9
- from ...models.directory import Directory
10
- from ...models.error_response import ErrorResponse
11
- from ...models.file_with_content import FileWithContent
12
- from ...models.tree_request import TreeRequest
13
- from ...types import File, Response
14
-
15
-
16
- def _get_kwargs(
17
- path: str,
18
- *,
19
- body: TreeRequest,
20
- ) -> dict[str, Any]:
21
- headers: dict[str, Any] = {}
22
-
23
- _kwargs: dict[str, Any] = {
24
- "method": "put",
25
- "url": f"/filesystem/tree/{path}",
26
- }
27
-
28
- if type(body) is dict:
29
- _body = body
30
- else:
31
- _body = body.to_dict()
32
-
33
- _kwargs["json"] = _body
34
- headers["Content-Type"] = "application/json"
35
-
36
- _kwargs["headers"] = headers
37
- return _kwargs
38
-
39
-
40
- def _parse_response(
41
- *, client: Client, response: httpx.Response
42
- ) -> Union[ErrorResponse, Union["Directory", "FileWithContent", File]] | None:
43
- if response.status_code == 200:
44
-
45
- def _parse_response_200(data: object) -> Union["Directory", "FileWithContent", File]:
46
- try:
47
- if not isinstance(data, dict):
48
- raise TypeError()
49
- response_200_type_0 = Directory.from_dict(data)
50
-
51
- return response_200_type_0
52
- except: # noqa: E722
53
- pass
54
- try:
55
- if not isinstance(data, dict):
56
- raise TypeError()
57
- response_200_type_1 = FileWithContent.from_dict(data)
58
-
59
- return response_200_type_1
60
- except: # noqa: E722
61
- pass
62
- if not isinstance(data, bytes):
63
- raise TypeError()
64
- response_200_type_2 = File(payload=BytesIO(data))
65
-
66
- return response_200_type_2
67
-
68
- response_200 = _parse_response_200(response.json())
69
-
70
- return response_200
71
- if response.status_code == 400:
72
- response_400 = ErrorResponse.from_dict(response.json())
73
-
74
- return response_400
75
- if response.status_code == 422:
76
- response_422 = ErrorResponse.from_dict(response.json())
77
-
78
- return response_422
79
- if response.status_code == 500:
80
- response_500 = ErrorResponse.from_dict(response.json())
81
-
82
- return response_500
83
- if client.raise_on_unexpected_status:
84
- raise errors.UnexpectedStatus(response.status_code, response.content)
85
- else:
86
- return None
87
-
88
-
89
- def _build_response(
90
- *, client: Client, response: httpx.Response
91
- ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent", File]]]:
92
- return Response(
93
- status_code=HTTPStatus(response.status_code),
94
- content=response.content,
95
- headers=response.headers,
96
- parsed=_parse_response(client=client, response=response),
97
- )
98
-
99
-
100
- def sync_detailed(
101
- path: str,
102
- *,
103
- client: Union[Client],
104
- body: TreeRequest,
105
- ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent", File]]]:
106
- """Create or update directory tree
107
-
108
- Create or update multiple files within a directory tree structure
109
-
110
- Args:
111
- path (str):
112
- body (TreeRequest):
113
-
114
- Raises:
115
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
- httpx.TimeoutException: If the request takes longer than Client.timeout.
117
-
118
- Returns:
119
- Response[Union[ErrorResponse, Union['Directory', 'FileWithContent', File]]]
120
- """
121
-
122
- kwargs = _get_kwargs(
123
- path=path,
124
- body=body,
125
- )
126
-
127
- response = client.get_httpx_client().request(
128
- **kwargs,
129
- )
130
-
131
- return _build_response(client=client, response=response)
132
-
133
-
134
- def sync(
135
- path: str,
136
- *,
137
- client: Union[Client],
138
- body: TreeRequest,
139
- ) -> Union[ErrorResponse, Union["Directory", "FileWithContent", File]] | None:
140
- """Create or update directory tree
141
-
142
- Create or update multiple files within a directory tree structure
143
-
144
- Args:
145
- path (str):
146
- body (TreeRequest):
147
-
148
- Raises:
149
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
150
- httpx.TimeoutException: If the request takes longer than Client.timeout.
151
-
152
- Returns:
153
- Union[ErrorResponse, Union['Directory', 'FileWithContent', File]]
154
- """
155
-
156
- return sync_detailed(
157
- path=path,
158
- client=client,
159
- body=body,
160
- ).parsed
161
-
162
-
163
- async def asyncio_detailed(
164
- path: str,
165
- *,
166
- client: Union[Client],
167
- body: TreeRequest,
168
- ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent", File]]]:
169
- """Create or update directory tree
170
-
171
- Create or update multiple files within a directory tree structure
172
-
173
- Args:
174
- path (str):
175
- body (TreeRequest):
176
-
177
- Raises:
178
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
179
- httpx.TimeoutException: If the request takes longer than Client.timeout.
180
-
181
- Returns:
182
- Response[Union[ErrorResponse, Union['Directory', 'FileWithContent', File]]]
183
- """
184
-
185
- kwargs = _get_kwargs(
186
- path=path,
187
- body=body,
188
- )
189
-
190
- response = await client.get_async_httpx_client().request(**kwargs)
191
-
192
- return _build_response(client=client, response=response)
193
-
194
-
195
- async def asyncio(
196
- path: str,
197
- *,
198
- client: Union[Client],
199
- body: TreeRequest,
200
- ) -> Union[ErrorResponse, Union["Directory", "FileWithContent", File]] | None:
201
- """Create or update directory tree
202
-
203
- Create or update multiple files within a directory tree structure
204
-
205
- Args:
206
- path (str):
207
- body (TreeRequest):
208
-
209
- Raises:
210
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
211
- httpx.TimeoutException: If the request takes longer than Client.timeout.
212
-
213
- Returns:
214
- Union[ErrorResponse, Union['Directory', 'FileWithContent', File]]
215
- """
216
-
217
- return (
218
- await asyncio_detailed(
219
- path=path,
220
- client=client,
221
- body=body,
222
- )
223
- ).parsed
File without changes