1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-11 05:17:55 +03:00

Added some comments on __eq__ operator of ObjectType

This commit is contained in:
Adolfo Gómez García 2023-11-24 05:00:14 +01:00
parent efd78ddffb
commit 31ffcfaf4b
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 13 additions and 2 deletions

View File

@ -80,6 +80,7 @@ class Permissions(Handler):
perms: typing.Iterable[models.Permissions],
) -> typing.List[typing.Dict[str, str]]:
res = []
entity: typing.Optional[typing.Union[models.User, models.Group]]
for perm in perms:
if perm.user is None:
kind = 'group'

View File

@ -80,7 +80,7 @@ class ObjectType(enum.Enum):
@property
def type(self) -> int:
"""Returns the integer value of this object type"""
"""Returns the integer value of this object type. (The "type" id)"""
return self.value.type
@staticmethod
@ -98,5 +98,15 @@ class ObjectType(enum.Enum):
Returns:
bool: True if equal, False otherwise
Examples:
>>> ObjectType.PROVIDER == ObjectType.PROVIDER
True
>>> ObjectType.PROVIDER == 1
True
>>> ObjectType.PROVIDER == ObjectType.SERVICE
False
>>> ObjectType.PROVIDER == 2
False
"""
return super().__eq__(__o) or self.value[0] == __o
return super().__eq__(__o) or self.value.type == __o