@@ -137,6 +137,7 @@ def _copy_images(
137137 source_project , destination_project , image_names , include_annotations ,
138138 copy_annotation_status , copy_pin
139139):
140+ NUM_TO_SEND = 500
140141 source_project , source_project_folder = source_project
141142 destination_project , destination_project_folder = destination_project
142143 if source_project ["id" ] != destination_project ["id" ]:
@@ -149,18 +150,27 @@ def _copy_images(
149150 "project_id" : source_project ["id" ]
150151 }
151152 json_req = {
152- "image_names" : image_names ,
153153 "destination_folder_id" : destination_project_folder ["id" ],
154154 "source_folder_name" : source_project_folder ["name" ]
155155 }
156- response = _api .send_request (
157- req_type = 'POST' , path = '/image/copy' , params = params , json_req = json_req
158- )
159- if not response .ok :
160- raise SABaseException (
161- response .status_code , "Couldn't copy images " + response .text
156+ res = {}
157+ res ['skipped' ] = 0
158+ for start_index in range (0 , len (image_names ), NUM_TO_SEND ):
159+ json_req ["image_names" ] = image_names [start_index :start_index +
160+ NUM_TO_SEND ]
161+ response = _api .send_request (
162+ req_type = 'POST' ,
163+ path = '/image/copy' ,
164+ params = params ,
165+ json_req = json_req
162166 )
163167
168+ if not response .ok :
169+ raise SABaseException (
170+ response .status_code , "Couldn't copy images " + response .text
171+ )
172+ res ['skipped' ] += response .json ()['skipped' ]
173+
164174 for image_name in image_names :
165175 if include_annotations :
166176 annotations = get_image_annotations (
@@ -192,13 +202,13 @@ def _copy_images(
192202 (destination_project , destination_project_folder ),
193203 image_name , img_metadata ["is_pinned" ]
194204 )
195- return response . json ()
205+ return res
196206
197207
198208def copy_images (
199209 source_project ,
210+ image_names ,
200211 destination_project ,
201- image_names = None ,
202212 include_annotations = True ,
203213 copy_annotation_status = True ,
204214 copy_pin = True
@@ -207,10 +217,10 @@ def copy_images(
207217
208218 :param source_project: project name or folder path (e.g., "project1/folder1")
209219 :type source_project: str
210- :param destination_project: project name or folder path (e.g., "project1/folder2")
211- :type destination_project: str
212220 :param image_names: image names. If None, all images from source project will be copied
213221 :type image: list of str
222+ :param destination_project: project name or folder path (e.g., "project1/folder2")
223+ :type destination_project: str
214224 :param include_annotations: enables annotations copy
215225 :type include_annotations: bool
216226 :param copy_annotation_status: enables annotations status copy
@@ -279,8 +289,8 @@ def delete_images(project, image_names):
279289
280290def move_images (
281291 source_project ,
292+ image_names ,
282293 destination_project ,
283- image_names = None ,
284294 include_annotations = True ,
285295 copy_annotation_status = True ,
286296 copy_pin = True ,
@@ -289,10 +299,10 @@ def move_images(
289299
290300 :param source_project: project name or folder path (e.g., "project1/folder1")
291301 :type source_project: str
292- :param destination_project: project name or folder path (e.g., "project1/folder2")
293- :type destination_project: str
294302 :param image_names: image names. If None, all images from source project will be moved
295303 :type image: list of str
304+ :param destination_project: project name or folder path (e.g., "project1/folder2")
305+ :type destination_project: str
296306 :param include_annotations: enables annotations copy
297307 :type include_annotations: bool
298308 :param copy_annotation_status: enables annotations status copy
0 commit comments