google-genai 1.10.0__py3-none-any.whl → 1.12.0__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.
google/genai/files.py CHANGED
@@ -36,9 +36,9 @@ logger = logging.getLogger('google_genai.files')
36
36
 
37
37
  def _ListFilesConfig_to_mldev(
38
38
  api_client: BaseApiClient,
39
- from_object: Union[dict, object],
40
- parent_object: Optional[dict] = None,
41
- ) -> dict:
39
+ from_object: Union[dict[str, Any], object],
40
+ parent_object: Optional[dict[str, Any]] = None,
41
+ ) -> dict[str, Any]:
42
42
  to_object: dict[str, Any] = {}
43
43
 
44
44
  if getv(from_object, ['page_size']) is not None:
@@ -58,9 +58,9 @@ def _ListFilesConfig_to_mldev(
58
58
 
59
59
  def _ListFilesParameters_to_mldev(
60
60
  api_client: BaseApiClient,
61
- from_object: Union[dict, object],
62
- parent_object: Optional[dict] = None,
63
- ) -> dict:
61
+ from_object: Union[dict[str, Any], object],
62
+ parent_object: Optional[dict[str, Any]] = None,
63
+ ) -> dict[str, Any]:
64
64
  to_object: dict[str, Any] = {}
65
65
  if getv(from_object, ['config']) is not None:
