Update ruff

This commit is contained in:
Gabriel Augendre 2023-03-25 10:02:50 +01:00
parent f569c9c8c1
commit 0df9713511
3 changed files with 7 additions and 6 deletions

View file

@ -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"]

View file

@ -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)

View file

@ -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