♻️ (game.py, signals.py): Refactor comparison operators for better readability
All checks were successful
Build / Code quality (push) Successful in 9m51s
Creates a docker image for production / Build the docker image (push) Successful in 57s

🔧 (apps.py): Import signals in ready method to ensure signals are loaded when the app starts
🔧 (pyproject.toml): Add PGH004 to lint ignore list to avoid linting errors related to PostgreSQL-specific code
This commit is contained in:
2025-02-05 12:06:07 -03:00
parent 6795697dea
commit 1e0af277fe
4 changed files with 4 additions and 4 deletions

View File

@@ -7,4 +7,4 @@ class GameConfig(AppConfig):
verbose_name_plural = 'Games'
def ready(self):
pass
from game import signals # noqa

View File

@@ -8,7 +8,7 @@ from .models import EventTypes, Game, GameEvent, GameStatuses
@receiver(post_save, sender=Game)
def game_start(sender, signal, instance, **kwargs):
"""If the game was just created, insert the first event START_GAME"""
if not instance.status == GameStatuses.NOT_PLAYED:
if instance.status != GameStatuses.NOT_PLAYED:
return
GameEvent.objects.get_or_create(game=instance, type=EventTypes.START_GAME)
@@ -16,7 +16,7 @@ def game_start(sender, signal, instance, **kwargs):
@receiver(pre_save, sender=GameEvent)
def identify_click_event(sender, signal, instance, **kwargs):
"""Verify what is on the naive click: mine, point or empty"""
if not instance.type == EventTypes.CLICK_NAIVE:
if instance.type != EventTypes.CLICK_NAIVE:
return
if instance.row is None and instance.col is None: