superannotate 4.6.2__tar.gz → 4.6.3b1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {superannotate-4.6.2/src/superannotate.egg-info → superannotate-4.6.3b1}/PKG-INFO +1 -1
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/__init__.py +1 -1
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/sdk_interface.py +138 -6
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/__init__.py +8 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/filters.py +9 -3
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/project.py +3 -1
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/work_managament.py +3 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/enums.py +8 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/jsx_conditions.py +18 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/serviceproviders.py +20 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/controller.py +42 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/query_builder.py +24 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/serviceprovider.py +17 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/project.py +20 -1
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/work_management.py +1 -1
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/utils.py +4 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1/src/superannotate.egg-info}/PKG-INFO +1 -1
- {superannotate-4.6.2 → superannotate-4.6.3b1}/LICENSE +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/MANIFEST.in +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/README.rst +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/requirements.txt +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/setup.cfg +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/setup.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/analytics/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/analytics/aggregators.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/analytics/common.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/bin/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/bin/superannotate.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/common.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/exceptions.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/helpers.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/conversion.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/baseStrategy.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/coco_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_api.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_converter.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/coco_converters/sa_vector_to_coco.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/converters.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_helper.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/googlecloud_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/googlecloud_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_helper.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/sa_json_helper.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/sagemaker_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/sagemaker_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_helper.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/vgg_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_helper.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/voc_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_helper.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_to_sa_pixel.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/vott_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/vott_converters/vott_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/vott_converters/vott_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/yolo_converters/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/yolo_converters/yolo_strategies.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/converters/yolo_converters/yolo_to_sa_vector.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/export_from_sa_conversions.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/import_to_sa_conversions.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/base_interface.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/cli_interface.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/responses.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/sdk/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/sdk/explore.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/types.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/serializers.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/base_usecases.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/conditions.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/config.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/base.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/classes.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/context.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/folder.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/integrations.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/items.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/multimodal_form.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/project_entities.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/exceptions.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/plugin.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/reporter.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/repositories.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/response.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/service_types.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/types.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/annotations.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/base.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/classes.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/custom_fields.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/folders.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/images.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/integrations.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/items.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/models.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/projects.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/work_management.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/utils.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/video_convertor.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/annotation_adapter.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/custom_entities.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/helpers.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/repositories.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/__init__.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/annotation.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/annotation_class.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/auth.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/explore.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/folder.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/http_client.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/integration.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/item.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/item_service.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/telemetry_scoring.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/stream_data_handler.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/validators.py +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate.egg-info/SOURCES.txt +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate.egg-info/dependency_links.txt +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate.egg-info/entry_points.txt +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate.egg-info/requires.txt +0 -0
- {superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate.egg-info/top_level.txt +0 -0
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/sdk_interface.py
RENAMED
|
@@ -445,13 +445,13 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
445
445
|
|
|
446
446
|
def get_team_metadata(self, include: list[Literal["scores"]] | None = None):
|
|
447
447
|
"""
|
|
448
|
-
Returns team metadata, including optionally, scores.
|
|
448
|
+
Returns team metadata, including optionally, scores metadata.
|
|
449
449
|
|
|
450
450
|
:param include: Specifies additional fields to include in the response.
|
|
451
451
|
|
|
452
452
|
Possible values are
|
|
453
453
|
|
|
454
|
-
- "scores": If provided, the response will include score
|
|
454
|
+
- "scores": : If provided, the response will include the metadata of each score associated with the team.
|
|
455
455
|
|
|
456
456
|
:type include: list of str, optional
|
|
457
457
|
|
|
@@ -461,10 +461,9 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
461
461
|
response = self.controller.get_team()
|
|
462
462
|
team = response.data
|
|
463
463
|
if include and "scores" in include:
|
|
464
|
-
team.scores =
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
]
|
|
464
|
+
team.scores = BaseSerializer.serialize_iterable(
|
|
465
|
+
self.controller.work_management.list_score_templates().data
|
|
466
|
+
)
|
|
468
467
|
return TeamSerializer(team).serialize(exclude_unset=True)
|
|
469
468
|
|
|
470
469
|
def get_user_metadata(
|
|
@@ -1148,6 +1147,59 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
1148
1147
|
operation="remove",
|
|
1149
1148
|
)
|
|
1150
1149
|
|
|
1150
|
+
def set_project_user_role(
|
|
1151
|
+
self, project: NotEmptyStr | int, user: NotEmptyStr, role: NotEmptyStr
|
|
1152
|
+
) -> None:
|
|
1153
|
+
"""Sets the project-level role of a user who is already shared on the given
|
|
1154
|
+
project. The user is switched to the given role.
|
|
1155
|
+
|
|
1156
|
+
:param project: The name or ID of the project.
|
|
1157
|
+
:type project: Union[NotEmptyStr, int]
|
|
1158
|
+
|
|
1159
|
+
:param user: Email of user whose project role is being changed.
|
|
1160
|
+
The user must already be shared on the project.
|
|
1161
|
+
:type user: str
|
|
1162
|
+
|
|
1163
|
+
:param role: The project role to switch the user to. Case-sensitive.
|
|
1164
|
+
|
|
1165
|
+
Possible values are
|
|
1166
|
+
|
|
1167
|
+
- "ProjectAdmin": Full access to the project, including settings,
|
|
1168
|
+
sharing, and workload.
|
|
1169
|
+
- Any other role defined in the project: Pass the role's name exactly
|
|
1170
|
+
as it appears in the project.
|
|
1171
|
+
:type role: str
|
|
1172
|
+
|
|
1173
|
+
:rtype: None
|
|
1174
|
+
|
|
1175
|
+
:raises AppException: If the role does not exist in the project, or the
|
|
1176
|
+
project or user is not found.
|
|
1177
|
+
|
|
1178
|
+
Request Example:
|
|
1179
|
+
::
|
|
1180
|
+
|
|
1181
|
+
# To make a user a Project Admin on the project:
|
|
1182
|
+
sa_client.set_project_user_role(
|
|
1183
|
+
project="Image Project",
|
|
1184
|
+
user="test@superannotate.com",
|
|
1185
|
+
role="ProjectAdmin"
|
|
1186
|
+
)
|
|
1187
|
+
|
|
1188
|
+
# To assign a user a custom role on the project:
|
|
1189
|
+
sa_client.set_project_user_role(
|
|
1190
|
+
project="Image Project",
|
|
1191
|
+
user="test@superannotate.com",
|
|
1192
|
+
role="My Custom Role"
|
|
1193
|
+
)
|
|
1194
|
+
"""
|
|
1195
|
+
project = self.controller.get_project(project)
|
|
1196
|
+
self.controller.work_management.set_project_user_role(
|
|
1197
|
+
project=project, user=user, role=role
|
|
1198
|
+
)
|
|
1199
|
+
logger.info(
|
|
1200
|
+
f"Successfully set role {role} for user: {user} in project {project.name}."
|
|
1201
|
+
)
|
|
1202
|
+
|
|
1151
1203
|
def grant_project_user_permissions(
|
|
1152
1204
|
self,
|
|
1153
1205
|
project: NotEmptyStr | int,
|
|
@@ -1264,6 +1316,41 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
1264
1316
|
operation="revoke",
|
|
1265
1317
|
)
|
|
1266
1318
|
|
|
1319
|
+
def set_team_user_role(self, user: NotEmptyStr, role: str) -> None:
|
|
1320
|
+
"""Sets the team-level role of a team user. The user is switched to the given
|
|
1321
|
+
role, and role-specific permissions are reset to the defaults for that role.
|
|
1322
|
+
|
|
1323
|
+
:param user: Team user email of user whose role is being changed.
|
|
1324
|
+
:type user: str
|
|
1325
|
+
|
|
1326
|
+
:param role: The role to switch the user to. Case-sensitive.
|
|
1327
|
+
|
|
1328
|
+
Possible values are
|
|
1329
|
+
|
|
1330
|
+
- "Contributor": Contributor permissions can be granted afterwards with
|
|
1331
|
+
:func:`grant_team_user_permissions`.
|
|
1332
|
+
- "TeamAdmin": Team Admin permissions can be granted afterwards with
|
|
1333
|
+
:func:`grant_team_user_permissions`.
|
|
1334
|
+
:type role: str
|
|
1335
|
+
|
|
1336
|
+
:rtype: None
|
|
1337
|
+
|
|
1338
|
+
:raises AppException: If the role is not one of the supported values or the
|
|
1339
|
+
user is not found.
|
|
1340
|
+
|
|
1341
|
+
Request Example:
|
|
1342
|
+
::
|
|
1343
|
+
|
|
1344
|
+
# To promote a Contributor to Team Admin:
|
|
1345
|
+
sa_client.set_team_user_role(
|
|
1346
|
+
user="test@superannotate.com",
|
|
1347
|
+
role="TeamAdmin"
|
|
1348
|
+
)
|
|
1349
|
+
"""
|
|
1350
|
+
self.controller.work_management.set_team_user_role(user=user, role=role)
|
|
1351
|
+
role_name = "Team Admin" if role == "TeamAdmin" else role
|
|
1352
|
+
logger.info(f"Successfully set role: {role_name}, for user: {user}.")
|
|
1353
|
+
|
|
1267
1354
|
def grant_team_user_permissions(
|
|
1268
1355
|
self,
|
|
1269
1356
|
permissions: list[NotEmptyStr] | Literal["*"],
|
|
@@ -2550,6 +2637,7 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
2550
2637
|
"entropy_status": 1,
|
|
2551
2638
|
"sharing_status": None,
|
|
2552
2639
|
"status": "NotStarted",
|
|
2640
|
+
"priority": "High",
|
|
2553
2641
|
"folder_id": 1191383,
|
|
2554
2642
|
"workflow_id": 1,
|
|
2555
2643
|
"workflow": {
|
|
@@ -2974,6 +3062,39 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
2974
3062
|
raise AppException(f"Failed to change {project.name} status.")
|
|
2975
3063
|
logger.info(f"Successfully updated {project.name} status to {status}")
|
|
2976
3064
|
|
|
3065
|
+
def set_project_priority(self, project: NotEmptyStr | int, priority: str | None):
|
|
3066
|
+
"""Sets the priority of a project. Pass None as priority to clear it.
|
|
3067
|
+
|
|
3068
|
+
:param project: The name or ID of the project.
|
|
3069
|
+
:type project: str or int
|
|
3070
|
+
|
|
3071
|
+
:param priority: One of Highest, High, Medium, Low, Lowest, or None to clear the priority.
|
|
3072
|
+
|
|
3073
|
+
Available priorities are::
|
|
3074
|
+
|
|
3075
|
+
* Highest
|
|
3076
|
+
* High
|
|
3077
|
+
* Medium
|
|
3078
|
+
* Low
|
|
3079
|
+
* Lowest
|
|
3080
|
+
|
|
3081
|
+
:type priority: str or None
|
|
3082
|
+
|
|
3083
|
+
Request Example:
|
|
3084
|
+
::
|
|
3085
|
+
|
|
3086
|
+
# Set the priority of a single project
|
|
3087
|
+
sa_client.set_project_priority(
|
|
3088
|
+
project="Medical Imaging QA",
|
|
3089
|
+
priority="Highest"
|
|
3090
|
+
)
|
|
3091
|
+
"""
|
|
3092
|
+
project = self.controller.get_project(project)
|
|
3093
|
+
self.controller.projects.set_priority(project, priority)
|
|
3094
|
+
logger.info(
|
|
3095
|
+
f"Successfully changed the priority of project {project.name} to {priority}."
|
|
3096
|
+
)
|
|
3097
|
+
|
|
2977
3098
|
def set_project_custom_field(
|
|
2978
3099
|
self, project: NotEmptyStr | int, custom_field_name: str, value: Any
|
|
2979
3100
|
):
|
|
@@ -5283,6 +5404,10 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
5283
5404
|
- status__ne: Literal[“NotStarted”, “InProgress”, “Completed”, “OnHold”]
|
|
5284
5405
|
- status__in: List[Literal[“NotStarted”, “InProgress”, “Completed”, “OnHold”]]
|
|
5285
5406
|
- status__notin: List[Literal[“NotStarted”, “InProgress”, “Completed”, “OnHold”]]
|
|
5407
|
+
- priority: Literal[“Highest”, “High”, “Medium”, “Low”, “Lowest”, None]
|
|
5408
|
+
- priority__ne: Literal[“Highest”, “High”, “Medium”, “Low”, “Lowest”, None]
|
|
5409
|
+
- priority__in: List[Literal[“Highest”, “High”, “Medium”, “Low”, “Lowest”, None]]
|
|
5410
|
+
- priority__notin: List[Literal[“Highest”, “High”, “Medium”, “Low”, “Lowest”, None]]
|
|
5286
5411
|
|
|
5287
5412
|
Custom Fields Filtering:
|
|
5288
5413
|
|
|
@@ -5319,6 +5444,12 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
5319
5444
|
custom_field__Tag__in=["Tag1", "Tag3"]
|
|
5320
5445
|
)
|
|
5321
5446
|
|
|
5447
|
+
# Projects that are High or Highest priority
|
|
5448
|
+
sa_client.list_projects(
|
|
5449
|
+
priority__in=["Highest", "High"],
|
|
5450
|
+
name__contains="Medical",
|
|
5451
|
+
)
|
|
5452
|
+
|
|
5322
5453
|
Response Example:
|
|
5323
5454
|
::
|
|
5324
5455
|
|
|
@@ -5347,6 +5478,7 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
5347
5478
|
"settings": [],
|
|
5348
5479
|
"sharing_status": None,
|
|
5349
5480
|
"status": "InProgress",
|
|
5481
|
+
"priority": "High",
|
|
5350
5482
|
"team_id": 233435,
|
|
5351
5483
|
"type": "Vector",
|
|
5352
5484
|
"updatedAt": "2024-02-04T12:04:01.000Z",
|
|
@@ -9,6 +9,7 @@ from lib.core.config import Config
|
|
|
9
9
|
from lib.core.enums import ApprovalStatus
|
|
10
10
|
from lib.core.enums import FolderStatus
|
|
11
11
|
from lib.core.enums import ImageQuality
|
|
12
|
+
from lib.core.enums import ProjectPriority
|
|
12
13
|
from lib.core.enums import ProjectStatus
|
|
13
14
|
from lib.core.enums import ProjectType
|
|
14
15
|
from lib.core.enums import StepsType
|
|
@@ -32,6 +33,12 @@ DEFAULT_LOGGING_LEVEL = "INFO"
|
|
|
32
33
|
|
|
33
34
|
INVALID_TOKEN_ERROR = "Invalid token."
|
|
34
35
|
INVALID_TEAM_ID_ERROR = "Invalid team id provided."
|
|
36
|
+
INVALID_TEAM_USER_ROLE_ERROR = "Invalid role. Valid roles are: Contributor, TeamAdmin"
|
|
37
|
+
INVALID_PROJECT_USER_ROLE_ERROR = "Invalid role."
|
|
38
|
+
USER_NOT_FOUND_ERROR = "User not found."
|
|
39
|
+
INVALID_PROJECT_PRIORITY_ERROR = (
|
|
40
|
+
"Invalid priority value. Available values: Highest, High, Medium, Low, Lowest."
|
|
41
|
+
)
|
|
35
42
|
INVALID_CREDENTIALS_ERROR = "Invalid credentials provided."
|
|
36
43
|
INVALID_TEAM_CONTEXT = (
|
|
37
44
|
'Team context not provided. An Organization API key requires a "team_id".'
|
|
@@ -241,6 +248,7 @@ PROJECT_SETTINGS_VALID_ATTRIBUTES = [
|
|
|
241
248
|
|
|
242
249
|
__alL__ = (
|
|
243
250
|
FolderStatus,
|
|
251
|
+
ProjectPriority,
|
|
244
252
|
ProjectStatus,
|
|
245
253
|
ProjectType,
|
|
246
254
|
StepsType,
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/filters.py
RENAMED
|
@@ -34,15 +34,21 @@ class ItemFilters(BaseFilters):
|
|
|
34
34
|
categories__value__in: list[str] | None
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
PROJECT_PRIORITY = Literal["Highest", "High", "Medium", "Low", "Lowest"]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class FolderFilters(BaseFilters):
|
|
38
41
|
status: Literal["NotStarted", "InProgress", "Completed", "OnHold"]
|
|
39
42
|
status__ne: Literal["NotStarted", "InProgress", "Completed", "OnHold"]
|
|
40
43
|
status__in: list[Literal["NotStarted", "InProgress", "Completed", "OnHold"]]
|
|
41
44
|
status__notin: list[Literal["NotStarted", "InProgress", "Completed", "OnHold"]]
|
|
42
45
|
|
|
43
46
|
|
|
44
|
-
class FolderFilters
|
|
45
|
-
|
|
47
|
+
class ProjectFilters(FolderFilters):
|
|
48
|
+
priority: PROJECT_PRIORITY | None
|
|
49
|
+
priority__ne: PROJECT_PRIORITY | None
|
|
50
|
+
priority__in: list[PROJECT_PRIORITY | None]
|
|
51
|
+
priority__notin: list[PROJECT_PRIORITY | None]
|
|
46
52
|
|
|
47
53
|
|
|
48
54
|
#: The statuses a team API key can be filtered by, spelled as the SDK reports them
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/project.py
RENAMED
|
@@ -6,6 +6,7 @@ from typing import Any
|
|
|
6
6
|
from lib.core.entities.base import TimedBaseModel
|
|
7
7
|
from lib.core.entities.classes import AnnotationClassEntity
|
|
8
8
|
from lib.core.entities.work_managament import WMProjectUserEntity
|
|
9
|
+
from lib.core.enums import ProjectPriority
|
|
9
10
|
from lib.core.enums import ProjectStatus
|
|
10
11
|
from lib.core.enums import ProjectType
|
|
11
12
|
from pydantic import BaseModel
|
|
@@ -80,6 +81,7 @@ class ProjectEntity(TimedBaseModel):
|
|
|
80
81
|
entropy_status: int | None = None
|
|
81
82
|
sharing_status: int | None = None
|
|
82
83
|
status: ProjectStatus | None = None
|
|
84
|
+
priority: ProjectPriority | None = None
|
|
83
85
|
folder_id: int | None = None
|
|
84
86
|
workflow_id: int | None = None
|
|
85
87
|
workflow: WorkflowEntity | None = None
|
|
@@ -137,7 +139,7 @@ class TeamEntity(BaseModel):
|
|
|
137
139
|
pending_invitations: list[Any] | None = None
|
|
138
140
|
creator_id: str | None = None
|
|
139
141
|
owner_id: str | None = None
|
|
140
|
-
scores: list[str] | None = None
|
|
142
|
+
scores: list[dict[str, Any]] | None = None
|
|
141
143
|
|
|
142
144
|
|
|
143
145
|
class OrgTeamEntity(BaseModel):
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/work_managament.py
RENAMED
|
@@ -6,6 +6,7 @@ from typing import Any
|
|
|
6
6
|
|
|
7
7
|
from lib.core.entities.base import HexColor
|
|
8
8
|
from lib.core.entities.base import TimedBaseModel
|
|
9
|
+
from lib.core.enums import ProjectPriority
|
|
9
10
|
from lib.core.enums import WMClassTypeEnum
|
|
10
11
|
from lib.core.enums import WMGroupTypeEnum
|
|
11
12
|
from lib.core.enums import WMUserStateEnum
|
|
@@ -61,6 +62,8 @@ class WMProjectEntity(TimedBaseModel):
|
|
|
61
62
|
description: str | None = None
|
|
62
63
|
creator_id: str | None = None
|
|
63
64
|
status: ProjectStatus | None = None
|
|
65
|
+
# the backend sends the priority in lower case ("highest")
|
|
66
|
+
priority: ProjectPriority | None = None
|
|
64
67
|
workflow_id: int | None = None
|
|
65
68
|
sync_status: int | None = None
|
|
66
69
|
upload_state: str | None = None
|
|
@@ -193,6 +193,14 @@ class ProjectStatus(BaseTitledEnum):
|
|
|
193
193
|
OnHold = "OnHold", 4
|
|
194
194
|
|
|
195
195
|
|
|
196
|
+
class ProjectPriority(BaseTitledEnum):
|
|
197
|
+
Lowest = "Lowest", 1
|
|
198
|
+
Low = "Low", 2
|
|
199
|
+
Medium = "Medium", 3
|
|
200
|
+
High = "High", 4
|
|
201
|
+
Highest = "Highest", 5
|
|
202
|
+
|
|
203
|
+
|
|
196
204
|
class FolderStatus(BaseTitledEnum):
|
|
197
205
|
Undefined = "Undefined", -1
|
|
198
206
|
NotStarted = "NotStarted", 1
|
|
@@ -119,8 +119,26 @@ class Filter(Query):
|
|
|
119
119
|
|
|
120
120
|
def body_build(self) -> tuple[str, list[dict]]:
|
|
121
121
|
filter_value: list[dict] = []
|
|
122
|
+
# the backend can't compare with null, None is matched via $isnull/$notnull
|
|
123
|
+
has_none = isinstance(self._value, (list, set, tuple)) and None in self._value
|
|
122
124
|
if self._value is None and self._operator == OperatorEnum.EQ:
|
|
123
125
|
filter_value.append({self._key: {"$isnull": True}})
|
|
126
|
+
elif self._value is None and self._operator == OperatorEnum.NE:
|
|
127
|
+
filter_value.append({self._key: {"$notnull": True}})
|
|
128
|
+
elif has_none and self._operator == OperatorEnum.IN:
|
|
129
|
+
values = [i for i in self._value if i is not None]
|
|
130
|
+
is_null = {self._key: {"$isnull": True}}
|
|
131
|
+
if values:
|
|
132
|
+
filter_value.append(
|
|
133
|
+
{"$or": [{self._key: {self._operator.value: values}}, is_null]}
|
|
134
|
+
)
|
|
135
|
+
else:
|
|
136
|
+
filter_value.append(is_null)
|
|
137
|
+
elif has_none and self._operator == OperatorEnum.NOTIN:
|
|
138
|
+
values = [i for i in self._value if i is not None]
|
|
139
|
+
filter_value.append({self._key: {"$notnull": True}})
|
|
140
|
+
if values:
|
|
141
|
+
filter_value.append({self._key: {self._operator.value: values}})
|
|
124
142
|
elif self._operator == OperatorEnum.NOTIN or (
|
|
125
143
|
self._operator == OperatorEnum.NE and self._value is not None
|
|
126
144
|
):
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/serviceproviders.py
RENAMED
|
@@ -367,6 +367,16 @@ class BaseProjectService(SuperannotateServiceProvider):
|
|
|
367
367
|
def update(self, entity: entities.ProjectEntity) -> ProjectResponse:
|
|
368
368
|
raise NotImplementedError
|
|
369
369
|
|
|
370
|
+
@abstractmethod
|
|
371
|
+
def set_priority(self, project_id: int, priority: int | None) -> ServiceResponse:
|
|
372
|
+
raise NotImplementedError
|
|
373
|
+
|
|
374
|
+
@abstractmethod
|
|
375
|
+
def set_user_role(
|
|
376
|
+
self, project_id: int, user_id: str, role: int
|
|
377
|
+
) -> ServiceResponse:
|
|
378
|
+
raise NotImplementedError
|
|
379
|
+
|
|
370
380
|
@abstractmethod
|
|
371
381
|
def delete(self, entity: entities.ProjectEntity) -> ServiceResponse:
|
|
372
382
|
raise NotImplementedError
|
|
@@ -891,6 +901,10 @@ class BaseServiceProvider(metaclass=ABCMeta):
|
|
|
891
901
|
def get_role_id(self, project: entities.ProjectEntity, role_name: str) -> int:
|
|
892
902
|
raise NotImplementedError
|
|
893
903
|
|
|
904
|
+
@abstractmethod
|
|
905
|
+
def get_role_name_id_map(self, project: entities.ProjectEntity) -> dict[str, int]:
|
|
906
|
+
raise NotImplementedError
|
|
907
|
+
|
|
894
908
|
@abstractmethod
|
|
895
909
|
def get_category_id(
|
|
896
910
|
self, project: entities.ProjectEntity, category_name: str
|
|
@@ -1024,6 +1038,12 @@ class BaseServiceProvider(metaclass=ABCMeta):
|
|
|
1024
1038
|
) -> ServiceResponse:
|
|
1025
1039
|
raise NotImplementedError
|
|
1026
1040
|
|
|
1041
|
+
@abstractmethod
|
|
1042
|
+
def set_team_user_role(
|
|
1043
|
+
self, team_id: int, user_id: str, role: int
|
|
1044
|
+
) -> ServiceResponse:
|
|
1045
|
+
raise NotImplementedError
|
|
1046
|
+
|
|
1027
1047
|
@abstractmethod
|
|
1028
1048
|
def list_custom_field_names(
|
|
1029
1049
|
self,
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/controller.py
RENAMED
|
@@ -46,6 +46,7 @@ from lib.core.entities.work_managament import ScorePayloadEntity
|
|
|
46
46
|
from lib.core.entities.work_managament import TEAM_API_KEY_LIVE_STATUSES
|
|
47
47
|
from lib.core.entities.work_managament import TeamAPIKeyEntity
|
|
48
48
|
from lib.core.entities.work_managament import TeamAPIKeyStatus
|
|
49
|
+
from lib.core.entities.work_managament import WMUserTypeEnum
|
|
49
50
|
from lib.core.enums import CustomFieldEntityEnum
|
|
50
51
|
from lib.core.enums import CustomFieldType
|
|
51
52
|
from lib.core.enums import ProjectType
|
|
@@ -62,6 +63,7 @@ from lib.core.response import Response
|
|
|
62
63
|
from lib.infrastructure.custom_entities import generate_schema
|
|
63
64
|
from lib.infrastructure.helpers import timed_lru_cache
|
|
64
65
|
from lib.infrastructure.query_builder import FieldValidationHandler
|
|
66
|
+
from lib.infrastructure.query_builder import get_project_priority
|
|
65
67
|
from lib.infrastructure.query_builder import IncludeHandler
|
|
66
68
|
from lib.infrastructure.query_builder import ItemFilterHandler
|
|
67
69
|
from lib.infrastructure.query_builder import ProjectFilterHandler
|
|
@@ -641,6 +643,38 @@ class WorkManagementManager(BaseManager):
|
|
|
641
643
|
if response.errors:
|
|
642
644
|
raise AppException(response.errors)
|
|
643
645
|
|
|
646
|
+
def set_team_user_role(self, user: str, role: str):
|
|
647
|
+
roles = {
|
|
648
|
+
"Contributor": WMUserTypeEnum.Contributor,
|
|
649
|
+
"TeamAdmin": WMUserTypeEnum.TeamAdmin,
|
|
650
|
+
}
|
|
651
|
+
if role not in roles:
|
|
652
|
+
raise AppException(constants.INVALID_TEAM_USER_ROLE_ERROR)
|
|
653
|
+
users = self._resolve_team_user(user)
|
|
654
|
+
if not users:
|
|
655
|
+
raise AppException(constants.USER_NOT_FOUND_ERROR)
|
|
656
|
+
response = self.service_provider.set_team_user_role(
|
|
657
|
+
team_id=self.service_provider.client.team_id,
|
|
658
|
+
user_id=users[0].email,
|
|
659
|
+
role=roles[role].value,
|
|
660
|
+
)
|
|
661
|
+
response.raise_for_status()
|
|
662
|
+
# the backend answers 200 with {"success": false} when nothing was changed
|
|
663
|
+
if isinstance(response.data, dict) and response.data.get("success") is False:
|
|
664
|
+
raise AppException(f"Failed to set role: {role}, for user: {user}.")
|
|
665
|
+
|
|
666
|
+
def set_project_user_role(self, project: ProjectEntity, user: str, role: str):
|
|
667
|
+
role_id = self.service_provider.get_role_name_id_map(project).get(role)
|
|
668
|
+
if role_id is None:
|
|
669
|
+
raise AppException(constants.INVALID_PROJECT_USER_ROLE_ERROR)
|
|
670
|
+
users = self.list_users(project=project, email=user)
|
|
671
|
+
if not users:
|
|
672
|
+
raise AppException(constants.USER_NOT_FOUND_ERROR)
|
|
673
|
+
response = self.service_provider.projects.set_user_role(
|
|
674
|
+
project_id=project.id, user_id=users[0].email, role=role_id
|
|
675
|
+
)
|
|
676
|
+
response.raise_for_status()
|
|
677
|
+
|
|
644
678
|
def _resolve_team_user(self, user: int | str):
|
|
645
679
|
if isinstance(user, int):
|
|
646
680
|
return self.list_users(id__in=[user])
|
|
@@ -878,6 +912,14 @@ class ProjectManager(BaseManager):
|
|
|
878
912
|
)
|
|
879
913
|
return use_case.execute()
|
|
880
914
|
|
|
915
|
+
def set_priority(self, project: ProjectEntity, priority: str | None):
|
|
916
|
+
project_priority = get_project_priority(priority)
|
|
917
|
+
response = self.service_provider.projects.set_priority(
|
|
918
|
+
project_id=project.id,
|
|
919
|
+
priority=project_priority.value if project_priority is not None else None,
|
|
920
|
+
)
|
|
921
|
+
response.raise_for_status()
|
|
922
|
+
|
|
881
923
|
def set_settings(self, project: ProjectEntity, settings: list[SettingEntity]):
|
|
882
924
|
use_case = usecases.UpdateSettingsUseCase(
|
|
883
925
|
to_update=settings,
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/query_builder.py
RENAMED
|
@@ -5,6 +5,7 @@ from abc import abstractmethod
|
|
|
5
5
|
from collections.abc import Iterable
|
|
6
6
|
from typing import Any
|
|
7
7
|
|
|
8
|
+
from lib.core import INVALID_PROJECT_PRIORITY_ERROR
|
|
8
9
|
from lib.core.entities import BaseItemEntity
|
|
9
10
|
from lib.core.entities import ProjectEntity
|
|
10
11
|
from lib.core.entities.work_managament import TeamAPIKeyStatus
|
|
@@ -12,6 +13,7 @@ from lib.core.enums import ApprovalStatus
|
|
|
12
13
|
from lib.core.enums import CustomFieldEntityEnum
|
|
13
14
|
from lib.core.enums import CustomFieldType
|
|
14
15
|
from lib.core.enums import FolderStatus
|
|
16
|
+
from lib.core.enums import ProjectPriority
|
|
15
17
|
from lib.core.enums import ProjectStatus
|
|
16
18
|
from lib.core.enums import UserRole
|
|
17
19
|
from lib.core.enums import WMUserStateEnum
|
|
@@ -24,6 +26,17 @@ from lib.core.jsx_conditions import Query
|
|
|
24
26
|
from lib.core.serviceproviders import BaseServiceProvider
|
|
25
27
|
|
|
26
28
|
|
|
29
|
+
def get_project_priority(value: str | None) -> ProjectPriority | None:
|
|
30
|
+
"""Map a priority title ("Highest") to its enum, None stays None."""
|
|
31
|
+
if value is None:
|
|
32
|
+
return None
|
|
33
|
+
if isinstance(value, str):
|
|
34
|
+
for priority in ProjectPriority:
|
|
35
|
+
if priority.name == value:
|
|
36
|
+
return priority
|
|
37
|
+
raise AppException(INVALID_PROJECT_PRIORITY_ERROR)
|
|
38
|
+
|
|
39
|
+
|
|
27
40
|
def determine_condition_and_key(keys: list[str]) -> tuple[OperatorEnum, str]:
|
|
28
41
|
"""
|
|
29
42
|
Determine the condition and key from the filters.
|
|
@@ -322,8 +335,19 @@ class ProjectFilterHandler(BaseCustomFieldHandler):
|
|
|
322
335
|
if isinstance(val, (list, tuple, set))
|
|
323
336
|
else ProjectStatus(val).value
|
|
324
337
|
)
|
|
338
|
+
elif keys[0] == "priority":
|
|
339
|
+
val = (
|
|
340
|
+
[self._priority_value(i) for i in val]
|
|
341
|
+
if isinstance(val, (list, tuple, set))
|
|
342
|
+
else self._priority_value(val)
|
|
343
|
+
)
|
|
325
344
|
return super()._handle_special_fields(keys, val)
|
|
326
345
|
|
|
346
|
+
@staticmethod
|
|
347
|
+
def _priority_value(value) -> int | None:
|
|
348
|
+
priority = get_project_priority(value)
|
|
349
|
+
return priority.value if priority is not None else None
|
|
350
|
+
|
|
327
351
|
|
|
328
352
|
class FolderFilterHandler(AbstractQueryHandler):
|
|
329
353
|
def _handle_special_fields(self, keys: list[str], val):
|
|
@@ -40,6 +40,7 @@ class ServiceProvider(BaseServiceProvider):
|
|
|
40
40
|
URL_GET_EXPORT = "export/{}"
|
|
41
41
|
URL_FOLDERS_IMAGES = "images-folders"
|
|
42
42
|
URL_INVITE_CONTRIBUTORS = "api/v1/team/{}/inviteUsers"
|
|
43
|
+
URL_TEAM_MEMBER = "api/v1/team/{}/member"
|
|
43
44
|
URL_ANNOTATION_UPLOAD_PATH_TOKEN = "images/getAnnotationsPathsAndTokens"
|
|
44
45
|
URL_CREATE_WORKFLOW = "api/v1/workflows/submit"
|
|
45
46
|
URL_REMOVE_USERS_FROM_TEAM = "team/{team_id}/members/bulk"
|
|
@@ -142,6 +143,9 @@ class ServiceProvider(BaseServiceProvider):
|
|
|
142
143
|
def get_role_id(self, project: entities.ProjectEntity, role_name: str) -> int:
|
|
143
144
|
return self._cached_work_management_repository.get_role_id(project, role_name)
|
|
144
145
|
|
|
146
|
+
def get_role_name_id_map(self, project: entities.ProjectEntity) -> dict[str, int]:
|
|
147
|
+
return self._cached_work_management_repository.get_role_name_id_map(project)
|
|
148
|
+
|
|
145
149
|
def get_role_name(self, project: entities.ProjectEntity, role_id: int) -> str:
|
|
146
150
|
return self._cached_work_management_repository.get_role_name(project, role_id)
|
|
147
151
|
|
|
@@ -370,6 +374,19 @@ class ServiceProvider(BaseServiceProvider):
|
|
|
370
374
|
data={"emails": emails, "team_role": team_role},
|
|
371
375
|
)
|
|
372
376
|
|
|
377
|
+
def set_team_user_role(self, team_id: int, user_id: str, role: int):
|
|
378
|
+
# the role-specific permissions are reset to the role defaults
|
|
379
|
+
return self.client.request(
|
|
380
|
+
self.URL_TEAM_MEMBER.format(team_id),
|
|
381
|
+
"put",
|
|
382
|
+
data={
|
|
383
|
+
"user_id": user_id,
|
|
384
|
+
"user_role": role,
|
|
385
|
+
"allow_run_explore": 0,
|
|
386
|
+
"allow_orchestrate": 0,
|
|
387
|
+
},
|
|
388
|
+
)
|
|
389
|
+
|
|
373
390
|
def create_custom_workflow(self, org_id: str, data: dict):
|
|
374
391
|
return self.client.request(
|
|
375
392
|
url=self.URL_CREATE_WORKFLOW,
|
|
@@ -18,6 +18,7 @@ class ProjectService(BaseProjectService):
|
|
|
18
18
|
URL_SET_KEYPOINT_STEPS = "api/v1/project/{}/uploadSteps"
|
|
19
19
|
URL_SHARE = "api/v1/project/{}/share/bulk"
|
|
20
20
|
URL_SHARE_PROJECT = "project/{}/share"
|
|
21
|
+
URL_SHARE_PROJECT_V1 = "api/v1/project/{}/share"
|
|
21
22
|
URL_STEP_ATTRIBUTE = "project/{}/workflow_attribute"
|
|
22
23
|
URL_UPLOAD_PRIORITY_SCORES = "images/updateEntropy"
|
|
23
24
|
URL_ASSIGN_ITEMS = "images/editAssignment/"
|
|
@@ -68,13 +69,24 @@ class ProjectService(BaseProjectService):
|
|
|
68
69
|
)
|
|
69
70
|
|
|
70
71
|
def update(self, entity: entities.ProjectEntity):
|
|
72
|
+
# priority is only written by set_priority, a stale value must not be sent back
|
|
71
73
|
return self.client.request(
|
|
72
74
|
self.URL_GET.format(entity.id),
|
|
73
75
|
"put",
|
|
74
|
-
data=entity
|
|
76
|
+
data=entity.model_dump(
|
|
77
|
+
exclude={"priority"}, exclude_none=True, mode="json"
|
|
78
|
+
),
|
|
75
79
|
content_type=ProjectResponse,
|
|
76
80
|
)
|
|
77
81
|
|
|
82
|
+
def set_priority(self, project_id: int, priority: int | None) -> ServiceResponse:
|
|
83
|
+
# sent on its own: update() drops None fields, so it can't clear the priority
|
|
84
|
+
return self.client.request(
|
|
85
|
+
self.URL_GET.format(project_id),
|
|
86
|
+
"put",
|
|
87
|
+
data={"priority": priority},
|
|
88
|
+
)
|
|
89
|
+
|
|
78
90
|
def delete(self, entity: entities.ProjectEntity) -> ServiceResponse:
|
|
79
91
|
return self.client.request(self.URL_GET.format(entity.id), "delete")
|
|
80
92
|
|
|
@@ -145,6 +157,13 @@ class ProjectService(BaseProjectService):
|
|
|
145
157
|
data={"data": attributes},
|
|
146
158
|
)
|
|
147
159
|
|
|
160
|
+
def set_user_role(self, project_id: int, user_id: str, role: int):
|
|
161
|
+
return self.client.request(
|
|
162
|
+
self.URL_SHARE_PROJECT_V1.format(project_id),
|
|
163
|
+
"put",
|
|
164
|
+
data={"user_id": user_id, "new_user_role": role},
|
|
165
|
+
)
|
|
166
|
+
|
|
148
167
|
def un_share(self, project: entities.ProjectEntity, user_id: int):
|
|
149
168
|
return self.client.request(
|
|
150
169
|
self.URL_SHARE_PROJECT.format(project.id),
|
|
@@ -433,6 +433,10 @@ class CachedWorkManagementRepository:
|
|
|
433
433
|
return role_data["role_name_id_map"][role_name]
|
|
434
434
|
raise AppException("Invalid assignments role provided.")
|
|
435
435
|
|
|
436
|
+
def get_role_name_id_map(self, project) -> dict[str, int]:
|
|
437
|
+
role_data = self._role_cache.get(project.id, project=project)
|
|
438
|
+
return dict(role_data["role_name_id_map"])
|
|
439
|
+
|
|
436
440
|
def get_role_name(self, project, role_id: int) -> str:
|
|
437
441
|
role_data = self._role_cache.get(project.id, project=project)
|
|
438
442
|
if role_id in role_data["role_id_name_map"]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/analytics/__init__.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/analytics/aggregators.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/bin/superannotate.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/input_converters/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/__init__.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/base_interface.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/cli_interface.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/responses.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/sdk/__init__.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/app/interface/sdk/explore.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/classes.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/context.py
RENAMED
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/integrations.py
RENAMED
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/entities/multimodal_form.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/__init__.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/annotations.py
RENAMED
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/classes.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/custom_fields.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/folders.py
RENAMED
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/integrations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/projects.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/core/usecases/work_management.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/helpers.py
RENAMED
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/repositories.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/auth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/services/item.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate/lib/infrastructure/validators.py
RENAMED
|
File without changes
|
|
File without changes
|
{superannotate-4.6.2 → superannotate-4.6.3b1}/src/superannotate.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|