blaxel 0.2.26rc119__py3-none-any.whl → 0.2.28__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 (118) hide show
  1. blaxel/__init__.py +2 -2
  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 +10 -0
  79. blaxel/core/common/autoload.py +5 -4
  80. blaxel/core/common/settings.py +29 -0
  81. blaxel/core/common/webhook.py +187 -0
  82. blaxel/core/jobs/__init__.py +355 -8
  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 +52 -187
  86. blaxel/core/sandbox/default/interpreter.py +55 -62
  87. blaxel/core/sandbox/default/process.py +46 -66
  88. blaxel/core/sandbox/sync/filesystem.py +5 -2
  89. blaxel/googleadk/model.py +0 -1
  90. blaxel/livekit/model.py +0 -1
  91. {blaxel-0.2.26rc119.dist-info → blaxel-0.2.28.dist-info}/METADATA +2 -2
  92. {blaxel-0.2.26rc119.dist-info → blaxel-0.2.28.dist-info}/RECORD +94 -117
  93. blaxel/core/client/api/privateclusters/__init__.py +0 -0
  94. blaxel/core/client/api/privateclusters/delete_private_cluster.py +0 -152
  95. blaxel/core/client/api/privateclusters/get_private_cluster.py +0 -155
  96. blaxel/core/client/api/privateclusters/get_private_cluster_health.py +0 -97
  97. blaxel/core/client/api/privateclusters/list_private_clusters.py +0 -136
  98. blaxel/core/client/api/privateclusters/update_private_cluster.py +0 -152
  99. blaxel/core/client/api/privateclusters/update_private_cluster_health.py +0 -97
  100. blaxel/core/client/models/model_private_cluster.py +0 -79
  101. blaxel/core/client/models/private_cluster.py +0 -183
  102. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_tree_path.py +0 -188
  103. blaxel/core/sandbox/client/api/filesystem/get_filesystem_content_search_path.py +0 -265
  104. blaxel/core/sandbox/client/api/filesystem/get_filesystem_find_path.py +0 -248
  105. blaxel/core/sandbox/client/api/filesystem/get_filesystem_search_path.py +0 -237
  106. blaxel/core/sandbox/client/api/filesystem/get_filesystem_tree_path.py +0 -197
  107. blaxel/core/sandbox/client/api/filesystem/put_filesystem_tree_path.py +0 -223
  108. blaxel/core/sandbox/client/api/websocket/__init__.py +0 -0
  109. blaxel/core/sandbox/client/api/websocket/get_ws.py +0 -81
  110. blaxel/core/sandbox/client/models/content_search_match.py +0 -98
  111. blaxel/core/sandbox/client/models/content_search_response.py +0 -97
  112. blaxel/core/sandbox/client/models/find_response.py +0 -88
  113. blaxel/core/sandbox/client/models/fuzzy_search_match.py +0 -78
  114. blaxel/core/sandbox/client/models/fuzzy_search_response.py +0 -88
  115. blaxel/core/sandbox/client/models/tree_request.py +0 -76
  116. blaxel/core/sandbox/client/models/tree_request_files.py +0 -49
  117. {blaxel-0.2.26rc119.dist-info → blaxel-0.2.28.dist-info}/WHEEL +0 -0
  118. {blaxel-0.2.26rc119.dist-info → blaxel-0.2.28.dist-info}/licenses/LICENSE +0 -0