66
66
  setv(
@@ -76,9 +76,9 @@ def _ListFilesParameters_to_mldev(
76
76
 
77
77
  def _FileStatus_to_mldev(
78
78
  api_client: BaseApiClient,
79
- from_object: Union[dict, object],
80
- parent_object: Optional[dict] = None,
81
- ) -> dict:
79
+ from_object: Union[dict[str, Any], object],
80
+ parent_object: Optional[dict[str, Any]] = None,
81
+ ) -> dict[str, Any]:
82
82
  to_object: dict[str, Any] = {}
83
83
  if getv(from_object, ['details']) is not None:
84
84
  setv(to_object, ['details'], getv(from_object, ['details']))
@@ -94,9 +94,9 @@ def _FileStatus_to_mldev(
94
94
 
95
95
  def _File_to_mldev(
96
96
  api_client: BaseApiClient,
97
- from_object: Union[dict, object],
98
- parent_object: Optional[dict] = None,
99
- ) -> dict:
97
+ from_object: Union[dict[str, Any], object],
98
+ parent_object: Optional[dict[str, Any]] = None,
99
+ ) -> dict[str, Any]:
100
100
  to_object: dict[str, Any] = {}
101
101
  if getv(from_object, ['name']) is not None:
102
102
  setv(to_object, ['name'], getv(from_object, ['name']))
@@ -151,9 +151,9 @@ def _File_to_mldev(
151
151
 
152
152
  def _CreateFileParameters_to_mldev(
153
153
  api_client: BaseApiClient,
154
- from_object: Union[dict, object],
155
- parent_object: Optional[dict] = None,
156
- ) -> dict:
154
+ from_object: Union[dict[str, Any], object],
155
+ parent_object: Optional[dict[str, Any]] = None,
156
+ ) -> dict[str, Any]:
157
157
  to_object: dict[str, Any] = {}
158
158
  if getv(from_object, ['file']) is not None:
159
159
  setv(
@@ -170,9 +170,9 @@ def _CreateFileParameters_to_mldev(
170
170
 
171
171
  def _GetFileParameters_to_mldev(
172
172
  api_client: BaseApiClient,
173
- from_object: Union[dict, object],
174
- parent_object: Optional[dict] = None,
175
- ) -> dict:
173
+ from_object: Union[dict[str, Any], object],
174
+ parent_object: Optional[dict[str, Any]] = None,
175
+ ) -> dict[str, Any]:
176
176
  to_object: dict[str, Any] = {}
177
177
  if getv(from_object, ['name']) is not None:
178
178
  setv(
@@ -189,9 +189,9 @@ def _GetFileParameters_to_mldev(
189
189
 
190
190
  def _DeleteFileParameters_to_mldev(
191
191
  api_client: BaseApiClient,
192
- from_object: Union[dict, object],
193
- parent_object: Optional[dict] = None,
194
- ) -> dict:
192
+ from_object: Union[dict[str, Any], object],
193
+ parent_object: Optional[dict[str, Any]] = None,
194
+ ) -> dict[str, Any]:
195
195
  to_object: dict[str, Any] = {}
196
196
  if getv(from_object, ['name']) is not None:
197
197
  setv(
@@ -208,9 +208,9 @@ def _DeleteFileParameters_to_mldev(
208
208
 
209
209
  def _FileStatus_from_mldev(
210
210
  api_client: BaseApiClient,
211
- from_object: Union[dict, object],
212
- parent_object: Optional[dict] = None,
213
- ) -> dict:
211
+ from_object: Union[dict[str, Any], object],
212
+ parent_object: Optional[dict[str, Any]] = None,
213
+ ) -> dict[str, Any]:
214
214
  to_object: dict[str, Any] = {}
215
215
  if getv(from_object, ['details']) is not None:
216
216
  setv(to_object, ['details'], getv(from_object, ['details']))
@@ -226,9 +226,9 @@ def _FileStatus_from_mldev(
226
226
 
227
227
  def _File_from_mldev(
228
228
  api_client: BaseApiClient,
229
- from_object: Union[dict, object],
230
- parent_object: Optional[dict] = None,
231
- ) -> dict:
229
+ from_object: Union[dict[str, Any], object],
230
+ parent_object: Optional[dict[str, Any]] = None,
231
+ ) -> dict[str, Any]:
232
232
  to_object: dict[str, Any] = {}
233
233
  if getv(from_object, ['name']) is not None:
234
234
  setv(to_object, ['name'], getv(from_object, ['name']))
@@ -283,9 +283,9 @@ def _File_from_mldev(
283
283
 
284
284
  def _ListFilesResponse_from_mldev(
285
285
  api_client: BaseApiClient,
286
- from_object: Union[dict, object],
287
- parent_object: Optional[dict] = None,
288
- ) -> dict:
286
+ from_object: Union[dict[str, Any], object],
287
+ parent_object: Optional[dict[str, Any]] = None,
288
+ ) -> dict[str, Any]:
289
289
  to_object: dict[str, Any] = {}
290
290
  if getv(from_object, ['nextPageToken']) is not None:
291
291
  setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
@@ -305,9 +305,9 @@ def _ListFilesResponse_from_mldev(
305
305
 
306
306
  def _CreateFileResponse_from_mldev(
307
307
  api_client: BaseApiClient,
308
- from_object: Union[dict, object],
309
- parent_object: Optional[dict] = None,
310
- ) -> dict:
308
+ from_object: Union[dict[str, Any], object],
309
+ parent_object: Optional[dict[str, Any]] = None,
310
+ ) -> dict[str, Any]:
311
311
  to_object: dict[str, Any] = {}
312
312
  if getv(from_object, ['httpHeaders']) is not None:
313
313
  setv(to_object, ['http_headers'], getv(from_object, ['httpHeaders']))
@@ -317,9 +317,9 @@ def _CreateFileResponse_from_mldev(
317
317
 
318
318
  def _DeleteFileResponse_from_mldev(
319
319
  api_client: BaseApiClient,
320
- from_object: Union[dict, object],
321
- parent_object: Optional[dict] = None,
322
- ) -> dict:
320
+ from_object: Union[dict[str, Any], object],
321
+ parent_object: Optional[dict[str, Any]] = None,
322
+ ) -> dict[str, Any]:
323
323
  to_object: dict[str, Any] = {}
324
324
 
325
325
  return to_object
@@ -596,7 +596,7 @@ class Files(_api_module.BaseModule):
596
596
  def upload(
597
597
  self,
598
598
  *,
599
- file: Union[str, pathlib.Path, os.PathLike, io.IOBase],
599
+ file: Union[str, pathlib.Path, os.PathLike[str], io.IOBase],
600
600
  config: Optional[types.UploadFileConfigOrDict] = None,
601
601
  ) -> types.File:
602
602
  """Calls the API to upload a file using a supported file service.
@@ -1068,7 +1068,7 @@ class AsyncFiles(_api_module.BaseModule):
1068
1068
  async def upload(
1069
1069
  self,
1070
1070
  *,
1071
- file: Union[str, pathlib.Path, os.PathLike, io.IOBase],
1071
+ file: Union[str, pathlib.Path, os.PathLike[str], io.IOBase],
1072
1072
  config: Optional[types.UploadFileConfigOrDict] = None,
1073
1073
  ) -> types.File:
1074
1074
  """Calls the API to upload a file asynchronously using a supported file service.