blaxel 0.2.35__py3-none-any.whl → 0.2.37__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 (58) hide show
  1. blaxel/__init__.py +2 -2
  2. blaxel/core/client/api/compute/create_sandbox.py +21 -1
  3. blaxel/core/client/api/jobs/create_job_execution.py +12 -12
  4. blaxel/core/client/api/volumes/update_volume.py +187 -0
  5. blaxel/core/client/models/__init__.py +10 -6
  6. blaxel/core/client/models/{create_job_execution_response.py → create_job_execution_output.py} +11 -13
  7. blaxel/core/client/models/{create_job_execution_response_tasks_item.py → create_job_execution_output_tasks_item.py} +5 -5
  8. blaxel/core/client/models/create_job_execution_request.py +31 -0
  9. blaxel/core/client/models/create_job_execution_request_env.py +50 -0
  10. blaxel/core/client/models/function_runtime.py +18 -0
  11. blaxel/core/client/models/{function_spec_transport.py → function_runtime_transport.py} +2 -2
  12. blaxel/core/client/models/function_spec.py +0 -18
  13. blaxel/core/client/models/job_execution_spec.py +35 -0
  14. blaxel/core/client/models/job_execution_spec_env_override.py +50 -0
  15. blaxel/core/client/models/port_protocol.py +1 -0
  16. blaxel/core/client/models/preview.py +48 -1
  17. blaxel/core/client/models/sandbox.py +10 -0
  18. blaxel/core/common/settings.py +5 -0
  19. blaxel/core/jobs/__init__.py +60 -88
  20. blaxel/core/sandbox/__init__.py +12 -0
  21. blaxel/core/{client/api/invitations/list_all_pending_invitations.py → sandbox/client/api/system/get_health.py} +26 -34
  22. blaxel/core/sandbox/client/api/system/post_upgrade.py +196 -0
  23. blaxel/core/sandbox/client/models/__init__.py +8 -0
  24. blaxel/core/sandbox/client/models/content_search_match.py +24 -25
  25. blaxel/core/sandbox/client/models/content_search_response.py +25 -29
  26. blaxel/core/sandbox/client/models/find_match.py +13 -14
  27. blaxel/core/sandbox/client/models/find_response.py +21 -24
  28. blaxel/core/sandbox/client/models/fuzzy_search_match.py +17 -19
  29. blaxel/core/sandbox/client/models/fuzzy_search_response.py +21 -24
  30. blaxel/core/sandbox/client/models/health_response.py +159 -0
  31. blaxel/core/sandbox/client/models/process_upgrade_state.py +20 -0
  32. blaxel/core/sandbox/client/models/upgrade_request.py +71 -0
  33. blaxel/core/sandbox/client/models/upgrade_status.py +125 -0
  34. blaxel/core/sandbox/default/__init__.py +2 -0
  35. blaxel/core/sandbox/default/filesystem.py +20 -6
  36. blaxel/core/sandbox/default/preview.py +48 -1
  37. blaxel/core/sandbox/default/process.py +66 -21
  38. blaxel/core/sandbox/default/sandbox.py +104 -6
  39. blaxel/core/sandbox/default/system.py +71 -0
  40. blaxel/core/sandbox/sync/__init__.py +2 -0
  41. blaxel/core/sandbox/sync/filesystem.py +19 -2
  42. blaxel/core/sandbox/sync/preview.py +50 -3
  43. blaxel/core/sandbox/sync/process.py +38 -15
  44. blaxel/core/sandbox/sync/sandbox.py +97 -5
  45. blaxel/core/sandbox/sync/system.py +71 -0
  46. blaxel/core/sandbox/types.py +212 -5
  47. blaxel/core/volume/volume.py +209 -4
  48. blaxel/langgraph/model.py +25 -14
  49. blaxel/langgraph/tools.py +15 -12
  50. blaxel/llamaindex/model.py +33 -24
  51. blaxel/llamaindex/tools.py +9 -4
  52. blaxel/pydantic/model.py +26 -12
  53. blaxel-0.2.37.dist-info/METADATA +569 -0
  54. {blaxel-0.2.35.dist-info → blaxel-0.2.37.dist-info}/RECORD +57 -47
  55. blaxel-0.2.35.dist-info/METADATA +0 -228
  56. /blaxel/core/{client/api/invitations → sandbox/client/api/system}/__init__.py +0 -0
  57. {blaxel-0.2.35.dist-info → blaxel-0.2.37.dist-info}/WHEEL +0 -0
  58. {blaxel-0.2.35.dist-info → blaxel-0.2.37.dist-info}/licenses/LICENSE +0 -0
