supervisely 6.73.347__py3-none-any.whl → 6.73.348__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.
supervisely/__init__.py CHANGED
@@ -54,6 +54,7 @@ from supervisely.task.progress import (
54
54
 
55
55
 
56
56
  import supervisely.project as project
57
+ import supervisely.api.constants as api_constants
57
58
  from supervisely.project import read_project, get_project_class
58
59
  from supervisely.project.download import download, download_async, download_fast
59
60
  from supervisely.project.upload import upload
@@ -0,0 +1,3 @@
1
+ # coding: utf-8
2
+
3
+ DOWNLOAD_BATCH_SIZE = None
@@ -55,6 +55,7 @@ from supervisely._utils import (
55
55
  from supervisely.annotation.annotation import Annotation
56
56
  from supervisely.annotation.tag import Tag
57
57
  from supervisely.annotation.tag_meta import TagApplicableTo, TagMeta, TagValueType
58
+ from supervisely.api.constants import DOWNLOAD_BATCH_SIZE
58
59
  from supervisely.api.dataset_api import DatasetInfo
59
60
  from supervisely.api.entity_annotation.figure_api import FigureApi
60
61
  from supervisely.api.entity_annotation.tag_api import TagApi
@@ -368,7 +369,7 @@ class ImageInfo(NamedTuple):
368
369
  #: :class:`int`: ID of the blob file in Supervisely storage related to the image.
369
370
  related_data_id: Optional[int] = None
370
371
 
371
- #: :class:`str`: Unique ID of the image that links it to the corresponding blob file in Supervisely storage
372
+ #: :class:`str`: Unique ID of the image that links it to the corresponding blob file in Supervisely storage
372
373
  #: uses for downloading source blob file.
373
374
  download_id: Optional[str] = None
374
375
 
@@ -1015,7 +1016,14 @@ class ImageApi(RemoveableBulkModuleApi):
1015
1016
  """
1016
1017
  Get image id and it content from given dataset and list of images ids.
1017
1018
  """
1018
- for batch_ids in batched(ids):
1019
+ if DOWNLOAD_BATCH_SIZE is not None and isinstance(DOWNLOAD_BATCH_SIZE, int):
1020
+ batches = batched(ids, DOWNLOAD_BATCH_SIZE)
1021
+ logger.debug(
1022
+ f"Batch size for func 'ImageApi._download_batch' changed to: {DOWNLOAD_BATCH_SIZE}"
1023
+ )
1024
+ else:
1025
+ batches = batched(ids)
1026
+ for batch_ids in batches:
1019
1027
  response = self._api.post(
1020
1028
  "images.bulk.download",
1021
1029
  {ApiField.DATASET_ID: dataset_id, ApiField.IMAGE_IDS: batch_ids},
@@ -2352,7 +2360,9 @@ class ImageApi(RemoveableBulkModuleApi):
2352
2360
 
2353
2361
  for batch in blob_image_infos_generator:
2354
2362
  names = [item.name for item in batch]
2355
- metas_batch = [metas[name] for name in names] if metas is not None else [{}] * len(names)
2363
+ metas_batch = (
2364
+ [metas[name] for name in names] if metas is not None else [{}] * len(names)
2365
+ )
2356
2366
  items = [
2357
2367
  {ApiField.TEAM_FILE_ID: team_file_id, ApiField.SOURCE_BLOB: item.offsets_dict}
2358
2368
  for item in batch
@@ -284,8 +284,64 @@ def download_fast(
284
284
  Download project in a fast mode.
285
285
  Items are downloaded asynchronously. If an error occurs, the method will fallback to synchronous download.
286
286
  Automatically detects project type.
287
- You can pass :class:`ProjectInfo` as `project_info` kwarg to avoid additional API requests.
287
+
288
+ :param api: Supervisely API address and token.
289
+ :type api: :class:`Api<supervisely.api.api.Api>`
290
+ :param project_id: Supervisely downloadable project ID.
291
+ :type project_id: :class:`int`
292
+ :param dest_dir: Destination directory.
293
+ :type dest_dir: :class:`str`
294
+ :param dataset_ids: Filter datasets by IDs.
295
+ :type dataset_ids: :class:`list` [ :class:`int` ], optional
296
+ :param log_progress: Show uploading progress bar.
297
+ :type log_progress: :class:`bool`
298
+ :param progress_cb: Function for tracking download progress.
299
+ :type progress_cb: tqdm or callable, optional
300
+ :param semaphore: Semaphore to limit the number of concurrent downloads of items.
301
+ :type semaphore: :class:`asyncio.Semaphore`, optional
302
+ :param only_image_tags: Download project with only images tags (without objects tags).
303
+ :type only_image_tags: :class:`bool`, optional
304
+ :param save_image_info: Download images infos or not.
305
+ :type save_image_info: :class:`bool`, optional
306
+ :param save_images: Download images or not.
307
+ :type save_images: :class:`bool`, optional
308
+ :param save_image_meta: Download images metadata in JSON format or not.
309
+ :type save_image_meta: :class:`bool`, optional
310
+ :param images_ids: Filter images by IDs.
311
+ :type images_ids: :class:`list` [ :class:`int` ], optional
312
+ :param resume_download: Resume download enables to download only missing files avoiding erase of existing files.
313
+ :type resume_download: :class:`bool`, optional
314
+ :param switch_size: Size threshold that determines how an item will be downloaded.
315
+ Items larger than this size will be downloaded as single files, while smaller items will be downloaded as a batch.
316
+ Useful for projects with different item sizes and when you exactly know which size will perform better with batch download.
317
+ :type switch_size: :class:`int`, optional
318
+ :param batch_size: Number of items to download in a single batch.
319
+ :type batch_size: :class:`int`, optional
320
+ :param download_blob_files: Download project with Blob files in native format.
321
+ If False - download project like a regular project in classic Supervisely format.
322
+ :type download_blob_files: :class:`bool`, optional
323
+ :param project_info: Project info object. To avoid additional API requests.
324
+ :type project_info: :class:`ProjectInfo`, optional
325
+ :return: None
326
+ :rtype: NoneType
327
+
328
+ :Usage example:
329
+
330
+ .. code-block:: python
331
+
332
+ import supervisely as sly
333
+
334
+ os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com'
335
+ os.environ['API_TOKEN'] = 'Your Supervisely API Token'
336
+ api = sly.Api.from_env()
337
+
338
+ project_id = 8888
339
+ save_directory = "/path/to/save/projects"
340
+
341
+ sly.download_fast(api, project_id, save_directory)
342
+
288
343
  """
344
+
289
345
  download_async_or_sync(
290
346
  api=api,
291
347
  project_id=project_id,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.347
3
+ Version: 6.73.348
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -1,5 +1,5 @@
1
1
  supervisely/README.md,sha256=XM-DiMC6To3I9RjQZ0c61905EFRR_jnCUx2q3uNR-X8,3331
2
- supervisely/__init__.py,sha256=mVZ34ziMzw-Hlr5kaTt1xSh5VZIWrTgTNeSyLKcrOyI,10867
2
+ supervisely/__init__.py,sha256=_qphKFT0_toEQmF5IjB1sWjztbF4lP1tLY29PBJhArY,10917
3
3
  supervisely/_utils.py,sha256=DA-sPMk68GyInrc4DMxO-Azp5-uWkwZx_NAr8mXVI0o,18280
4
4
  supervisely/function_wrapper.py,sha256=R5YajTQ0GnRp2vtjwfC9hINkzQc0JiyGsu8TER373xY,1912
5
5
  supervisely/sly_logger.py,sha256=z92Vu5hmC0GgTIJO1n6kPDayRW9__8ix8hL6poDZj-Y,6274
@@ -24,11 +24,12 @@ supervisely/api/agent_api.py,sha256=ShWAIlXcWXcyI9fqVuP5GZVCigCMJmjnvdGUfLspD6Y,
24
24
  supervisely/api/annotation_api.py,sha256=XE3Sr_oQOMraZ9NlWs9ZqUsff1j47XRDh9Fy8rW4ubw,82763
25
25
  supervisely/api/api.py,sha256=D90G6ivwyHHK7WVo4ByKtv65lSED_Sm1qlp_TpyCeAc,67398
26
26
  supervisely/api/app_api.py,sha256=RsbVej8WxWVn9cNo5s3Fqd1symsCdsfOaKVBKEUapRY,71927
27
+ supervisely/api/constants.py,sha256=qwK9Q3mHGz5Ny5WuBmPQgawBWfzCT2DRiw3IcaCDRmo,44
27
28
  supervisely/api/dataset_api.py,sha256=c6rEVySSxbyDB5fUCilsc5AKk0pWN_5vVN6OceDbEvc,47918
28
29
  supervisely/api/file_api.py,sha256=EX_Cam93QkR5SOOIkIznkzERIr0u7N7GHVGK27iOm20,92952
29
30
  supervisely/api/github_api.py,sha256=NIexNjEer9H5rf5sw2LEZd7C1WR-tK4t6IZzsgeAAwQ,623
30
31
  supervisely/api/image_annotation_tool_api.py,sha256=YcUo78jRDBJYvIjrd-Y6FJAasLta54nnxhyaGyanovA,5237
31
- supervisely/api/image_api.py,sha256=pPY8K4hKKE4hvWNB6VEXd-AypSCqrivCWWsHDQKKu6g,223223
32
+ supervisely/api/image_api.py,sha256=sE2lIPPYLv1tJsuFSjc9IvLVB07kmq9PnPodU3J6aEs,223637
32
33
  supervisely/api/import_storage_api.py,sha256=BDCgmR0Hv6OoiRHLCVPKt3iDxSVlQp1WrnKhAK_Zl84,460
33
34
  supervisely/api/issues_api.py,sha256=BqDJXmNoTzwc3xe6_-mA7FDFC5QQ-ahGbXk_HmpkSeQ,17925
34
35
  supervisely/api/labeling_job_api.py,sha256=VM1pjM65cUTeer1hrI7cSmCUOHJb7fzK6gJ-abA07hg,55097
@@ -1017,7 +1018,7 @@ supervisely/pointcloud_episodes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
1017
1018
  supervisely/pointcloud_episodes/pointcloud_episodes.py,sha256=cRXdtw7bMsbsdVQjxfWxFSESrO-LGiqqsZyyExl2Mbg,3430
1018
1019
  supervisely/project/__init__.py,sha256=hlzdj9Pgy53Q3qdP8LMtGTChvZHQuuShdtui2eRUQeE,2601
1019
1020
  supervisely/project/data_version.py,sha256=P5Lui6i64pYeJWmAdGJDv8GRXxjfpSSZ8zT_MxIrynE,19553
1020
- supervisely/project/download.py,sha256=4QOEQZnolmOpEO6Wl6DIc73BwIYr9m-6anbarrU6VwQ,24902
1021
+ supervisely/project/download.py,sha256=N6UEXY_eLtzjz61Y2SaJLg2-vv_Cvp9cXCUUM9R8-d8,27677
1021
1022
  supervisely/project/pointcloud_episode_project.py,sha256=yiWdNBQiI6f1O9sr1pg8JHW6O-w3XUB1rikJNn3Oung,41866
1022
1023
  supervisely/project/pointcloud_project.py,sha256=Kx1Vaes-krwG3BiRRtHRLQxb9G5m5bTHPN9IzRqmNWo,49399
1023
1024
  supervisely/project/project.py,sha256=OunVB11sVQSOvkqkjsEEkX1nq9OUXOXpHTdcLDjOFe0,233256
@@ -1082,9 +1083,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1082
1083
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1083
1084
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1084
1085
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1085
- supervisely-6.73.347.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1086
- supervisely-6.73.347.dist-info/METADATA,sha256=7GkOnoQKswP3aWdQvd8kRV27PVdnozTXeuKEqlGv734,33596
1087
- supervisely-6.73.347.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1088
- supervisely-6.73.347.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1089
- supervisely-6.73.347.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1090
- supervisely-6.73.347.dist-info/RECORD,,
1086
+ supervisely-6.73.348.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1087
+ supervisely-6.73.348.dist-info/METADATA,sha256=Heozuyuf1zukvQzantkbHHyMXh1S4WnVFvWm0p4JIE8,33596
1088
+ supervisely-6.73.348.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1089
+ supervisely-6.73.348.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1090
+ supervisely-6.73.348.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1091
+ supervisely-6.73.348.dist-info/RECORD,,