diff --git a/cvat-sdk/cvat_sdk/core/proxies/tasks.py b/cvat-sdk/cvat_sdk/core/proxies/tasks.py index c86c3a71c43b..4382af82bacd 100644 --- a/cvat-sdk/cvat_sdk/core/proxies/tasks.py +++ b/cvat-sdk/cvat_sdk/core/proxies/tasks.py @@ -252,60 +252,6 @@ def download_frames( outfile = filename_pattern.format(frame_id=frame_id, frame_ext=im_ext) im.save(outdir / outfile) - def export_dataset( - self, - format_name: str, - filename: StrPath, - *, - pbar: Optional[ProgressReporter] = None, - status_check_period: Optional[int] = None, - include_images: bool = True, - ) -> None: - """ - Download annotations for a task in the specified format (e.g. 'YOLO ZIP 1.0'). - """ - - filename = Path(filename) - - if include_images: - endpoint = self.api.retrieve_dataset_endpoint - else: - endpoint = self.api.retrieve_annotations_endpoint - - Downloader(self._client).prepare_and_download_file_from_endpoint( - endpoint=endpoint, - filename=filename, - url_params={"id": self.id}, - query_params={"format": format_name}, - pbar=pbar, - status_check_period=status_check_period, - ) - - self._client.logger.info(f"Dataset for task {self.id} has been downloaded to {filename}") - - def download_backup( - self, - filename: StrPath, - *, - status_check_period: int = None, - pbar: Optional[ProgressReporter] = None, - ) -> None: - """ - Download a task backup - """ - - filename = Path(filename) - - Downloader(self._client).prepare_and_download_file_from_endpoint( - self.api.retrieve_backup_endpoint, - filename=filename, - pbar=pbar, - status_check_period=status_check_period, - url_params={"id": self.id}, - ) - - self._client.logger.info(f"Backup for task {self.id} has been downloaded to {filename}") - def get_jobs(self) -> List[Job]: return [ Job(self._client, model=m) diff --git a/tests/python/sdk/test_tasks.py b/tests/python/sdk/test_tasks.py index cd640f5e6c37..2450e46e9a35 100644 --- a/tests/python/sdk/test_tasks.py +++ b/tests/python/sdk/test_tasks.py @@ -55,19 +55,6 @@ def fxt_backup_file(self, fxt_new_task: Task, fxt_coco_file: str): yield backup_path - @pytest.fixture - def fxt_new_task(self, fxt_image_file: Path): - task = self.client.tasks.create_from_data( - spec={ - "name": "test_task", - "labels": [{"name": "car"}, {"name": "person"}], - }, - resources=[fxt_image_file], - data_params={"image_quality": 80}, - ) - - return task - @pytest.fixture def fxt_new_task_without_data(self): task = self.client.tasks.create( @@ -345,33 +332,6 @@ def test_can_download_dataset_twice_in_a_row(self, fxt_new_task: Task): assert "100%" in pbar_out.getvalue().strip("\r").split("\r")[-1] assert path.is_file() - @pytest.mark.parametrize("include_images, all_images, expected_image_count", - [ - (True, True, 5), - (True, False, 1), - (False, False, 0), - ] - ) - def test_can_download_dataset_multiple_images(self, fxt_task_with_multiple_images: Task, include_images: bool, all_images: bool, expected_image_count: int): - pbar_out = io.StringIO() - pbar = make_pbar(file=pbar_out) - - task_id = fxt_task_with_multiple_images.id - path = self.tmp_path / f"task_{task_id}-cvat.zip" - task = self.client.tasks.retrieve(task_id) - - task.export_dataset( - format_name="CVAT for images 1.1", - filename=path, - pbar=pbar, - include_images=include_images, - all_images=all_images, - ) - - assert "100%" in pbar_out.getvalue().strip("\r").split("\r")[-1] - assert path.is_file() - assert self.stdout.getvalue() == "" - with zipfile.ZipFile(path, 'r') as zip_file: image_files = [f for f in zip_file.namelist() if f.endswith(('.jpg', '.png', '.jpeg'))] assert len(image_files) == expected_image_count