1515from typing import TypeVar
1616from typing import Union
1717
18- import pydantic
1918from typing_extensions import Literal
2019
2120if sys .version_info < (3 , 11 ):
2423 from typing import TypedDict , NotRequired , Required # noqa
2524
2625import boto3
27- from pydantic import conlist
28- from pydantic import constr
29- from pydantic import parse_obj_as
30- from pydantic .error_wrappers import ValidationError
26+
3127from tqdm import tqdm
3228
3329import lib .core as constants
6157from lib .core .types import MLModel
6258from lib .core .types import PriorityScoreEntity
6359from lib .core .types import Project
60+ from lib .core .pydantic_v1 import ValidationError
61+ from lib .core .pydantic_v1 import constr
62+ from lib .core .pydantic_v1 import conlist
63+ from lib .core .pydantic_v1 import parse_obj_as
6464from lib .infrastructure .utils import extract_project_folder
6565from lib .infrastructure .validators import wrap_error
6666
6767
6868logger = logging .getLogger ("sa" )
6969
70-
7170NotEmptyStr = TypeVar ("NotEmptyStr" , bound = constr (strict = True , min_length = 1 ))
7271
73-
7472PROJECT_STATUS = Literal ["NotStarted" , "InProgress" , "Completed" , "OnHold" ]
7573
7674PROJECT_TYPE = Literal [
@@ -1131,6 +1129,7 @@ def prepare_export(
11311129 annotation_statuses : Optional [List [ANNOTATION_STATUS ]] = None ,
11321130 include_fuse : Optional [bool ] = False ,
11331131 only_pinned = False ,
1132+ ** kwargs ,
11341133 ):
11351134 """Prepare annotations and classes.json for export. Original and fused images for images with
11361135 annotations can be included with include_fuse flag.
@@ -1147,6 +1146,8 @@ def prepare_export(
11471146 :type include_fuse: bool
11481147 :param only_pinned: enable only pinned output in export. This option disables all other types of output.
11491148 :type only_pinned: bool
1149+ :param kwargs: Arbitrary kwarg ``integration_name``
1150+ can be provided which will be used as a storage to store export file
11501151
11511152 :return: metadata object of the prepared export
11521153 :rtype: dict
@@ -1165,12 +1166,22 @@ def prepare_export(
11651166 constants .AnnotationStatus .COMPLETED .name ,
11661167 constants .AnnotationStatus .SKIPPED .name ,
11671168 ]
1169+ integration_name = kwargs .get ("integration_name" )
1170+ integration_id = None
1171+ if integration_name :
1172+ for integration in self .controller .integrations .list ().data :
1173+ if integration .name == integration_name :
1174+ integration_id = integration .id
1175+ break
1176+ else :
1177+ raise AppException ("Integration not found." )
11681178 response = self .controller .prepare_export (
11691179 project_name = project_name ,
11701180 folder_names = folders ,
11711181 include_fuse = include_fuse ,
11721182 only_pinned = only_pinned ,
11731183 annotation_statuses = annotation_statuses ,
1184+ integration_id = integration_id ,
11741185 )
11751186 if response .errors :
11761187 raise AppException (response .errors )
@@ -2558,7 +2569,7 @@ def attach_items(
25582569 for item , count in collections .Counter (attachments ).items ()
25592570 if count > 1
25602571 ]
2561- except pydantic . ValidationError :
2572+ except ValidationError :
25622573 (
25632574 unique_attachments ,
25642575 duplicate_attachments ,
0 commit comments