Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/api_reference/api_annotation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Annotations
.. automethod:: superannotate.SAClient.set_annotation_statuses
.. automethod:: superannotate.SAClient.delete_annotations
.. _ref_upload_annotations_from_folder_to_project:
.. automethod:: superannotate.SAClient.upload_annotations_from_folder_to_project
.. automethod:: superannotate.SAClient.upload_annotations_from_folder_to_project
19 changes: 14 additions & 5 deletions src/superannotate/lib/app/interface/sdk_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ def create_project(
if invalid_classes:
seen = set()
seen_add = seen.add
invalid_classes = [i for i in invalid_classes if not (i in seen or seen_add(i))]
invalid_classes = [
i for i in invalid_classes if not (i in seen or seen_add(i))
]
raise AppException(
f"There are no [{', '.join(invalid_classes)}] classes created in the project."
)
Expand Down Expand Up @@ -475,13 +477,16 @@ def clone_project(
f"Workflow is not supported in {project.type.name} project."
)
project_copy = copy.copy(project)
if project_copy.type in (
constants.ProjectType.VECTOR,
constants.ProjectType.PIXEL,
):
project_copy.upload_state = constants.UploadState.INITIAL
if project_description:
project_copy.description = project_description
else:
project_copy.description = project.description
project_copy.name = project_name
if project.type in (constants.ProjectType.VECTOR, constants.ProjectType.PIXEL):
project.upload_state = enums.UploadState.INITIAL
create_response = self.controller.projects.create(project_copy)
create_response.raise_for_status()
new_project = create_response.data
Expand All @@ -501,7 +506,9 @@ def clone_project(
project.classes = classes_response.data
if copy_workflow:
if not copy_annotation_classes:
logger.info(f"Skipping the workflow clone from {from_project} to {project_name}.")
logger.info(
f"Skipping the workflow clone from {from_project} to {project_name}."
)
else:
logger.info(f"Cloning workflow from {from_project} to {project_name}.")
workflow_response = self.controller.projects.set_workflows(
Expand Down Expand Up @@ -2174,7 +2181,9 @@ def add_contributors_to_project(
"""
project = self.controller.projects.get_by_name(project).data
contributors = [
entities.ContributorEntity(user_id=email, user_role=constants.UserRole(role))
entities.ContributorEntity(
user_id=email, user_role=constants.UserRole(role)
)
for email in emails
]
response = self.controller.projects.add_contributors(
Expand Down
4 changes: 2 additions & 2 deletions src/superannotate/lib/core/usecases/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,8 @@ def execute(self):
team_users = set()
project_users = {user.user_id for user in self._project.users}
for user in self._team.users:
if user['user_role'] > constances.UserRole.ADMIN.value:
team_users.add(user['email'])
if user["user_role"] > constances.UserRole.ADMIN.value:
team_users.add(user["email"])
# collecting pending team users which is not admin
for user in self._team.pending_invitations:
if user["user_role"] > constances.UserRole.ADMIN.value:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/projects/test_clone_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_clone_project(self):
copy_annotation_classes=True,
)
self.assertEqual(
new_project["upload_state"], constances.UploadState.EXTERNAL.name
new_project["upload_state"], constances.UploadState.INITIAL.name
)
new_settings = sa.get_project_settings(self.PROJECT_NAME_2)
for setting in new_settings:
Expand Down Expand Up @@ -211,7 +211,7 @@ def test_clone_video_project(self):
)
self.assertEqual(new_project["name"], self.PROJECT_NAME_2)
self.assertEqual(new_project["type"].lower(), "video")
self.assertEqual(new_project["description"], self._project_1['description'])
self.assertEqual(new_project["description"], self._project_1["description"])

def test_clone_video_project_frame_mode_on(self):
self._project_1 = sa.create_project(
Expand Down