identifier.py (1123B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\cosmetics\client\character\title\model\definition\identifier.py 2 import uuid 3 from eveProto.generated.eve_public.cosmetic.character.title.definition.title_pb2 import Identifier as ProtoTitleIdentifier 4 5 class TitleIdentifier(object): 6 7 def __init__(self, identifier): 8 self._uuid = identifier 9 10 @property 11 def uuid(self): 12 return self._uuid 13 14 @classmethod 15 def from_proto(cls, payload): 16 return TitleIdentifier(identifier=uuid.UUID(bytes=payload.uuid)) 17 18 @classmethod 19 def to_proto(cls, instance): 20 return ProtoTitleIdentifier(uuid=instance.uuid.bytes) 21 22 @classmethod 23 def from_flatbuffer(cls, fb_data): 24 return TitleIdentifier(identifier=uuid.UUID(fb_data)) 25 26 def __eq__(self, other): 27 if not hasattr(other, 'uuid'): 28 return False 29 return self.uuid == other.uuid 30 31 def __ne__(self, other): 32 return not self.__eq__(other) 33 34 def __hash__(self): 35 return hash(self._uuid) 36 37 def __str__(self): 38 return 'uuid: %s' % self.uuid