@@ -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
@@ -1,81 +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 ...types import Response
9
-
10
-
11
- def _get_kwargs() -> dict[str, Any]:
12
- _kwargs: dict[str, Any] = {
13
- "method": "get",
14
- "url": "/ws",
15
- }
16
-
17
- return _kwargs
18
-
19
-
20
- def _parse_response(*, client: Client, response: httpx.Response) -> Any | None:
21
- if client.raise_on_unexpected_status:
22
- raise errors.UnexpectedStatus(response.status_code, response.content)
23
- else:
24
- return None
25
-
26
-
27
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
28
- return Response(
29
- status_code=HTTPStatus(response.status_code),
30
- content=response.content,
31
- headers=response.headers,
32
- parsed=_parse_response(client=client, response=response),
33
- )
34
-
35
-
36
- def sync_detailed(
37
- *,
38
- client: Union[Client],
39
- ) -> Response[Any]:
40
- """WebSocket endpoint
41
-
42
- WebSocket endpoint for all sandbox operations
43
-
44
- Raises:
45
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
46
- httpx.TimeoutException: If the request takes longer than Client.timeout.
47
-
48
- Returns:
49
- Response[Any]
50
- """
51
-
52
- kwargs = _get_kwargs()
53
-
54
- response = client.get_httpx_client().request(
55
- **kwargs,
56
- )
57
-
58
- return _build_response(client=client, response=response)
59
-
60
-
61
- async def asyncio_detailed(
62
- *,
63
- client: Union[Client],
64
- ) -> Response[Any]:
65
- """WebSocket endpoint
66
-
67
- WebSocket endpoint for all sandbox operations
68
-
69
- Raises:
70
- errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
71
- httpx.TimeoutException: If the request takes longer than Client.timeout.
72
-
73
- Returns:
74
- Response[Any]
75
- """
76
-
77
- kwargs = _get_kwargs()
78
-
79
- response = await client.get_async_httpx_client().request(**kwargs)
80
-
81
- return _build_response(client=client, response=response)
@@ -1,98 +0,0 @@
1
- from typing import Any, TypeVar, Union
2
-
3
- from attrs import define as _attrs_define
4
- from attrs import field as _attrs_field
5
-
6
- from ..types import UNSET, Unset
7
-
8
- T = TypeVar("T", bound="ContentSearchMatch")
9
-
10
-
11
- @_attrs_define
12
- class ContentSearchMatch:
13
- """
14
- Attributes:
15
- column (Union[Unset, int]): Example: 10.
16
- context (Union[Unset, str]): Example: previous line
17
- current line
18
- 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
- """
23
-
24
- column: Union[Unset, int] = UNSET
25
- context: Union[Unset, str] = UNSET
26
- line: Union[Unset, int] = UNSET
27
- path: Union[Unset, str] = UNSET
28
- text: Union[Unset, str] = UNSET
29
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
-
31
- def to_dict(self) -> dict[str, Any]:
32
- column = self.column
33
-
34
- context = self.context
35
-
36
- line = self.line
37
-
38
- path = self.path
39
-
40
- text = self.text
41
-
42
- field_dict: dict[str, Any] = {}
43
- field_dict.update(self.additional_properties)
44
- field_dict.update({})
45
- if column is not UNSET:
46
- field_dict["column"] = column
47
- if context is not UNSET:
48
- 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
-
56
- return field_dict
57
-
58
- @classmethod
59
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
60
- if not src_dict:
61
- return None
62
- d = src_dict.copy()
63
- column = d.pop("column", UNSET)
64
-
65
- context = d.pop("context", UNSET)
66
-
67
- line = d.pop("line", UNSET)
68
-
69
- path = d.pop("path", UNSET)
70
-
71
- text = d.pop("text", UNSET)
72
-
73
- content_search_match = cls(
74
- column=column,
75
- context=context,
76
- line=line,
77
- path=path,
78
- text=text,
79
- )
80
-
81
- content_search_match.additional_properties = d
82
- return content_search_match
83
-
84
- @property
85
- def additional_keys(self) -> list[str]:
86
- return list(self.additional_properties.keys())
87
-
88
- def __getitem__(self, key: str) -> Any:
89
- return self.additional_properties[key]
90
-
91
- def __setitem__(self, key: str, value: Any) -> None:
92
- self.additional_properties[key] = value
93
-
94
- def __delitem__(self, key: str) -> None:
95
- del self.additional_properties[key]
96
-
97
- def __contains__(self, key: str) -> bool:
98
- return key in self.additional_properties
@@ -1,97 +0,0 @@
1
- from typing import TYPE_CHECKING, Any, TypeVar, Union
2
-
3
- from attrs import define as _attrs_define
4
- from attrs import field as _attrs_field
5
-
6
- from ..types import UNSET, Unset
7
-
8
- if TYPE_CHECKING:
9
- from ..models.content_search_match import ContentSearchMatch
10
-
11
-
12
- T = TypeVar("T", bound="ContentSearchResponse")
13
-
14
-
15
- @_attrs_define
16
- class ContentSearchResponse:
17
- """
18
- Attributes:
19
- matches (Union[Unset, list['ContentSearchMatch']]):
20
- query (Union[Unset, str]): Example: searchText.
21
- total (Union[Unset, int]): Example: 5.
22
- """
23
-
24
- matches: Union[Unset, list["ContentSearchMatch"]] = UNSET
25
- query: Union[Unset, str] = UNSET
26
- total: Union[Unset, int] = UNSET
27
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
-
29
- 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)
39
-
40
- query = self.query
41
-
42
- total = self.total
43
-
44
- field_dict: dict[str, Any] = {}
45
- 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
53
-
54
- return field_dict
55
-
56
- @classmethod
57
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
58
- from ..models.content_search_match import ContentSearchMatch
59
-
60
- if not src_dict:
61
- return None
62
- d = src_dict.copy()
63
- matches = []
64
- _matches = d.pop("matches", UNSET)
65
- for matches_item_data in _matches or []:
66
- matches_item = ContentSearchMatch.from_dict(matches_item_data)
67
-
68
- matches.append(matches_item)
69
-
70
- query = d.pop("query", UNSET)
71
-
72
- total = d.pop("total", UNSET)
73
-
74
- content_search_response = cls(
75
- matches=matches,
76
- query=query,
77
- total=total,
78
- )
79
-
80
- content_search_response.additional_properties = d
81
- return content_search_response
82
-
83
- @property
84
- def additional_keys(self) -> list[str]:
85
- return list(self.additional_properties.keys())
86
-
87
- def __getitem__(self, key: str) -> Any:
88
- return self.additional_properties[key]
89
-
90
- def __setitem__(self, key: str, value: Any) -> None:
91
- self.additional_properties[key] = value
92
-
93
- def __delitem__(self, key: str) -> None:
94
- del self.additional_properties[key]
95
-
96
- def __contains__(self, key: str) -> bool:
97
- return key in self.additional_properties
@@ -1,88 +0,0 @@
1
- from typing import TYPE_CHECKING, Any, TypeVar, Union
2
-
3
- from attrs import define as _attrs_define
4
- from attrs import field as _attrs_field
5
-
6
- from ..types import UNSET, Unset
7
-
8
- if TYPE_CHECKING:
9
- from ..models.find_match import FindMatch
10
-
11
-
12
- T = TypeVar("T", bound="FindResponse")
13
-
14
-
15
- @_attrs_define
16
- class FindResponse:
17
- """
18
- Attributes:
19
- matches (Union[Unset, list['FindMatch']]):
20
- total (Union[Unset, int]): Example: 5.
21
- """
22
-
23
- matches: Union[Unset, list["FindMatch"]] = UNSET
24
- total: Union[Unset, int] = UNSET
25
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
26
-
27
- def to_dict(self) -> dict[str, Any]:
28
- matches: Union[Unset, list[dict[str, Any]]] = UNSET
29
- if not isinstance(self.matches, Unset):
30
- matches = []
31
- for matches_item_data in self.matches:
32
- if type(matches_item_data) is dict:
33
- matches_item = matches_item_data
34
- else:
35
- matches_item = matches_item_data.to_dict()
36
- matches.append(matches_item)
37
-
38
- total = self.total
39
-
40
- field_dict: dict[str, Any] = {}
41
- field_dict.update(self.additional_properties)
42
- field_dict.update({})
43
- if matches is not UNSET:
44
- field_dict["matches"] = matches
45
- if total is not UNSET:
46
- field_dict["total"] = total
47
-
48
- return field_dict
49
-
50
- @classmethod
51
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
52
- from ..models.find_match import FindMatch
53
-
54
- if not src_dict:
55
- return None
56
- d = src_dict.copy()
57
- matches = []
58
- _matches = d.pop("matches", UNSET)
59
- for matches_item_data in _matches or []:
60
- matches_item = FindMatch.from_dict(matches_item_data)
61
-
62
- matches.append(matches_item)
63
-
64
- total = d.pop("total", UNSET)
65
-
66
- find_response = cls(
67
- matches=matches,
68
- total=total,
69
- )
70
-
71
- find_response.additional_properties = d
72
- return find_response
73
-
74
- @property
75
- def additional_keys(self) -> list[str]:
76
- return list(self.additional_properties.keys())
77
-
78
- def __getitem__(self, key: str) -> Any:
79
- return self.additional_properties[key]
80
-
81
- def __setitem__(self, key: str, value: Any) -> None:
82
- self.additional_properties[key] = value
83
-
84
- def __delitem__(self, key: str) -> None:
85
- del self.additional_properties[key]
86
-
87
- def __contains__(self, key: str) -> bool:
88
- return key in self.additional_properties
@@ -1,78 +0,0 @@
1
- from typing import Any, TypeVar, Union
2
-
3
- from attrs import define as _attrs_define
4
- from attrs import field as _attrs_field
5
-
6
- from ..types import UNSET, Unset
7
-
8
- T = TypeVar("T", bound="FuzzySearchMatch")
9
-
10
-
11
- @_attrs_define
12
- class FuzzySearchMatch:
13
- """
14
- Attributes:
15
- path (Union[Unset, str]): Example: src/main.go.
16
- score (Union[Unset, int]): Example: 100.
17
- type_ (Union[Unset, str]): "file" or "directory" Example: file.
18
- """
19
-
20
- path: Union[Unset, str] = UNSET
21
- score: Union[Unset, int] = UNSET
22
- type_: Union[Unset, str] = UNSET
23
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
24
-
25
- def to_dict(self) -> dict[str, Any]:
26
- path = self.path
27
-
28
- score = self.score
29
-
30
- type_ = self.type_
31
-
32
- field_dict: dict[str, Any] = {}
33
- field_dict.update(self.additional_properties)
34
- field_dict.update({})
35
- if path is not UNSET:
36
- field_dict["path"] = path
37
- if score is not UNSET:
38
- field_dict["score"] = score
39
- if type_ is not UNSET:
40
- field_dict["type"] = type_
41
-
42
- return field_dict
43
-
44
- @classmethod
45
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
46
- if not src_dict:
47
- return None
48
- d = src_dict.copy()
49
- path = d.pop("path", UNSET)
50
-
51
- score = d.pop("score", UNSET)
52
-
53
- type_ = d.pop("type", UNSET)
54
-
55
- fuzzy_search_match = cls(
56
- path=path,
57
- score=score,
58
- type_=type_,
59
- )
60
-
61
- fuzzy_search_match.additional_properties = d
62
- return fuzzy_search_match
63
-
64
- @property
65
- def additional_keys(self) -> list[str]:
66
- return list(self.additional_properties.keys())
67
-
68
- def __getitem__(self, key: str) -> Any:
69
- return self.additional_properties[key]
70
-
71
- def __setitem__(self, key: str, value: Any) -> None:
72
- self.additional_properties[key] = value
73
-
74
- def __delitem__(self, key: str) -> None:
75
- del self.additional_properties[key]
76
-
77
- def __contains__(self, key: str) -> bool:
78
- return key in self.additional_properties