From 8aa479bf3e617d7bdcf5bfc908d79b14caba8c89 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Wed, 22 Jan 2025 07:54:32 +0000 Subject: [PATCH] Use float instead of int for pre-validated mirror score fields (#3079) This fixes an unnecessary-round ruff warning in validate_score. --- archinstall/lib/models/mirrors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/models/mirrors.py b/archinstall/lib/models/mirrors.py index 5798c211..25f30590 100644 --- a/archinstall/lib/models/mirrors.py +++ b/archinstall/lib/models/mirrors.py @@ -95,7 +95,7 @@ class MirrorStatusEntryV3(BaseModel): @classmethod @field_validator('score', mode='before') - def validate_score(cls, value: int) -> int | None: + def validate_score(cls, value: float) -> int | None: if value is not None: value = round(value) debug(f" score: {value}") @@ -107,7 +107,7 @@ class MirrorStatusEntryV3(BaseModel): self._hostname, *port = urllib.parse.urlparse(self.url).netloc.split(':', 1) self._port = int(port[0]) if port and len(port) >= 1 else None - debug(f"Loaded mirror {self._hostname}" + (f" with current score of {round(self.score)}" if self.score else '')) + debug(f"Loaded mirror {self._hostname}" + (f" with current score of {self.score}" if self.score else '')) return self