@@ -53,11 +53,6 @@ def __eq__(self, other):
5353 if not isinstance (other , Entity ):
5454 raise TypeError ("Comparisons should only involve Entity class objects." )
5555
56- if isinstance (self .value_type , int ):
57- self .value_type = ValueType (self .value_type ).name
58- if isinstance (other .value_type , int ):
59- other .value_type = ValueType (other .value_type ).name
60-
6156 if (
6257 self .labels != other .labels
6358 or self .name != other .name
@@ -100,7 +95,7 @@ def description(self, description):
10095 self ._description = description
10196
10297 @property
103- def value_type (self ):
98+ def value_type (self ) -> ValueType :
10499 """
105100 Returns the type of this entity
106101 """
@@ -200,7 +195,7 @@ def from_proto(cls, entity_proto: EntityV2Proto):
200195 entity = cls (
201196 name = entity_proto .spec .name ,
202197 description = entity_proto .spec .description ,
203- value_type = ValueType (entity_proto .spec .value_type ). name , # type: ignore
198+ value_type = ValueType (entity_proto .spec .value_type ),
204199 labels = entity_proto .spec .labels ,
205200 )
206201
@@ -221,13 +216,11 @@ def to_proto(self) -> EntityV2Proto:
221216 created_timestamp = self .created_timestamp ,
222217 last_updated_timestamp = self .last_updated_timestamp ,
223218 )
224- if isinstance (self .value_type , ValueType ):
225- self .value_type = self .value_type .value
226219
227220 spec = EntitySpecProto (
228221 name = self .name ,
229222 description = self .description ,
230- value_type = self .value_type ,
223+ value_type = self .value_type . value ,
231224 labels = self .labels ,
232225 )
233226
@@ -268,13 +261,10 @@ def to_spec_proto(self) -> EntitySpecProto:
268261 EntitySpecV2 protobuf
269262 """
270263
271- if isinstance (self .value_type , ValueType ):
272- self .value_type = self .value_type .value
273-
274264 spec = EntitySpecProto (
275265 name = self .name ,
276266 description = self .description ,
277- value_type = self .value_type ,
267+ value_type = self .value_type . value ,
278268 labels = self .labels ,
279269 )
280270
0 commit comments