From 0df9713511adf58fc5019a2ea6c2b0609b3127f5 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 25 Mar 2023 10:02:50 +0100 Subject: [PATCH] Update ruff --- pyproject.toml | 1 + src/character/models/character.py | 6 +++--- src/party/models.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2884b2e..f27fb6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,7 @@ ignore = [ "B011", # Do not call assert False since python -O removes these calls. "ARG001", # Unused function argument (mostly fixtures) "PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable + "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes. ] # File {name} is part of an implicit namespace package. Add an `__init__.py`. "tasks.py" = ["INP001"] diff --git a/src/character/models/character.py b/src/character/models/character.py index 8cf0476..ad2c4b2 100644 --- a/src/character/models/character.py +++ b/src/character/models/character.py @@ -304,12 +304,12 @@ class Character(models.Model): def __str__(self): return self.name - def natural_key(self): - return (self.name, self.player_id) - def get_absolute_url(self): return reverse("character:view", kwargs={"pk": self.pk}) + def natural_key(self): + return (self.name, self.player_id) + @property def modifier_strength(self) -> int: return modifier(self.value_strength) diff --git a/src/party/models.py b/src/party/models.py index e07c5c1..bcacafa 100644 --- a/src/party/models.py +++ b/src/party/models.py @@ -123,12 +123,12 @@ class BattleEffect(TimeStampedModel, models.Model): objects = BattleEffectManager.from_queryset(BattleEffectQuerySet)() + def __str__(self): + return self.name + @property def remaining_percent(self) -> float: max_display_percent = 5 if self.remaining_rounds >= max_display_percent or self.remaining_rounds < 0: return 100 return self.remaining_rounds / max_display_percent * 100 - - def __str__(self): - return self.name