From 8a4e087c8601e2a74684b18306af1a5a8e3e5b3a Mon Sep 17 00:00:00 2001 From: Brent Gracey Date: Mon, 25 Apr 2022 15:25:04 +0100 Subject: [PATCH] Platform now allows same class name with different main type; hence; revert. --- darwin/importer/importer.py | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/darwin/importer/importer.py b/darwin/importer/importer.py index 333d53a6a..3f05455c1 100644 --- a/darwin/importer/importer.py +++ b/darwin/importer/importer.py @@ -126,7 +126,6 @@ def _resolve_annotation_classes( ) -> Tuple[Set[dt.AnnotationClass], Set[dt.AnnotationClass]]: local_classes_not_in_dataset: Set[dt.AnnotationClass] = set() local_classes_not_in_team: Set[dt.AnnotationClass] = set() - clashing_name_warnings: Set[str] = set() for local_cls in local_annotation_classes: local_annotation_type = local_cls.annotation_internal_type or local_cls.annotation_type @@ -140,36 +139,12 @@ def _resolve_annotation_classes( if local_cls.name in [missing_class.name for missing_class in local_classes_not_in_team]: continue - for existing_type, existing_names in classes_in_dataset.items(): - if local_cls.name in existing_names and local_annotation_type != existing_type: - clashing_name_warnings.add( - _class_name_clash_error(local_cls.name, local_annotation_type, existing_type) - ) - - for existing_type, existing_names in classes_in_team.items(): - if local_cls.name in existing_names and local_annotation_type != existing_type: - clashing_name_warnings.add( - _class_name_clash_error(local_cls.name, local_annotation_type, existing_type) - ) - if local_annotation_type in classes_in_team and local_cls.name in classes_in_team[local_annotation_type]: local_classes_not_in_dataset.add(local_cls) else: local_classes_not_in_team.add(local_cls) - return local_classes_not_in_dataset, local_classes_not_in_team, clashing_name_warnings - - -def _class_name_clash_error( - local_cls_name: str, - local_annotation_type: str, - existing_type: str, -) -> str: - return ( - f"`{local_cls_name}` class of type `{local_annotation_type}` from imported annotations" - f" clashes with an existing class of the same name; but of type `{existing_type}`" - ) - + return local_classes_not_in_dataset, local_classes_not_in_team def import_annotations( dataset: "RemoteDataset", @@ -248,18 +223,12 @@ def import_annotations( if class_prompt and not secure_continue_request(): return - local_classes_not_in_dataset, local_classes_not_in_team, clashing_name_warnings = _resolve_annotation_classes( + local_classes_not_in_dataset, local_classes_not_in_team = _resolve_annotation_classes( [annotation_class for file in local_files for annotation_class in file.annotation_classes], classes_in_dataset, classes_in_team, ) - if len(clashing_name_warnings) > 0: - for clashing_name in clashing_name_warnings: - print(clashing_name) - print(f"Class names must be unique; even across types (see above error); can not proceed with import.") - # return - print(f"{len(local_classes_not_in_team)} classes needs to be created.") print(f"{len(local_classes_not_in_dataset)} classes needs to be added to {dataset.identifier}")