@@ -12,6 +12,7 @@ from .default import (
12
12
  SandboxInstance,
13
13
  SandboxPreviews,
14
14
  SandboxProcess,
15
+ SandboxSystem,
15
16
  )
16
17
  from .sync import (
17
18
  SyncCodeInterpreter,
@@ -20,8 +21,11 @@ from .sync import (
20
21
  SyncSandboxInstance,
21
22
  SyncSandboxPreviews,
22
23
  SyncSandboxProcess,
24
+ SyncSandboxSystem,
23
25
  )
24
26
  from .types import (
27
+ AsyncStreamHandle,
28
+ AsyncWatchHandle,
25
29
  CopyResponse,
26
30
  ProcessRequestWithLog,
27
31
  ProcessResponseWithLog,
@@ -30,7 +34,9 @@ from .types import (
30
34
  SandboxFilesystemFile,
31
35
  SessionCreateOptions,
32
36
  SessionWithToken,
37
+ StreamHandle,
33
38
  WatchEvent,
39
+ WatchHandle,
34
40
  )
35
41
 
36
42
  __all__ = [
@@ -41,6 +47,10 @@ __all__ = [
41
47
  "SandboxConfiguration",
42
48
  "SandboxCreateConfiguration",
43
49
  "WatchEvent",
50
+ "WatchHandle",
51
+ "AsyncWatchHandle",
52
+ "StreamHandle",
53
+ "AsyncStreamHandle",
44
54
  "SandboxFilesystemFile",
45
55
  "CopyResponse",
46
56
  "Sandbox",
@@ -48,6 +58,7 @@ __all__ = [
48
58
  "SandboxPreviews",
49
59
  "SandboxProcess",
50
60
  "SandboxCodegen",
61
+ "SandboxSystem",
51
62
  "ProcessRequestWithLog",
52
63
  "ProcessResponseWithLog",
53
64
  "ApplyEditRequest",
@@ -59,6 +70,7 @@ __all__ = [
59
70
  "SyncSandboxInstance",
60
71
  "SyncSandboxPreviews",
61
72
  "SyncSandboxProcess",
73
+ "SyncSandboxSystem",
62
74
  "SyncCodeInterpreter",
63
75
  "CodeInterpreter",
64
76
  ]
@@ -1,47 +1,35 @@
1
1
  from http import HTTPStatus
2
- from typing import Any, Union, cast
2
+ from typing import Any
3
3
 
4
4
  import httpx
5
5
 
6
6
  from ... import errors
7
7
  from ...client import Client
8
- from ...models.pending_invitation_render import PendingInvitationRender
8
+ from ...models.health_response import HealthResponse
9
9
  from ...types import Response
10
10
 
11
11
 
12
12
  def _get_kwargs() -> dict[str, Any]:
13
13
  _kwargs: dict[str, Any] = {
14
14
  "method": "get",
15
- "url": "/profile/invitations",
15
+ "url": "/health",
16
16
  }
17
17
 
18
18
  return _kwargs
19
19
 
20
20
 
21
- def _parse_response(
22
- *, client: Client, response: httpx.Response
23
- ) -> Union[Any, list["PendingInvitationRender"]] | None:
21
+ def _parse_response(*, client: Client, response: httpx.Response) -> HealthResponse | None:
24
22
  if response.status_code == 200:
25
- response_200 = []
26
- _response_200 = response.json()
27
- for response_200_item_data in _response_200:
28
- response_200_item = PendingInvitationRender.from_dict(response_200_item_data)
29
-
30
- response_200.append(response_200_item)
23
+ response_200 = HealthResponse.from_dict(response.json())
31
24
 
32
25
  return response_200
33
- if response.status_code == 404:
34
- response_404 = cast(Any, None)
35
- return response_404
36
26
  if client.raise_on_unexpected_status:
37
27
  raise errors.UnexpectedStatus(response.status_code, response.content)
38
28
  else:
39
29
  return None
40
30
 
41
31
 
42
- def _build_response(
43
- *, client: Client, response: httpx.Response
44
- ) -> Response[Union[Any, list["PendingInvitationRender"]]]:
32
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[HealthResponse]:
45
33
  return Response(
46
34
  status_code=HTTPStatus(response.status_code),
47
35
  content=response.content,
@@ -53,17 +41,18 @@ def _build_response(
53
41
  def sync_detailed(
54
42
  *,
55
43
  client: Client,
56
- ) -> Response[Union[Any, list["PendingInvitationRender"]]]:
57
- """List pending invitations
44
+ ) -> Response[HealthResponse]:
45
+ """Health check
58
46
 
59
- Returns a list of all pending invitations in the workspace.
47
+ Returns health status and system information including upgrade count and binary details
48
+ Also includes last upgrade attempt status with detailed error information if available
60
49
 
61
50
  Raises:
62
51
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
63
52
  httpx.TimeoutException: If the request takes longer than Client.timeout.
64
53
 
65
54
  Returns:
66
- Response[Union[Any, list['PendingInvitationRender']]]
55
+ Response[HealthResponse]
67
56
  """
68
57
 
69
58
  kwargs = _get_kwargs()
@@ -78,17 +67,18 @@ def sync_detailed(
78
67
  def sync(
79
68
  *,
80
69
  client: Client,
81
- ) -> Union[Any, list["PendingInvitationRender"]] | None:
82
- """List pending invitations
70
+ ) -> HealthResponse | None:
71
+ """Health check
83
72
 
84
- Returns a list of all pending invitations in the workspace.
73
+ Returns health status and system information including upgrade count and binary details
74
+ Also includes last upgrade attempt status with detailed error information if available
85
75
 
86
76
  Raises:
87
77
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
88
78
  httpx.TimeoutException: If the request takes longer than Client.timeout.
89
79
 
90
80
  Returns:
91
- Union[Any, list['PendingInvitationRender']]
81
+ HealthResponse
92
82
  """
93
83
 
94
84
  return sync_detailed(
@@ -99,17 +89,18 @@ def sync(
99
89
  async def asyncio_detailed(
100
90
  *,
101
91
  client: Client,
102
- ) -> Response[Union[Any, list["PendingInvitationRender"]]]:
103
- """List pending invitations
92
+ ) -> Response[HealthResponse]:
93
+ """Health check
104
94
 
105
- Returns a list of all pending invitations in the workspace.
95
+ Returns health status and system information including upgrade count and binary details
96
+ Also includes last upgrade attempt status with detailed error information if available
106
97
 
107
98
  Raises:
108
99
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109
100
  httpx.TimeoutException: If the request takes longer than Client.timeout.
110
101
 
111
102
  Returns:
112
- Response[Union[Any, list['PendingInvitationRender']]]
103
+ Response[HealthResponse]
113
104
  """
114
105
 
115
106
  kwargs = _get_kwargs()
@@ -122,17 +113,18 @@ async def asyncio_detailed(
122
113
  async def asyncio(
123
114
  *,
124
115
  client: Client,
125
- ) -> Union[Any, list["PendingInvitationRender"]] | None:
126
- """List pending invitations
116
+ ) -> HealthResponse | None:
117
+ """Health check
127
118
 
128
- Returns a list of all pending invitations in the workspace.
119
+ Returns health status and system information including upgrade count and binary details
120
+ Also includes last upgrade attempt status with detailed error information if available
129
121
 
130
122
  Raises:
131
123
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
132
124
  httpx.TimeoutException: If the request takes longer than Client.timeout.
133
125
 
134
126
  Returns:
135
- Union[Any, list['PendingInvitationRender']]
127
+ HealthResponse
136
128
  """
137
129
 
138
130
  return (
@@ -0,0 +1,196 @@
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.success_response import SuccessResponse
10
+ from ...models.upgrade_request import UpgradeRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: UpgradeRequest,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/upgrade",
23
+ }
24
+
25
+ if type(body) is dict:
26
+ _body = body
27
+ else:
28
+ _body = body.to_dict()
29
+
30
+ _kwargs["json"] = _body
31
+ headers["Content-Type"] = "application/json"
32
+
33
+ _kwargs["headers"] = headers
34
+ return _kwargs
35
+
36
+
37
+ def _parse_response(
38
+ *, client: Client, response: httpx.Response
39
+ ) -> Union[ErrorResponse, SuccessResponse] | None:
40
+ if response.status_code == 200:
41
+ response_200 = SuccessResponse.from_dict(response.json())
42
+
43
+ return response_200
44
+ if response.status_code == 500:
45
+ response_500 = ErrorResponse.from_dict(response.json())
46
+
47
+ return response_500
48
+ if client.raise_on_unexpected_status:
49
+ raise errors.UnexpectedStatus(response.status_code, response.content)
50
+ else:
51
+ return None
52
+
53
+
54
+ def _build_response(
55
+ *, client: Client, response: httpx.Response
56
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
57
+ return Response(
58
+ status_code=HTTPStatus(response.status_code),
59
+ content=response.content,
60
+ headers=response.headers,
61
+ parsed=_parse_response(client=client, response=response),
62
+ )
63
+
64
+
65
+ def sync_detailed(
66
+ *,
67
+ client: Client,
68
+ body: UpgradeRequest,
69
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
70
+ r"""Upgrade the sandbox-api
71
+
72
+ Triggers an upgrade of the sandbox-api process. Returns 200 immediately before upgrading.
73
+ The upgrade will: download the specified binary from GitHub releases, validate it, and restart.
74
+ All running processes will be preserved across the upgrade.
75
+ Available versions: \"develop\" (default), \"main\", \"latest\", or specific tag like \"v1.0.0\"
76
+ You can also specify a custom baseUrl for forks (defaults to https://github.com/blaxel-
77
+ ai/sandbox/releases)
78
+
79
+ Args:
80
+ body (UpgradeRequest):
81
+
82
+ Raises:
83
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
84
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
85
+
86
+ Returns:
87
+ Response[Union[ErrorResponse, SuccessResponse]]
88
+ """
89
+
90
+ kwargs = _get_kwargs(
91
+ body=body,
92
+ )
93
+
94
+ response = client.get_httpx_client().request(
95
+ **kwargs,
96
+ )
97
+
98
+ return _build_response(client=client, response=response)
99
+
100
+
101
+ def sync(
102
+ *,
103
+ client: Client,
104
+ body: UpgradeRequest,
105
+ ) -> Union[ErrorResponse, SuccessResponse] | None:
106
+ r"""Upgrade the sandbox-api
107
+
108
+ Triggers an upgrade of the sandbox-api process. Returns 200 immediately before upgrading.
109
+ The upgrade will: download the specified binary from GitHub releases, validate it, and restart.
110
+ All running processes will be preserved across the upgrade.
111
+ Available versions: \"develop\" (default), \"main\", \"latest\", or specific tag like \"v1.0.0\"
112
+ You can also specify a custom baseUrl for forks (defaults to https://github.com/blaxel-
113
+ ai/sandbox/releases)
114
+
115
+ Args:
116
+ body (UpgradeRequest):
117
+
118
+ Raises:
119
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
120
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
121
+
122
+ Returns:
123
+ Union[ErrorResponse, SuccessResponse]
124
+ """
125
+
126
+ return sync_detailed(
127
+ client=client,
128
+ body=body,
129
+ ).parsed
130
+
131
+
132
+ async def asyncio_detailed(
133
+ *,
134
+ client: Client,
135
+ body: UpgradeRequest,
136
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
137
+ r"""Upgrade the sandbox-api
138
+
139
+ Triggers an upgrade of the sandbox-api process. Returns 200 immediately before upgrading.
140
+ The upgrade will: download the specified binary from GitHub releases, validate it, and restart.
141
+ All running processes will be preserved across the upgrade.
142
+ Available versions: \"develop\" (default), \"main\", \"latest\", or specific tag like \"v1.0.0\"
143
+ You can also specify a custom baseUrl for forks (defaults to https://github.com/blaxel-
144
+ ai/sandbox/releases)
145
+
146
+ Args:
147
+ body (UpgradeRequest):
148
+
149
+ Raises:
150
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
151
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
152
+
153
+ Returns:
154
+ Response[Union[ErrorResponse, SuccessResponse]]
155
+ """
156
+
157
+ kwargs = _get_kwargs(
158
+ body=body,
159
+ )
160
+
161
+ response = await client.get_async_httpx_client().request(**kwargs)
162
+
163
+ return _build_response(client=client, response=response)
164
+
165
+
166
+ async def asyncio(
167
+ *,
168
+ client: Client,
169
+ body: UpgradeRequest,
170
+ ) -> Union[ErrorResponse, SuccessResponse] | None:
171
+ r"""Upgrade the sandbox-api
172
+
173
+ Triggers an upgrade of the sandbox-api process. Returns 200 immediately before upgrading.
174
+ The upgrade will: download the specified binary from GitHub releases, validate it, and restart.
175
+ All running processes will be preserved across the upgrade.
176
+ Available versions: \"develop\" (default), \"main\", \"latest\", or specific tag like \"v1.0.0\"
177
+ You can also specify a custom baseUrl for forks (defaults to https://github.com/blaxel-
178
+ ai/sandbox/releases)
179
+
180
+ Args:
181
+ body (UpgradeRequest):
182
+
183
+ Raises:
184
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
185
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
186
+
187
+ Returns:
188
+ Union[ErrorResponse, SuccessResponse]
189
+ """
190
+
191
+ return (
192
+ await asyncio_detailed(
193
+ client=client,
194
+ body=body,
195
+ )
196
+ ).parsed
@@ -20,6 +20,7 @@ from .find_response import FindResponse
20
20
  from .fuzzy_search_match import FuzzySearchMatch
21
21
  from .fuzzy_search_response import FuzzySearchResponse
22
22
  from .get_network_process_pid_ports_response_200 import GetNetworkProcessPidPortsResponse200
23
+ from .health_response import HealthResponse
23
24
  from .multipart_complete_request import MultipartCompleteRequest
24
25
  from .multipart_initiate_request import MultipartInitiateRequest
25
26
  from .multipart_initiate_response import MultipartInitiateResponse
@@ -34,6 +35,7 @@ from .process_request import ProcessRequest
34
35
  from .process_request_env import ProcessRequestEnv
35
36
  from .process_response import ProcessResponse
36
37
  from .process_response_status import ProcessResponseStatus
38
+ from .process_upgrade_state import ProcessUpgradeState
37
39
  from .put_filesystem_multipart_upload_id_part_body import PutFilesystemMultipartUploadIdPartBody
38
40
  from .ranked_file import RankedFile
39
41
  from .reranking_response import RerankingResponse
@@ -41,6 +43,8 @@ from .subdirectory import Subdirectory
41
43
  from .success_response import SuccessResponse
42
44
  from .tree_request import TreeRequest
43
45
  from .tree_request_files import TreeRequestFiles
46
+ from .upgrade_request import UpgradeRequest
47
+ from .upgrade_status import UpgradeStatus
44
48
 
45
49
  __all__ = (
46
50
  "ApplyEditRequest",
@@ -61,6 +65,7 @@ __all__ = (
61
65
  "FuzzySearchMatch",
62
66
  "FuzzySearchResponse",
63
67
  "GetNetworkProcessPidPortsResponse200",
68
+ "HealthResponse",
64
69
  "MultipartCompleteRequest",
65
70
  "MultipartInitiateRequest",
66
71
  "MultipartInitiateResponse",
@@ -75,6 +80,7 @@ __all__ = (
75
80
  "ProcessRequestEnv",
76
81
  "ProcessResponse",
77
82
  "ProcessResponseStatus",
83
+ "ProcessUpgradeState",
78
84
  "PutFilesystemMultipartUploadIdPartBody",
79
85
  "RankedFile",
80
86
  "RerankingResponse",
@@ -82,4 +88,6 @@ __all__ = (
82
88
  "SuccessResponse",
83
89
  "TreeRequest",
84
90
  "TreeRequestFiles",
91
+ "UpgradeRequest",
92
+ "UpgradeStatus",
85
93
  )
@@ -12,46 +12,45 @@ T = TypeVar("T", bound="ContentSearchMatch")
12
12
  class ContentSearchMatch:
13
13
  """
14
14
  Attributes:
15
- column (Union[Unset, int]): Example: 10.
15
+ column (int): Example: 10.
16
+ line (int): Example: 42.
17
+ path (str): Example: src/main.go.
18
+ text (str): Example: const searchText = 'example'.
16
19
  context (Union[Unset, str]): Example: previous line
17
20
  current line
18
21
  next line.
19
- line (Union[Unset, int]): Example: 42.
20
- path (Union[Unset, str]): Example: src/main.go.
21
- text (Union[Unset, str]): Example: const searchText = 'example'.
22
22
  """
23
23
 
24
- column: Union[Unset, int] = UNSET
24
+ column: int
25
+ line: int
26
+ path: str
27
+ text: str
25
28
  context: Union[Unset, str] = UNSET
26
- line: Union[Unset, int] = UNSET
27
- path: Union[Unset, str] = UNSET
28
- text: Union[Unset, str] = UNSET
29
29
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
30
 
31
31
  def to_dict(self) -> dict[str, Any]:
32
32
  column = self.column
33
33
 
34
- context = self.context
35
-
36
34
  line = self.line
37
35
 
38
36
  path = self.path
39
37
 
40
38
  text = self.text
41
39
 
40
+ context = self.context
41
+
42
42
  field_dict: dict[str, Any] = {}
43
43
  field_dict.update(self.additional_properties)
44
- field_dict.update({})
45
- if column is not UNSET:
46
- field_dict["column"] = column
44
+ field_dict.update(
45
+ {
46
+ "column": column,
47
+ "line": line,
48
+ "path": path,
49
+ "text": text,
50
+ }
51
+ )
47
52
  if context is not UNSET:
48
53
  field_dict["context"] = context
49
- if line is not UNSET:
50
- field_dict["line"] = line
51
- if path is not UNSET:
52
- field_dict["path"] = path
53
- if text is not UNSET:
54
- field_dict["text"] = text
55
54
 
56
55
  return field_dict
57
56
 
@@ -60,22 +59,22 @@ class ContentSearchMatch:
60
59
  if not src_dict:
61
60
  return None
62
61
  d = src_dict.copy()
63
- column = d.pop("column", UNSET)
62
+ column = d.pop("column")
64
63
 
65
- context = d.pop("context", UNSET)
64
+ line = d.pop("line")
66
65
 
67
- line = d.pop("line", UNSET)
66
+ path = d.pop("path")
68
67
 
69
- path = d.pop("path", UNSET)
68
+ text = d.pop("text")
70
69
 
71
- text = d.pop("text", UNSET)
70
+ context = d.pop("context", UNSET)
72
71
 
73
72
  content_search_match = cls(
74
73
  column=column,
75
- context=context,
76
74
  line=line,
77
75
  path=path,
78
76
  text=text,
77
+ context=context,
79
78
  )
80
79
 
81
80
  content_search_match.additional_properties = d
@@ -1,10 +1,8 @@
1
- from typing import TYPE_CHECKING, Any, TypeVar, Union
1
+ from typing import TYPE_CHECKING, Any, TypeVar
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
5
5
 
6
- from ..types import UNSET, Unset
7
-
8
6
  if TYPE_CHECKING:
9
7
  from ..models.content_search_match import ContentSearchMatch
10
8
 
@@ -16,26 +14,24 @@ T = TypeVar("T", bound="ContentSearchResponse")
16
14
  class ContentSearchResponse:
17
15
  """
18
16
  Attributes:
19
- matches (Union[Unset, list['ContentSearchMatch']]):
20
- query (Union[Unset, str]): Example: searchText.
21
- total (Union[Unset, int]): Example: 5.
17
+ matches (list['ContentSearchMatch']):
18
+ query (str): Example: searchText.
19
+ total (int): Example: 5.
22
20
  """
23
21
 
24
- matches: Union[Unset, list["ContentSearchMatch"]] = UNSET
25
- query: Union[Unset, str] = UNSET
26
- total: Union[Unset, int] = UNSET
22
+ matches: list["ContentSearchMatch"]
23
+ query: str
24
+ total: int
27
25
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
26
 
29
27
  def to_dict(self) -> dict[str, Any]:
30
- matches: Union[Unset, list[dict[str, Any]]] = UNSET
31
- if not isinstance(self.matches, Unset):
32
- matches = []
33
- for matches_item_data in self.matches:
34
- if type(matches_item_data) is dict:
35
- matches_item = matches_item_data
36
- else:
37
- matches_item = matches_item_data.to_dict()
38
- matches.append(matches_item)
28
+ matches = []
29
+ for matches_item_data in self.matches:
30
+ if type(matches_item_data) is dict:
31
+ matches_item = matches_item_data
32
+ else:
33
+ matches_item = matches_item_data.to_dict()
34
+ matches.append(matches_item)
39
35
 
40
36
  query = self.query
41
37
 
@@ -43,13 +39,13 @@ class ContentSearchResponse:
43
39
 
44
40
  field_dict: dict[str, Any] = {}
45
41
  field_dict.update(self.additional_properties)
46
- field_dict.update({})
47
- if matches is not UNSET:
48
- field_dict["matches"] = matches
49
- if query is not UNSET:
50
- field_dict["query"] = query
51
- if total is not UNSET:
52
- field_dict["total"] = total
42
+ field_dict.update(
43
+ {
44
+ "matches": matches,
45
+ "query": query,
46
+ "total": total,
47
+ }
48
+ )
53
49
 
54
50
  return field_dict
55
51
 
@@ -61,15 +57,15 @@ class ContentSearchResponse:
61
57
  return None
62
58
  d = src_dict.copy()
63
59
  matches = []
64
- _matches = d.pop("matches", UNSET)
65
- for matches_item_data in _matches or []:
60
+ _matches = d.pop("matches")
61
+ for matches_item_data in _matches:
66
62
  matches_item = ContentSearchMatch.from_dict(matches_item_data)
67
63
 
68
64
  matches.append(matches_item)
69
65
 
70
- query = d.pop("query", UNSET)
66
+ query = d.pop("query")
71
67
 
72
- total = d.pop("total", UNSET)
68
+ total = d.pop("total")
73
69
 
74
70
  content_search_response = cls(
75
71
  matches=matches,
@@ -1,10 +1,8 @@
1
- from typing import Any, TypeVar, Union
1
+ from typing import Any, TypeVar
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
5
5
 
6
- from ..types import UNSET, Unset
7
-
8
6
  T = TypeVar("T", bound="FindMatch")
9
7
 
10
8
 
@@ -12,12 +10,12 @@ T = TypeVar("T", bound="FindMatch")
12
10
  class FindMatch:
13
11
  """
14
12
  Attributes:
15
- path (Union[Unset, str]): Example: src/main.go.
16
- type_ (Union[Unset, str]): "file" or "directory" Example: file.
13
+ path (str): Example: src/main.go.
14
+ type_ (str): "file" or "directory" Example: file.
17
15
  """
18
16
 
19
- path: Union[Unset, str] = UNSET
20
- type_: Union[Unset, str] = UNSET
17
+ path: str
18
+ type_: str
21
19
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
22
20
 
23
21
  def to_dict(self) -> dict[str, Any]:
@@ -27,11 +25,12 @@ class FindMatch:
27
25
 
28
26
  field_dict: dict[str, Any] = {}
29
27
  field_dict.update(self.additional_properties)
30
- field_dict.update({})
31
- if path is not UNSET:
32
- field_dict["path"] = path
33
- if type_ is not UNSET:
34
- field_dict["type"] = type_
28
+ field_dict.update(
29
+ {
30
+ "path": path,
31
+ "type": type_,
32
+ }
33
+ )
35
34
 
36
35
  return field_dict
37
36
 
@@ -40,9 +39,9 @@ class FindMatch:
40
39
  if not src_dict:
41
40
  return None
42
41
  d = src_dict.copy()
43
- path = d.pop("path", UNSET)
42
+ path = d.pop("path")
44
43
 
45
- type_ = d.pop("type", d.pop("type_", UNSET))
44
+ type_ = d.pop("type") if "type" in d else d.pop("type_")
46
45
 
47
46
  find_match = cls(
48
47
  path=path,