@@ -674,6 +674,51 @@ def delete_images(
674674 f"Images deleted in project { project_name } { '/' + folder_name if folder_name else '' } "
675675 )
676676
677+ def assign_items (
678+ self , project : Union [NotEmptyStr , dict ], items : List [str ], user : str
679+ ):
680+ """Assigns items to a user. The assignment role, QA or Annotator, will
681+ be deduced from the user's role in the project. The type of the objects` image, video or text
682+ will be deduced from the project type. With SDK, the user can be
683+ assigned to a role in the project with the share_project function.
684+
685+ :param project: project name or folder path (e.g., "project1/folder1")
686+ :type project: str
687+ :param items: list of items to assign
688+ :type item_names: list of str
689+ :param user: user email
690+ :type user: str
691+ """
692+
693+ project_name , folder_name = extract_project_folder (project )
694+
695+ response = self .controller .assign_items (project_name , folder_name , items , user )
696+
697+ if not response .errors :
698+ logger .info (f"Assign items to user { user } " )
699+ else :
700+ raise AppException (response .errors )
701+
702+ def unassign_items (
703+ self , project : Union [NotEmptyStr , dict ], items : List [NotEmptyStr ]
704+ ):
705+ """Removes assignment of given items for all assignees. With SDK,
706+ the user can be assigned to a role in the project with the share_project
707+ function.
708+
709+ :param project: project name or folder path (e.g., "project1/folder1")
710+ :type project: str
711+ :param items: list of items to unassign
712+ :type item_names: list of str
713+ """
714+ project_name , folder_name = extract_project_folder (project )
715+
716+ response = self .controller .un_assign_items (
717+ project_name = project_name , folder_name = folder_name , item_names = items
718+ )
719+ if response .errors :
720+ raise AppException (response .errors )
721+
677722 def assign_images (
678723 self , project : Union [NotEmptyStr , dict ], image_names : List [str ], user : str
679724 ):
@@ -688,6 +733,14 @@ def assign_images(
688733 :param user: user email
689734 :type user: str
690735 """
736+
737+ warning_msg = (
738+ "We're deprecating the assign_images function. Please use assign_items instead."
739+ "Learn more. \n "
740+ "https://superannotate.readthedocs.io/en/stable/superannotate.sdk.html#superannotate.assign_items"
741+ )
742+ logger .warning (warning_msg )
743+ warnings .warn (warning_msg , DeprecationWarning )
691744 project_name , folder_name = extract_project_folder (project )
692745 project = self .controller .get_project_metadata (project_name ).data
693746
@@ -726,18 +779,26 @@ def assign_images(
726779 def unassign_images (
727780 self , project : Union [NotEmptyStr , dict ], image_names : List [NotEmptyStr ]
728781 ):
729- """Removes assignment of given images for all assignees.With SDK,
782+ """Removes assignment of given images for all assignees. With SDK,
730783 the user can be assigned to a role in the project with the share_project
731784 function.
732785
733786 :param project: project name or folder path (e.g., "project1/folder1")
734787 :type project: str
735- :param image_names: list of image unassign
788+ :param image_names: list of images to unassign
736789 :type image_names: list of str
737790 """
791+
792+ warning_msg = (
793+ "We're deprecating the unassign_images function. Please use unassign_items instead."
794+ "Learn more. \n "
795+ "https://superannotate.readthedocs.io/en/stable/superannotate.sdk.html#superannotate.unassign_items"
796+ )
797+ logger .warning (warning_msg )
798+ warnings .warn (warning_msg , DeprecationWarning )
738799 project_name , folder_name = extract_project_folder (project )
739800
740- response = self .controller .un_assign_images (
801+ response = self .controller .un_assign_items (
741802 project_name = project_name , folder_name = folder_name , image_names = image_names
742803 )
743804 if response .errors :
0 commit comments