|
11 | 11 | from io import BytesIO |
12 | 12 | from pathlib import Path |
13 | 13 | from typing import List |
14 | | -from typing import Literal |
15 | 14 | from typing import Optional |
16 | 15 | from typing import Union |
17 | 16 | from urllib.parse import urlparse |
@@ -481,7 +480,7 @@ def search_folders( |
481 | 480 | def get_image_bytes( |
482 | 481 | project: Union[str, dict], |
483 | 482 | image_name: str, |
484 | | - variant: Literal["original", "lores"] = "original", |
| 483 | + variant: str = "original", |
485 | 484 | ): |
486 | 485 | """Returns an io.BytesIO() object of the image. Suitable for creating |
487 | 486 | PIL.Image out of it. |
@@ -597,17 +596,8 @@ def upload_images_from_public_urls_to_project( |
597 | 596 | project: Union[str, dict], |
598 | 597 | img_urls: List[str], |
599 | 598 | img_names: Optional[List[str]] = None, |
600 | | - annotation_status: Optional[ |
601 | | - Literal[ |
602 | | - "NotStarted", |
603 | | - "InProgress", |
604 | | - "QualityCheck", |
605 | | - "Returned", |
606 | | - "Completed", |
607 | | - "Skipped", |
608 | | - ] |
609 | | - ] = "NotStarted", |
610 | | - image_quality_in_editor: Optional[Literal["compressed", "original"]] = None, |
| 599 | + annotation_status: Optional[str] = "NotStarted", |
| 600 | + image_quality_in_editor: Optional[str] = None, |
611 | 601 | ): |
612 | 602 | """Uploads all images given in the list of URL strings in img_urls to the project. |
613 | 603 | Sets status of all the uploaded images to annotation_status if it is not None. |
@@ -823,7 +813,7 @@ def move_images( |
823 | 813 | ).data |
824 | 814 | moved_count = len(moved_images) |
825 | 815 | message_postfix = "{from_path} to {to_path}." |
826 | | - message_prefix = "Copied images from " |
| 816 | + message_prefix = "Moved images from " |
827 | 817 | if moved_count > 1 or moved_count == 0: |
828 | 818 | message_prefix = f"Moved {moved_count}/{len(image_names)} images from " |
829 | 819 | elif moved_count == 1: |
@@ -992,7 +982,7 @@ def get_project_default_image_quality_in_editor(project: Union[str, dict]): |
992 | 982 | @validate_input |
993 | 983 | def set_project_default_image_quality_in_editor( |
994 | 984 | project: Union[str, dict], |
995 | | - image_quality_in_editor: Optional[Literal["compressed", "original"]], |
| 985 | + image_quality_in_editor: Optional[str], |
996 | 986 | ): |
997 | 987 | """Sets project's default image quality in editor setting. |
998 | 988 |
|
@@ -1087,9 +1077,7 @@ def get_image_metadata(project: Union[str, dict], image_name: str, *_, **__): |
1087 | 1077 | def set_images_annotation_statuses( |
1088 | 1078 | project: Union[str, dict], |
1089 | 1079 | image_names: List[str], |
1090 | | - annotation_status: Literal[ |
1091 | | - "NotStarted", "InProgress", "QualityCheck", "Returned", "Completed", "Skipped", |
1092 | | - ], |
| 1080 | + annotation_status: str, |
1093 | 1081 | ): |
1094 | 1082 | """Sets annotation statuses of images |
1095 | 1083 |
|
@@ -1497,7 +1485,7 @@ def upload_images_from_folder_to_project( |
1497 | 1485 | from_s3_bucket=None, |
1498 | 1486 | exclude_file_patterns: Optional[str] = constances.DEFAULT_FILE_EXCLUDE_PATTERNS, |
1499 | 1487 | recursive_subfolders: Optional[bool] = False, |
1500 | | - image_quality_in_editor: Optional[Literal["compressed", "original"]] = None, |
| 1488 | + image_quality_in_editor: Optional[str] = None, |
1501 | 1489 | ): |
1502 | 1490 | """Uploads all images with given extensions from folder_path to the project. |
1503 | 1491 | Sets status of all the uploaded images to set_status if it is not None. |
@@ -1689,7 +1677,7 @@ def upload_images_from_s3_bucket_to_project( |
1689 | 1677 | secretAccessKey: str, |
1690 | 1678 | bucket_name: str, |
1691 | 1679 | folder_path: str, |
1692 | | - image_quality_in_editor: Optional[Literal["compressed", "original"]] = None, |
| 1680 | + image_quality_in_editor: Optional[str] = None, |
1693 | 1681 | ): |
1694 | 1682 | """Uploads all images from AWS S3 bucket to the project. |
1695 | 1683 |
|
|
0 commit comments