From 97796ce49968b25ca91cb884f8e0e5715f8b9c4b Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 5 Nov 2022 23:26:26 +0100 Subject: [PATCH] Remove unused methods from PreferenceScore - order_by_score & get_first_by_score - easily replaceable by sorted / min calls --- server/entertainment_decider/models.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/server/entertainment_decider/models.py b/server/entertainment_decider/models.py index bf64c0c..cf2be28 100644 --- a/server/entertainment_decider/models.py +++ b/server/entertainment_decider/models.py @@ -311,12 +311,6 @@ class PreferenceScore: def calculate_iter_score(self, tag_iter: Iterable[Tag]) -> float: return math.fsum(self.points.get(tag, 0) for tag in tag_iter) - def order_by_score(self, objects: Iterable[T_tagged]) -> List[T_tagged]: - return sorted(objects, key=self.calculate_score) - - def get_first_by_score(self, objects: Iterable[T_tagged]) -> T_tagged: - return min(objects, key=self.calculate_score) - @classmethod def from_json(cls, data: str) -> PreferenceScore: dicts: Dict = json.loads(data)