🎨(backend) simplify boolean comparisons by using opposite operators
Replace inverted boolean comparisons (not ... ==) with direct opposite operators (!=) to improve code readability and reduce unnecessary complexity in conditional statements.
This commit is contained in:
committed by
aleb_the_flash
parent
5ef38fcba6
commit
3e315e92fa
@@ -42,7 +42,7 @@ class ResourceAccessSerializerMixin:
|
|||||||
data.get("role") == models.RoleChoices.OWNER
|
data.get("role") == models.RoleChoices.OWNER
|
||||||
and not self.instance.resource.is_owner(user)
|
and not self.instance.resource.is_owner(user)
|
||||||
or self.instance.role == models.RoleChoices.OWNER
|
or self.instance.role == models.RoleChoices.OWNER
|
||||||
and not self.instance.user == user
|
and self.instance.user != user
|
||||||
)
|
)
|
||||||
) or (
|
) or (
|
||||||
# Create
|
# Create
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ def generate_pin_for_rooms(apps, schema_editor):
|
|||||||
def generate_pin_code():
|
def generate_pin_code():
|
||||||
while True:
|
while True:
|
||||||
pin_code = str(secrets.randbelow(10 ** length)).zfill(length)
|
pin_code = str(secrets.randbelow(10 ** length)).zfill(length)
|
||||||
if not pin_code in existing_pins:
|
if pin_code not in existing_pins:
|
||||||
return pin_code
|
return pin_code
|
||||||
|
|
||||||
for room in rooms_without_pin_code:
|
for room in rooms_without_pin_code:
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class MinioParser:
|
|||||||
f"Invalid bucket: expected {self._bucket_name}, got {event_data.bucket_name}"
|
f"Invalid bucket: expected {self._bucket_name}, got {event_data.bucket_name}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not event_data.filetype in self._allowed_filetypes:
|
if event_data.filetype not in self._allowed_filetypes:
|
||||||
raise InvalidFileTypeError(
|
raise InvalidFileTypeError(
|
||||||
f"Invalid file type, expected {self._allowed_filetypes},"
|
f"Invalid file type, expected {self._allowed_filetypes},"
|
||||||
f"got '{event_data.filetype}'"
|
f"got '{event_data.filetype}'"
|
||||||
|
|||||||
Reference in New Issue
Block a user