From 74b1f034cb32d3f520645ffd51ed1ea345dd031f Mon Sep 17 00:00:00 2001 From: Ronald Moesbergen Date: Wed, 7 Aug 2024 13:33:22 +0200 Subject: [PATCH] fix: pylint --- LedenAdministratie/models.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/LedenAdministratie/models.py b/LedenAdministratie/models.py index a25b2c7..4340da0 100644 --- a/LedenAdministratie/models.py +++ b/LedenAdministratie/models.py @@ -66,10 +66,11 @@ def save( self.user.is_active = self.is_active() self.user.save() - def _calculate_age(self, ondate=date.today()): - today = ondate + def _calculate_age(self, on_date=date.today()) -> int: + today = on_date born = self.gebdat return ( + # pylint: disable=no-member today.year - born.year - ((today.month, today.day) < (born.month, born.day)) ) @@ -78,13 +79,13 @@ def active_stripcard(self) -> "Stripcard": return self.stripcards.filter(used__lt=F("count")).first() @property - def full_name(self): + def full_name(self) -> str: return f"{self.first_name} {self.last_name}" - def get_types_display(self): + def get_types_display(self) -> str: return ",".join([tmptype.display_name for tmptype in self.types.all()]) - def idp_types(self): + def idp_types(self) -> str: result = [] for membertype in self.types.all(): name = membertype.slug @@ -95,38 +96,38 @@ def idp_types(self): result.append(name) return ",".join(result) - def is_bestuur(self): + def is_bestuur(self) -> bool: slugs = [membertype.slug for membertype in self.types.all()] return "bestuur" in slugs - def is_begeleider(self): + def is_begeleider(self) -> bool: slugs = [membertype.slug for membertype in self.types.all()] return "begeleider" in slugs - def is_ondersteuner(self): + def is_ondersteuner(self) -> bool: slugs = [membertype.slug for membertype in self.types.all()] return "ondersteuning" in slugs - def is_aspirant(self): + def is_aspirant(self) -> bool: slugs = [membertype.slug for membertype in self.types.all()] return "aspirant" in slugs - def is_senior(self): + def is_senior(self) -> bool: slugs = [membertype.slug for membertype in self.types.all()] return "senior" in slugs - def is_stripcard(self): + def is_stripcard(self) -> bool: slugs = [membertype.slug for membertype in self.types.all()] return "strippenkaart" in slugs - def is_standard(self): + def is_standard(self) -> bool: slugs = [membertype.slug for membertype in self.types.all()] return "member" in slugs - def is_active(self): + def is_active(self) -> bool: return self.afmeld_datum is None or self.afmeld_datum > timezone.now().date() - def __str__(self): + def __str__(self) -> str: return f"{self.first_name} {self.last_name}" user = models.OneToOneField(