unitlab 2.4.4__tar.gz → 2.4.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitlab
3
- Version: 2.4.4
3
+ Version: 2.4.5
4
4
  Summary: Python SDK for the Unitlab.ai data annotation platform
5
5
  Project-URL: Homepage, https://unitlab.ai
6
6
  Project-URL: Documentation, https://docs.unitlab.ai
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "unitlab"
7
- version = "2.4.4"
7
+ version = "2.4.5"
8
8
  description = "Python SDK for the Unitlab.ai data annotation platform"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -308,49 +308,20 @@ class UnitlabClient:
308
308
  def datasets(self, pretty: int = 0) -> Any:
309
309
  return self._get(f"/api/sdk/datasets/?pretty={pretty}")
310
310
 
311
- def dataset_info(self, dataset_id: str) -> Any:
312
- """Return metadata for a dataset.
313
-
314
- Includes name, version, annotation_type, number_of_data,
315
- download_formats and the list of available ``splits``.
316
- """
317
- return self._get(f"/api/sdk/datasets/{dataset_id}/")
318
-
319
311
  def dataset_download(
320
312
  self,
321
313
  dataset_id: str,
322
314
  export_type: str,
323
315
  split_type: str | None = None,
324
316
  ) -> str:
325
- if split_type is None:
326
- info = self.dataset_info(dataset_id)
327
- splits = info.get("splits") or []
328
- if not splits:
329
- raise NetworkError(
330
- message=(
331
- "No splits available for this dataset. Nothing to download."
332
- ),
333
- detail=None,
334
- )
335
- if len(splits) > 1:
336
- raise NetworkError(
337
- message=(
338
- f"Multiple splits available: {', '.join(splits)}. "
339
- f"Specify one with split_type=..."
340
- ),
341
- detail=None,
342
- )
343
- split_type = splits[0]
344
- logger.info(f"Auto-selected split: {split_type}")
317
+ data: dict[str, Any] = {
318
+ "download_type": "annotation",
319
+ "export_type": export_type,
320
+ }
321
+ if split_type is not None:
322
+ data["split_type"] = split_type
345
323
 
346
- response = self._post(
347
- f"/api/sdk/datasets/{dataset_id}/",
348
- data={
349
- "download_type": "annotation",
350
- "export_type": export_type,
351
- "split_type": split_type,
352
- },
353
- )
324
+ response = self._post(f"/api/sdk/datasets/{dataset_id}/", data=data)
354
325
 
355
326
  file_url = response["file"]
356
327
  try:
@@ -429,7 +400,9 @@ class UnitlabClient:
429
400
 
430
401
  async def main() -> None:
431
402
  with tqdm.tqdm(total=len(files_to_download), ncols=80) as pbar:
432
- async with httpx.AsyncClient(timeout=600.0) as client:
403
+ async with httpx.AsyncClient(
404
+ timeout=600.0, follow_redirects=True
405
+ ) as client:
433
406
  tasks = [
434
407
  download_file(client=client, dataset_file=df)
435
408
  for df in files_to_download
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes