diff --git a/ote_sdk/ote_sdk/entities/annotation.py b/ote_sdk/ote_sdk/entities/annotation.py index 5b0027a2ef8..5e929d8dc97 100644 --- a/ote_sdk/ote_sdk/entities/annotation.py +++ b/ote_sdk/ote_sdk/entities/annotation.py @@ -26,7 +26,7 @@ class Annotation(metaclass=abc.ABCMeta): def __init__( self, shape: ShapeEntity, labels: List[ScoredLabel], id: Optional[ID] = None ): - self.__id = ID(ObjectId()) if id is None else id + self.__id_ = ID(ObjectId()) if id is None else id self.__shape = shape self.__labels = labels @@ -35,19 +35,29 @@ def __repr__(self): f"{self.__class__.__name__}(" f"shape={self.shape}, " f"labels={self.get_labels(True)}, " - f"id={self.id})" + f"id={self.id_})" ) @property - def id(self): + def id_(self): """ Returns the id for the annotation """ - return self.__id + return self.__id_ + + @id_.setter + def id_(self, value): + self.__id_ = value + + @property + def id(self): + """DEPRECATED""" + return self.__id_ @id.setter def id(self, value): - self.__id = value + """DEPRECATED""" + self.__id_ = value @property def shape(self): @@ -79,7 +89,9 @@ def get_label_ids(self, include_empty: bool = False) -> Set[ID]: :return: Set of label id's in annotation """ return { - label.id for label in self.__labels if include_empty or (not label.is_empty) + label.id_ + for label in self.__labels + if include_empty or (not label.is_empty) } def append_label(self, label: ScoredLabel): @@ -101,7 +113,7 @@ def set_labels(self, labels: List[ScoredLabel]): def __eq__(self, other): if isinstance(other, Annotation): return ( - self.id == other.id + self.id_ == other.id_ and self.get_labels(True) == other.get_labels(True) and self.shape == other.shape ) @@ -163,7 +175,7 @@ def __init__( self.__kind = kind self.__editor = editor self.__creation_date = now() if creation_date is None else creation_date - self.__id = ID() if id is None else id + self.__id_ = ID() if id is None else id def __repr__(self): return ( @@ -172,19 +184,29 @@ def __repr__(self): f"kind={self.kind}, " f"editor={self.editor_name}, " f"creation_date={self.creation_date}, " - f"id={self.id})" + f"id={self.id_})" ) @property - def id(self): + def id_(self): """ Returns the ID of the AnnotationSceneEntity. """ - return self.__id + return self.__id_ + + @id_.setter + def id_(self, value): + self.__id_ = value + + @property + def id(self): + """DEPRECATED""" + return self.__id_ @id.setter def id(self, value): - self.__id = value + """DEPRECATED""" + self.__id_ = value @property def kind(self): @@ -279,7 +301,7 @@ def get_labels(self, include_empty: bool = False) -> List[LabelEntity]: labels: Dict[str, LabelEntity] = {} for annotation in self.annotations: for label in annotation.get_labels(include_empty): - id_ = label.id + id_ = label.id_ if id_ not in labels: labels[id_] = label.get_label() return list(labels.values()) diff --git a/ote_sdk/ote_sdk/entities/datasets.py b/ote_sdk/ote_sdk/entities/datasets.py index 3fa6914f209..59953cb25ed 100644 --- a/ote_sdk/ote_sdk/entities/datasets.py +++ b/ote_sdk/ote_sdk/entities/datasets.py @@ -277,7 +277,7 @@ def with_empty_annotations( # reset ROI roi = copy.copy(dataset_item.roi) - roi.id = ID(ObjectId()) + roi.id_ = ID(ObjectId()) roi.set_labels([]) new_dataset_item = DatasetItemEntity( diff --git a/ote_sdk/ote_sdk/entities/label.py b/ote_sdk/ote_sdk/entities/label.py index 287737f7302..4ad558d13f7 100644 --- a/ote_sdk/ote_sdk/entities/label.py +++ b/ote_sdk/ote_sdk/entities/label.py @@ -102,7 +102,7 @@ def __init__( self._domain = domain self._is_empty = is_empty self._creation_date = creation_date - self._id = id + self.__id_ = id self.is_anomalous = is_anomalous @property @@ -164,26 +164,36 @@ def creation_date(self) -> datetime.datetime: return self._creation_date @property - def id(self) -> ID: + def id_(self) -> ID: """ Returns the label id. """ - return self._id + return self.__id_ + + @id_.setter + def id_(self, value: ID): + self.__id_ = value + + @property + def id(self) -> ID: + """DEPRECATED""" + return self.__id_ @id.setter def id(self, value: ID): - self._id = value + """DEPRECATED""" + self.__id_ = value def __repr__(self): return ( - f"LabelEntity({self.id}, name={self.name}, hotkey={self.hotkey}, " + f"LabelEntity({self.id_}, name={self.name}, hotkey={self.hotkey}, " f"domain={self.domain}, color={self.color})" ) def __eq__(self, other): if isinstance(other, LabelEntity): return ( - self.id == other.id + self.id_ == other.id_ and self.name == other.name and self.color == other.color and self.hotkey == other.hotkey @@ -194,12 +204,12 @@ def __eq__(self, other): def __lt__(self, other): if isinstance(other, LabelEntity): - return self.id < other.id + return self.id_ < other.id_ return False def __gt__(self, other): if isinstance(other, LabelEntity): - return self.id > other.id + return self.id_ > other.id_ return False def __hash__(self): diff --git a/ote_sdk/ote_sdk/entities/label_schema.py b/ote_sdk/ote_sdk/entities/label_schema.py index 68ee3550451..061ebdec55c 100644 --- a/ote_sdk/ote_sdk/entities/label_schema.py +++ b/ote_sdk/ote_sdk/entities/label_schema.py @@ -53,19 +53,29 @@ def __init__( group_type: LabelGroupType = LabelGroupType.EXCLUSIVE, id: ID = None, ): - self.id = ID(ObjectId()) if id is None else id + self.id_ = ID(ObjectId()) if id is None else id - self.labels = sorted(labels, key=lambda x: x.id) + self.labels = sorted(labels, key=lambda x: x.id_) self.name = name self.group_type = group_type + @property + def id(self) -> ID: + """DEPRECATED""" + return self.id_ + + @id.setter + def id(self, value: ID): + """DEPRECATED""" + self.id_ = value + @property def minimum_label_id(self) -> ID: """ Returns the minimum (oldest) label ID, which is the first label in self.labels since this list is sorted """ - return self.labels[0].id + return self.labels[0].id_ def remove_label(self, label: LabelEntity) -> None: """ @@ -87,14 +97,14 @@ def is_single_label(self) -> bool: def __eq__(self, other: object): if not isinstance(other, LabelGroup): return False - return self.id == other.id and ( + return self.id_ == other.id_ and ( set(self.labels) == set(other.labels) and self.group_type == other.group_type ) def __repr__(self) -> str: return ( - f"LabelGroup(id={self.id}, name={self.name}, group_type={self.group_type}," + f"LabelGroup(id={self.id_}, name={self.name}, group_type={self.group_type}," f" labels={self.labels})" ) @@ -316,7 +326,7 @@ def get_labels(self, include_empty) -> List[LabelEntity]: for label in group.labels if include_empty or not label.is_empty } - return sorted(list(labels), key=lambda x: x.id) + return sorted(list(labels), key=lambda x: x.id_) def get_groups(self, include_empty: bool = False) -> List[LabelGroup]: """ @@ -371,7 +381,7 @@ def get_label_ids(self, include_empty) -> List[ID]: :param include_empty: Include empty label id or not """ label_ids = { - label.id + label.id_ for group in self._groups for label in group.labels if include_empty or not label.is_empty diff --git a/ote_sdk/ote_sdk/entities/model.py b/ote_sdk/ote_sdk/entities/model.py index ebd0f1a78d5..34da6a5b7df 100644 --- a/ote_sdk/ote_sdk/entities/model.py +++ b/ote_sdk/ote_sdk/entities/model.py @@ -135,7 +135,7 @@ def __init__( if model_adapters is None: model_adapters = {} - self.__id = _id + self.__id_ = _id self.__creation_date = creation_date self.__train_dataset = train_dataset self.__previous_trained_revision = previous_trained_revision @@ -161,13 +161,23 @@ def __init__( self.__model_size_reduction = model_size_reduction @property - def id(self) -> ID: + def id_(self) -> ID: """Gets or sets the id of a Model""" - return self.__id + return self.__id_ + + @id_.setter + def id_(self, value: ID): + self.__id_ = value + + @property + def id(self) -> ID: + """DEPRECATED""" + return self.__id_ @id.setter def id(self, value: ID): - self.__id = value + """DEPRECATED""" + self.__id_ = value @property def configuration(self) -> ModelConfiguration: @@ -458,7 +468,7 @@ def is_optimized(self) -> bool: def __eq__(self, other): if isinstance(other, ModelEntity): return ( - self.id == other.id + self.id_ == other.id_ and self.train_dataset == other.train_dataset and self.performance == other.performance ) diff --git a/ote_sdk/ote_sdk/entities/resultset.py b/ote_sdk/ote_sdk/entities/resultset.py index e7bdf4212fd..fd9d016aacf 100644 --- a/ote_sdk/ote_sdk/entities/resultset.py +++ b/ote_sdk/ote_sdk/entities/resultset.py @@ -80,7 +80,7 @@ def __init__( id = ID() if id is None else id performance = NullPerformance() if performance is None else performance creation_date = now() if creation_date is None else creation_date - self.__id = id + self.__id_ = id self.__model = model self.__prediction_dataset = prediction_dataset self.__ground_truth_dataset = ground_truth_dataset @@ -89,13 +89,23 @@ def __init__( self.__creation_date = creation_date @property - def id(self) -> ID: + def id_(self) -> ID: """Returns the id of the ResultSet""" - return self.__id + return self.__id_ + + @id_.setter + def id_(self, value: ID) -> None: + self.__id_ = value + + @property + def id(self) -> ID: + """DEPRECATED""" + return self.__id_ @id.setter - def id(self, value: ID) -> None: - self.__id = value + def id(self, value: ID): + """DEPRECATED""" + self.__id_ = value @property def model(self) -> ModelEntity: @@ -170,5 +180,5 @@ def __repr__(self): f"purpose={self.purpose}, " f"performance={self.performance}, " f"creation_date={self.creation_date}, " - f"id={self.id})" + f"id={self.id_})" ) diff --git a/ote_sdk/ote_sdk/entities/scored_label.py b/ote_sdk/ote_sdk/entities/scored_label.py index d2b5419551b..1b01465000b 100644 --- a/ote_sdk/ote_sdk/entities/scored_label.py +++ b/ote_sdk/ote_sdk/entities/scored_label.py @@ -31,10 +31,15 @@ def name(self) -> str: return self.label.name @property - def id(self) -> ID: + def id_(self) -> ID: """ Returns the label id. """ + return self.label.id_ + + @property + def id(self) -> ID: + """DEPRECATED""" return self.label.id @property @@ -80,14 +85,14 @@ def get_label(self) -> LabelEntity: def __repr__(self): return ( - f"ScoredLabel({self.id}, name={self.name}, probability={self.probability}, " + f"ScoredLabel({self.id_}, name={self.name}, probability={self.probability}, " f"domain={self.domain}, color={self.color}, hotkey={self.hotkey})" ) def __eq__(self, other): if isinstance(other, ScoredLabel): return ( - self.id == other.id + self.id_ == other.id_ and self.name == other.name and self.color == other.color and self.hotkey == other.hotkey diff --git a/ote_sdk/ote_sdk/serialization/label_mapper.py b/ote_sdk/ote_sdk/serialization/label_mapper.py index 8b713adc327..2a3621227c1 100644 --- a/ote_sdk/ote_sdk/serialization/label_mapper.py +++ b/ote_sdk/ote_sdk/serialization/label_mapper.py @@ -60,7 +60,7 @@ def forward( """Serializes to dict.""" return { - "_id": IDMapper().forward(instance.id), + "_id": IDMapper().forward(instance.id_), "name": instance.name, "color": ColorMapper().forward(instance.color), "hotkey": instance.hotkey, @@ -100,9 +100,9 @@ def forward(instance: LabelGroup) -> dict: """Serializes to dict.""" return { - "_id": IDMapper().forward(instance.id), + "_id": IDMapper().forward(instance.id_), "name": instance.name, - "label_ids": [IDMapper().forward(label.id) for label in instance.labels], + "label_ids": [IDMapper().forward(label.id_) for label in instance.labels], "relation_type": instance.group_type.name, } @@ -133,9 +133,9 @@ def forward(instance: Union[LabelGraph, LabelTree]) -> dict: return { "type": instance.type, "directed": instance.directed, - "nodes": [IDMapper().forward(label.id) for label in instance.nodes], + "nodes": [IDMapper().forward(label.id_) for label in instance.nodes], "edges": [ - (IDMapper().forward(edge[0].id), IDMapper().forward(edge[1].id)) + (IDMapper().forward(edge[0].id_), IDMapper().forward(edge[1].id_)) for edge in instance.edges ], } @@ -188,7 +188,7 @@ def forward( "label_tree": LabelGraphMapper().forward(instance.label_tree), "label_groups": label_groups, "all_labels": { - IDMapper().forward(label.id): LabelMapper().forward(label) + IDMapper().forward(label.id_): LabelMapper().forward(label) for label in instance.get_labels(True) }, } diff --git a/ote_sdk/ote_sdk/tests/entities/test_annotation.py b/ote_sdk/ote_sdk/tests/entities/test_annotation.py index 38c0eae60c2..4d2177a23f8 100644 --- a/ote_sdk/ote_sdk/tests/entities/test_annotation.py +++ b/ote_sdk/ote_sdk/tests/entities/test_annotation.py @@ -81,8 +81,8 @@ def test_annotation_default_property(self): annotation = self.annotation - assert type(annotation.id) == ID - assert annotation.id is not None + assert type(annotation.id_) == ID + assert annotation.id_ is not None assert str(annotation.shape) == "Rectangle(x=0.5, y=0.0, width=0.5, height=0.5)" assert annotation.get_labels() == [] @@ -109,9 +109,9 @@ def test_annotation_setters(self): annotation = self.annotation ellipse = Ellipse(x1=0.5, y1=0.1, x2=0.8, y2=0.3) annotation.shape = ellipse - annotation.id = ID(123456789) + annotation.id_ = ID(123456789) - assert annotation.id == ID(123456789) + assert annotation.id_ == ID(123456789) assert annotation.shape == ellipse @pytest.mark.priority_medium @@ -353,7 +353,7 @@ def test_annotation_scene_entity_default_value(self): annotation_scene_entity = self.annotation_scene_entity - assert annotation_scene_entity.id == ID() + assert annotation_scene_entity.id_ == ID() assert annotation_scene_entity.kind == AnnotationSceneKind.ANNOTATION assert annotation_scene_entity.editor_name == "" assert type(annotation_scene_entity.creation_date) == datetime.datetime @@ -384,13 +384,13 @@ def test_annotation_scene_entity_setters(self): annotation_scene_entity = self.annotation_scene_entity creation_date = self.creation_date - annotation_scene_entity.id = ID(123456789) + annotation_scene_entity.id_ = ID(123456789) annotation_scene_entity.kind = AnnotationSceneKind.PREDICTION annotation_scene_entity.editor_name = "editor" annotation_scene_entity.creation_date = creation_date annotation_scene_entity.annotations = self.annotation - assert annotation_scene_entity.id == ID(123456789) + assert annotation_scene_entity.id_ == ID(123456789) assert annotation_scene_entity.kind == AnnotationSceneKind.PREDICTION assert annotation_scene_entity.editor_name == "editor" assert annotation_scene_entity.creation_date == creation_date @@ -423,7 +423,7 @@ def test_annotation_scene_entity_magic_methods(self): f"kind={annotation_scene_entity.kind}, " f"editor={annotation_scene_entity.editor_name}, " f"creation_date={annotation_scene_entity.creation_date}, " - f"id={annotation_scene_entity.id})" + f"id={annotation_scene_entity.id_})" ] for i in annotation_scene_entity_repr: @@ -604,7 +604,7 @@ def test_null_annotation_scene_entity(self): null_annotation = NullAnnotationSceneEntity() - assert null_annotation.id == ID() + assert null_annotation.id_ == ID() assert null_annotation.kind == AnnotationSceneKind.NONE assert null_annotation.editor_name == "" assert type(null_annotation.creation_date) == datetime.datetime diff --git a/ote_sdk/ote_sdk/tests/entities/test_dataset_item.py b/ote_sdk/ote_sdk/tests/entities/test_dataset_item.py index 7bece021844..0d32564e5b9 100644 --- a/ote_sdk/ote_sdk/tests/entities/test_dataset_item.py +++ b/ote_sdk/ote_sdk/tests/entities/test_dataset_item.py @@ -160,7 +160,7 @@ def compare_denormalized_annotations( expected_annotation = expected_annotations[index] # Redefining id and modification_date required because of new Annotation objects created after shape # denormalize - actual_annotation.id = expected_annotation.id + actual_annotation.id_ = expected_annotation.id_ actual_annotation.shape.modification_date = ( expected_annotation.shape.modification_date ) @@ -611,8 +611,8 @@ def test_dataset_item_append_annotations(self): ) dataset_item.append_annotations(annotations_to_add) # Random id is generated for normalized annotations - normalized_annotations[0].id = dataset_item.annotation_scene.annotations[2].id - normalized_annotations[1].id = dataset_item.annotation_scene.annotations[3].id + normalized_annotations[0].id_ = dataset_item.annotation_scene.annotations[2].id_ + normalized_annotations[1].id_ = dataset_item.annotation_scene.annotations[3].id_ assert ( dataset_item.annotation_scene.annotations == full_box_annotations + normalized_annotations @@ -884,7 +884,7 @@ def test_dataset_item_deepcopy(self): dataset_item.annotation_scene.editor_name == copy_dataset.annotation_scene.editor_name ) - assert dataset_item.annotation_scene.id == copy_dataset.annotation_scene.id + assert dataset_item.annotation_scene.id_ == copy_dataset.annotation_scene.id_ assert dataset_item.annotation_scene.kind == copy_dataset.annotation_scene.kind assert ( dataset_item.annotation_scene.shapes == copy_dataset.annotation_scene.shapes diff --git a/ote_sdk/ote_sdk/tests/entities/test_datasets.py b/ote_sdk/ote_sdk/tests/entities/test_datasets.py index e4cead21060..c5c0522c2de 100644 --- a/ote_sdk/ote_sdk/tests/entities/test_datasets.py +++ b/ote_sdk/ote_sdk/tests/entities/test_datasets.py @@ -454,7 +454,7 @@ def check_empty_annotations_dataset( assert actual_item.media is expected_item.media assert actual_item.annotation_scene.annotations == [] assert actual_item.annotation_scene.kind == expected_kind - assert actual_item.roi.id != expected_item.roi.id + assert actual_item.roi.id_ != expected_item.roi.id_ assert actual_item.roi.shape is expected_item.roi.shape assert actual_item.roi.get_labels() == [] assert actual_item.subset is expected_item.subset diff --git a/ote_sdk/ote_sdk/tests/entities/test_label.py b/ote_sdk/ote_sdk/tests/entities/test_label.py index fd0d9840303..886c8e6b9b2 100644 --- a/ote_sdk/ote_sdk/tests/entities/test_label.py +++ b/ote_sdk/ote_sdk/tests/entities/test_label.py @@ -118,10 +118,10 @@ def test_label_entity(self): assert self.car.domain == label_car_new_domain assert self.car.color == label_car_new_color assert self.car.hotkey == label_car_new_hotkey - assert self.car.id == label_car_new_id + assert self.car.id_ == label_car_new_id test_label_entity_repr = [ - f"{self.car.id}", + f"{self.car.id_}", f"name={self.car.name}", f"hotkey={self.car.hotkey}", f"domain={self.car.domain}", @@ -155,7 +155,7 @@ def test_empty_label_entity(self): """ assert self.empty.hotkey == "" - assert self.empty.id == ID() + assert self.empty.id_ == ID() assert type(self.empty.color) == Color @pytest.mark.priority_medium @@ -177,6 +177,6 @@ def test_label_comparison(self): 2. Check the processing of changed id """ - self.empty.id = ID(999999999) + self.empty.id_ = ID(999999999) assert self.empty > self.car assert self.car < self.empty diff --git a/ote_sdk/ote_sdk/tests/entities/test_label_schema.py b/ote_sdk/ote_sdk/tests/entities/test_label_schema.py index bcb991ddfb9..1a1f4a1fc0a 100644 --- a/ote_sdk/ote_sdk/tests/entities/test_label_schema.py +++ b/ote_sdk/ote_sdk/tests/entities/test_label_schema.py @@ -452,7 +452,8 @@ def test_label_group_initialization(self): Test passes if LabelGroup object id, labels, name and group_type attributes return expected values Steps - 1. Check id, labels, name and group_type attributes of LabelGroup object with not specified group_type parameter + 1. Check id, labels, name and group_type attributes of LabelGroup object with not specified group_type + parameter 2. Check id, labels, name and group_type attributes of LabelGroup object with not specified id parameter """ # Checking attributes of LabelGroup object with specified id and not specified group_type parameters @@ -461,7 +462,7 @@ def test_label_group_initialization(self): labels=[labels.label_0_1, labels.no_id_label, labels.label_0], id=ID("1"), ) - assert no_group_type_label_group.id == "1" + assert no_group_type_label_group.id_ == "1" # Expected ascending sorting of labels assert no_group_type_label_group.labels == [ labels.no_id_label, @@ -481,8 +482,8 @@ def test_label_group_initialization(self): group_type=LabelGroupType.EMPTY_LABEL, ) # Expected randomly generated ID object with 24 characters as "id" attribute - assert isinstance(no_id_label_group.id, ID) - assert len(no_id_label_group.id) == 24 + assert isinstance(no_id_label_group.id_, ID) + assert len(no_id_label_group.id_) == 24 # Expected ascending sorting of labels assert no_id_label_group.labels == [labels.label_0, labels.label_0_1] assert no_id_label_group.name == "ID non-specified Label Group" @@ -577,7 +578,7 @@ def test_label_group_magic_methods(self): labels=[], group_type=LabelGroupType.EMPTY_LABEL, ) - generated_id = no_labels_no_id_label_group.id + generated_id = no_labels_no_id_label_group.id_ assert repr(no_labels_no_id_label_group) == ( f"LabelGroup(id={generated_id}, name=Null labels, random id group," f" group_type=LabelGroupType.EMPTY_LABEL, labels=[])" @@ -1295,7 +1296,7 @@ def previous_vertexes(vert_id): returned_vertexes = set() for label in labels_topological_order: - previous, curent = previous_vertexes(label.id) + previous, curent = previous_vertexes(label.id_) for vertex in previous: assert vertex in returned_vertexes returned_vertexes.add(curent) @@ -1309,7 +1310,7 @@ def previous_vertexes(vert_id): labels_topological_order = label_tree.get_labels_in_topological_order() returned_vertexes = set() for label in labels_topological_order: - previous, curent = previous_vertexes(label.id) + previous, curent = previous_vertexes(label.id_) for vertex in previous: if ( curent != "3" @@ -1852,7 +1853,9 @@ def test_label_schema_get_exclusive_groups(self): id=ID("new_ex_1"), ) new_labels_group = LabelGroup( - name="New exclusive labels group", labels=[new_label], id=ID("new_ex_group") + name="New exclusive labels group", + labels=[new_label], + id=ID("new_ex_group"), ) label_schema_entity.add_group(new_labels_group) exclusive_groups.append(new_labels_group) diff --git a/ote_sdk/ote_sdk/tests/entities/test_model.py b/ote_sdk/ote_sdk/tests/entities/test_model.py index e2e00c6d5ff..818c8db5ee5 100644 --- a/ote_sdk/ote_sdk/tests/entities/test_model.py +++ b/ote_sdk/ote_sdk/tests/entities/test_model.py @@ -204,7 +204,7 @@ def test_model_entity_default_values(self): train_dataset=self.dataset(), configuration=self.configuration() ) - assert model_entity.id == ID() + assert model_entity.id_ == ID() assert type(model_entity.configuration) == ModelConfiguration assert type(model_entity.creation_date) == datetime assert type(model_entity.train_dataset) == DatasetEntity diff --git a/ote_sdk/ote_sdk/tests/entities/test_resultset.py b/ote_sdk/ote_sdk/tests/entities/test_resultset.py index 80c0d345d21..d1c7cabfcc3 100644 --- a/ote_sdk/ote_sdk/tests/entities/test_resultset.py +++ b/ote_sdk/ote_sdk/tests/entities/test_resultset.py @@ -100,7 +100,7 @@ def test_resultset_entity(self): assert result_set.performance == NullPerformance() assert type(result_set.creation_date) == datetime.datetime - assert result_set.id == ID() + assert result_set.id_ == ID() assert result_set.has_score_metric() is False result_set.performance = "test_performance" @@ -112,8 +112,8 @@ def test_resultset_entity(self): assert result_set.creation_date == creation_date set_attr_id = ID(123456789) - result_set.id = set_attr_id - assert result_set.id == set_attr_id + result_set.id_ = set_attr_id + assert result_set.id_ == set_attr_id test_result_set_repr = [ f"model={result_set.model}", @@ -122,7 +122,7 @@ def test_resultset_entity(self): f"purpose={result_set.purpose}", f"performance={result_set.performance}", f"creation_date={result_set.creation_date}", - f"id={result_set.id}", + f"id={result_set.id_}", ] for i in test_result_set_repr: diff --git a/ote_sdk/ote_sdk/tests/serialization/test_id_mapper.py b/ote_sdk/ote_sdk/tests/serialization/test_id_mapper.py index dbb2c4f1424..a55c943de64 100644 --- a/ote_sdk/ote_sdk/tests/serialization/test_id_mapper.py +++ b/ote_sdk/ote_sdk/tests/serialization/test_id_mapper.py @@ -23,8 +23,8 @@ def test_serialized_representiaton(self): This test serializes ID and checks serialized representation. """ - id = ID("21434231456") - serialized_id = IDMapper.forward(id) + id_ = ID("21434231456") + serialized_id = IDMapper.forward(id_) assert serialized_id == "21434231456" @pytest.mark.priority_medium @@ -35,7 +35,7 @@ def test_serialization_deserialization(self): This test serializes ID, deserializes serialized ID and compare with original. """ - id = ID("21434231456") - serialized_id = IDMapper.forward(id) + id_ = ID("21434231456") + serialized_id = IDMapper.forward(id_) deserialized_id = IDMapper.backward(serialized_id) - assert id == deserialized_id + assert id_ == deserialized_id diff --git a/ote_sdk/ote_sdk/tests/serialization/test_label_mapper.py b/ote_sdk/ote_sdk/tests/serialization/test_label_mapper.py index a0988674db7..c5b6bd20692 100644 --- a/ote_sdk/ote_sdk/tests/serialization/test_label_mapper.py +++ b/ote_sdk/ote_sdk/tests/serialization/test_label_mapper.py @@ -136,7 +136,7 @@ def test_flat_label_schema_serialization(self): "label_tree": {"type": "tree", "directed": True, "nodes": [], "edges": []}, "label_groups": [ { - "_id": label_schema.get_groups()[0].id, + "_id": label_schema.get_groups()[0].id_, "name": "from_label_list", "label_ids": ["0", "1", "2"], "relation_type": "EXCLUSIVE", @@ -207,7 +207,7 @@ def test_label_group_serialization(self): ) serialized = LabelGroupMapper.forward(label_group) assert serialized == { - "_id": label_group.id, + "_id": label_group.id_, "name": "Test LabelGroup", "label_ids": ["0", "1", "2"], "relation_type": "EMPTY_LABEL", diff --git a/ote_sdk/ote_sdk/tests/test_helpers.py b/ote_sdk/ote_sdk/tests/test_helpers.py index 707e7fc5755..5a9facc94d9 100644 --- a/ote_sdk/ote_sdk/tests/test_helpers.py +++ b/ote_sdk/ote_sdk/tests/test_helpers.py @@ -66,7 +66,7 @@ def new_label_by_name(self, name: str, is_empty: bool = False) -> LabelEntity: label = LabelEntity( name=name, color=Color.random(), domain=self.label_domain, is_empty=is_empty ) - label.id = generate_unique_id() + label.id_ = generate_unique_id() return label def add_hierarchy(