1212import multiprocessing
1313import tempfile
1414from pathlib import Path
15- from typing import Dict , List , Any , Optional , Union , Tuple
15+ from typing import Dict , List , Any , Optional , Union
1616
1717from azure .identity import DefaultAzureCredential
1818from cosmotech_api .api .dataset_api import DatasetApi
@@ -54,7 +54,6 @@ def download_dataset(
5454 workspace_id : str ,
5555 dataset_id : str ,
5656 read_files : bool = True ,
57- credentials : Optional [DefaultAzureCredential ] = None ,
5857) -> Dict [str , Any ]:
5958 """
6059 Download a single dataset by ID.
@@ -64,7 +63,6 @@ def download_dataset(
6463 workspace_id: Workspace ID
6564 dataset_id: Dataset ID
6665 read_files: Whether to read file contents
67- credentials: Azure credentials (if None, uses DefaultAzureCredential if needed)
6866
6967 Returns:
7068 Dataset information dictionary
@@ -91,7 +89,7 @@ def download_dataset(
9189 if is_adt :
9290 content , folder_path = download_adt_dataset (
9391 adt_address = parameters ["AZURE_DIGITAL_TWINS_URL" ],
94- credentials = credentials ,
92+ credentials = DefaultAzureCredential () ,
9593 )
9694 return {
9795 "type" : "adt" ,
@@ -160,7 +158,7 @@ def download_dataset(
160158
161159
162160def download_dataset_process (
163- _dataset_id , organization_id , workspace_id , read_files , credentials , _return_dict , _error_dict
161+ _dataset_id , organization_id , workspace_id , read_files , _return_dict , _error_dict
164162):
165163 """
166164 Process function for downloading a dataset in a separate process.
@@ -174,7 +172,6 @@ def download_dataset_process(
174172 organization_id: Organization ID
175173 workspace_id: Workspace ID
176174 read_files: Whether to read file contents
177- credentials: Azure credentials (if None, uses DefaultAzureCredential if needed)
178175 _return_dict: Shared dictionary to store successful download results
179176 _error_dict: Shared dictionary to store error messages
180177
@@ -187,7 +184,6 @@ def download_dataset_process(
187184 workspace_id = workspace_id ,
188185 dataset_id = _dataset_id ,
189186 read_files = read_files ,
190- credentials = credentials ,
191187 )
192188 _return_dict [_dataset_id ] = _c
193189 except Exception as e :
@@ -200,7 +196,6 @@ def download_datasets_parallel(
200196 workspace_id : str ,
201197 dataset_ids : List [str ],
202198 read_files : bool = True ,
203- credentials : Optional [DefaultAzureCredential ] = None ,
204199) -> Dict [str , Dict [str , Any ]]:
205200 """
206201 Download multiple datasets in parallel.
@@ -210,7 +205,6 @@ def download_datasets_parallel(
210205 workspace_id: Workspace ID
211206 dataset_ids: List of dataset IDs
212207 read_files: Whether to read file contents
213- credentials: Azure credentials (if None, uses DefaultAzureCredential if needed)
214208
215209 Returns:
216210 Dictionary mapping dataset IDs to dataset information
@@ -225,7 +219,7 @@ def download_datasets_parallel(
225219 dataset_id ,
226220 multiprocessing .Process (
227221 target = download_dataset_process ,
228- args = (dataset_id , organization_id , workspace_id , read_files , credentials , return_dict , error_dict ),
222+ args = (dataset_id , organization_id , workspace_id , read_files , return_dict , error_dict ),
229223 ),
230224 )
231225 for dataset_id in dataset_ids
@@ -251,7 +245,6 @@ def download_datasets_sequential(
251245 workspace_id : str ,
252246 dataset_ids : List [str ],
253247 read_files : bool = True ,
254- credentials : Optional [DefaultAzureCredential ] = None ,
255248) -> Dict [str , Dict [str , Any ]]:
256249 """
257250 Download multiple datasets sequentially.
@@ -261,7 +254,6 @@ def download_datasets_sequential(
261254 workspace_id: Workspace ID
262255 dataset_ids: List of dataset IDs
263256 read_files: Whether to read file contents
264- credentials: Azure credentials (if None, uses DefaultAzureCredential if needed)
265257
266258 Returns:
267259 Dictionary mapping dataset IDs to dataset information
@@ -279,7 +271,6 @@ def download_datasets_sequential(
279271 workspace_id = workspace_id ,
280272 dataset_id = dataset_id ,
281273 read_files = read_files ,
282- credentials = credentials ,
283274 )
284275 except Exception as e :
285276 error_dict [dataset_id ] = f"{ type (e ).__name__ } : { str (e )} "
@@ -294,7 +285,6 @@ def download_datasets(
294285 dataset_ids : List [str ],
295286 read_files : bool = True ,
296287 parallel : bool = True ,
297- credentials : Optional [DefaultAzureCredential ] = None ,
298288) -> Dict [str , Dict [str , Any ]]:
299289 """
300290 Download multiple datasets, either in parallel or sequentially.
@@ -305,7 +295,6 @@ def download_datasets(
305295 dataset_ids: List of dataset IDs
306296 read_files: Whether to read file contents
307297 parallel: Whether to download in parallel
308- credentials: Azure credentials (if None, uses DefaultAzureCredential if needed)
309298
310299 Returns:
311300 Dictionary mapping dataset IDs to dataset information
@@ -319,15 +308,13 @@ def download_datasets(
319308 workspace_id = workspace_id ,
320309 dataset_ids = dataset_ids ,
321310 read_files = read_files ,
322- credentials = credentials ,
323311 )
324312 else :
325313 return download_datasets_sequential (
326314 organization_id = organization_id ,
327315 workspace_id = workspace_id ,
328316 dataset_ids = dataset_ids ,
329317 read_files = read_files ,
330- credentials = credentials ,
331318 )
332319
333320
0 commit comments