blaxel 0.2.30__py3-none-any.whl → 0.2.31rc120__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 (25) hide show
  1. blaxel/__init__.py +2 -2
  2. blaxel/core/client/client.py +18 -2
  3. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_tree_path.py +188 -0
  4. blaxel/core/sandbox/client/api/filesystem/get_filesystem_content_search_path.py +250 -0
  5. blaxel/core/sandbox/client/api/filesystem/get_filesystem_find_path.py +248 -0
  6. blaxel/core/sandbox/client/api/filesystem/get_filesystem_search_path.py +237 -0
  7. blaxel/core/sandbox/client/api/filesystem/get_filesystem_tree_path.py +197 -0
  8. blaxel/core/sandbox/client/api/filesystem/put_filesystem_tree_path.py +223 -0
  9. blaxel/core/sandbox/client/models/__init__.py +16 -0
  10. blaxel/core/sandbox/client/models/content_search_match.py +98 -0
  11. blaxel/core/sandbox/client/models/content_search_response.py +97 -0
  12. blaxel/core/sandbox/client/models/find_match.py +69 -0
  13. blaxel/core/sandbox/client/models/find_response.py +88 -0
  14. blaxel/core/sandbox/client/models/fuzzy_search_match.py +78 -0
  15. blaxel/core/sandbox/client/models/fuzzy_search_response.py +88 -0
  16. blaxel/core/sandbox/client/models/tree_request.py +76 -0
  17. blaxel/core/sandbox/client/models/tree_request_files.py +49 -0
  18. blaxel/core/sandbox/default/action.py +12 -8
  19. blaxel/core/sandbox/default/filesystem.py +238 -48
  20. blaxel/core/sandbox/default/interpreter.py +62 -55
  21. blaxel/core/sandbox/default/process.py +66 -46
  22. {blaxel-0.2.30.dist-info → blaxel-0.2.31rc120.dist-info}/METADATA +1 -1
  23. {blaxel-0.2.30.dist-info → blaxel-0.2.31rc120.dist-info}/RECORD +25 -11
  24. {blaxel-0.2.30.dist-info → blaxel-0.2.31rc120.dist-info}/WHEEL +0 -0
  25. {blaxel-0.2.30.dist-info → blaxel-0.2.31rc120.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,223 @@
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
@@ -2,6 +2,8 @@
2
2
 
3
3
  from .apply_edit_request import ApplyEditRequest
4
4
  from .apply_edit_response import ApplyEditResponse
5
+ from .content_search_match import ContentSearchMatch
6
+ from .content_search_response import ContentSearchResponse
5
7
  from .delete_network_process_pid_monitor_response_200 import (
6
8
  DeleteNetworkProcessPidMonitorResponse200,
7
9
  )
@@ -13,6 +15,10 @@ from .file_with_content import FileWithContent
13
15
  from .filesystem_multipart_upload import FilesystemMultipartUpload
14
16
  from .filesystem_multipart_upload_parts import FilesystemMultipartUploadParts
15
17
  from .filesystem_uploaded_part import FilesystemUploadedPart
18
+ from .find_match import FindMatch
19
+ from .find_response import FindResponse
20
+ from .fuzzy_search_match import FuzzySearchMatch
21
+ from .fuzzy_search_response import FuzzySearchResponse
16
22
  from .get_network_process_pid_ports_response_200 import GetNetworkProcessPidPortsResponse200
17
23
  from .multipart_complete_request import MultipartCompleteRequest
18
24
  from .multipart_initiate_request import MultipartInitiateRequest
@@ -33,11 +39,15 @@ from .ranked_file import RankedFile
33
39
  from .reranking_response import RerankingResponse
34
40
  from .subdirectory import Subdirectory
35
41
  from .success_response import SuccessResponse
42
+ from .tree_request import TreeRequest
43
+ from .tree_request_files import TreeRequestFiles
36
44
  from .welcome_response import WelcomeResponse
37
45
 
38
46
  __all__ = (
39
47
  "ApplyEditRequest",
40
48
  "ApplyEditResponse",
49
+ "ContentSearchMatch",
50
+ "ContentSearchResponse",
41
51
  "DeleteNetworkProcessPidMonitorResponse200",
42
52
  "Directory",
43
53
  "ErrorResponse",
@@ -47,6 +57,10 @@ __all__ = (
47
57
  "FilesystemMultipartUploadParts",
48
58
  "FilesystemUploadedPart",
49
59
  "FileWithContent",
60
+ "FindMatch",
61
+ "FindResponse",
62
+ "FuzzySearchMatch",
63
+ "FuzzySearchResponse",
50
64
  "GetNetworkProcessPidPortsResponse200",
51
65
  "MultipartCompleteRequest",
52
66
  "MultipartInitiateRequest",
@@ -67,5 +81,7 @@ __all__ = (
67
81
  "RerankingResponse",
68
82
  "Subdirectory",
69
83
  "SuccessResponse",
84
+ "TreeRequest",
85
+ "TreeRequestFiles",
70
86
  "WelcomeResponse",
71
87
  )
@@ -0,0 +1,98 @@
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
@@ -0,0 +1,97 @@
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
@@ -0,0 +1,69 @@
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="FindMatch")
9
+
10
+
11
+ @_attrs_define
12
+ class FindMatch:
13
+ """
14
+ Attributes:
15
+ path (Union[Unset, str]): Example: src/main.go.
16
+ type_ (Union[Unset, str]): "file" or "directory" Example: file.
17
+ """
18
+
19
+ path: Union[Unset, str] = UNSET
20
+ type_: Union[Unset, str] = UNSET
21
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
22
+
23
+ def to_dict(self) -> dict[str, Any]:
24
+ path = self.path
25
+
26
+ type_ = self.type_
27
+
28
+ field_dict: dict[str, Any] = {}
29
+ 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_
35
+
36
+ return field_dict
37
+
38
+ @classmethod
39
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
40
+ if not src_dict:
41
+ return None
42
+ d = src_dict.copy()
43
+ path = d.pop("path", UNSET)
44
+
45
+ type_ = d.pop("type", UNSET)
46
+
47
+ find_match = cls(
48
+ path=path,
49
+ type_=type_,
50
+ )
51
+
52
+ find_match.additional_properties = d
53
+ return find_match
54
+
55
+ @property
56
+ def additional_keys(self) -> list[str]:
57
+ return list(self.additional_properties.keys())
58
+
59
+ def __getitem__(self, key: str) -> Any:
60
+ return self.additional_properties[key]
61
+
62
+ def __setitem__(self, key: str, value: Any) -> None:
63
+ self.additional_properties[key] = value
64
+
65
+ def __delitem__(self, key: str) -> None:
66
+ del self.additional_properties[key]
67
+
68
+ def __contains__(self, key: str) -> bool:
69
+ return key in self.additional_properties
@@ -0,0 +1,88 @@
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
@@ -0,0 +1,78 @@
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