diff --git a/apps/wei/forms/surveys/wei2021.py b/apps/wei/forms/surveys/wei2021.py index cbf615c2..4b16928b 100644 --- a/apps/wei/forms/surveys/wei2021.py +++ b/apps/wei/forms/surveys/wei2021.py @@ -148,7 +148,7 @@ class WEISurvey2021(WEISurvey): buses = cls.get_algorithm_class().get_buses() return sum([cls.get_algorithm_class().get_bus_information(bus).scores[word] for bus in buses]) / buses.count() -# @lru_cache + @lru_cache def score(self, bus): if not self.is_complete(): raise ValueError("Survey is not ended, can't calculate score") @@ -159,11 +159,11 @@ class WEISurvey2021(WEISurvey): - self.word_mean(getattr(self.information, 'word' + str(i))) for i in range(1, 21)) / 20 return s -# @lru_cache() + @lru_cache() def scores_per_bus(self): return {bus: self.score(bus) for bus in self.get_algorithm_class().get_buses()} -# @lru_cache() + @lru_cache() def ordered_buses(self): values = list(self.scores_per_bus().items()) values.sort(key=lambda item: -item[1]) diff --git a/apps/wei/forms/surveys/wei2022.py b/apps/wei/forms/surveys/wei2022.py index 0c8a16d4..6a6aecd5 100644 --- a/apps/wei/forms/surveys/wei2022.py +++ b/apps/wei/forms/surveys/wei2022.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2022 by BDE ENS Paris-Saclay +# Copyright (C) 2018-2023 by BDE ENS Paris-Saclay # SPDX-License-Identifier: GPL-3.0-or-later import time @@ -151,7 +151,7 @@ class WEISurvey2022(WEISurvey): buses = cls.get_algorithm_class().get_buses() return sum([cls.get_algorithm_class().get_bus_information(bus).scores[word] for bus in buses]) / buses.count() -# @lru_cache() + @lru_cache() def score(self, bus): if not self.is_complete(): raise ValueError("Survey is not ended, can't calculate score") @@ -162,11 +162,11 @@ class WEISurvey2022(WEISurvey): - self.word_mean(getattr(self.information, 'word' + str(i))) for i in range(1, 21)) / 20 return s -# @lru_cache() + @lru_cache() def scores_per_bus(self): return {bus: self.score(bus) for bus in self.get_algorithm_class().get_buses()} -# @lru_cache() + @lru_cache() def ordered_buses(self): values = list(self.scores_per_bus().items()) values.sort(key=lambda item: -item[1]) diff --git a/apps/wei/forms/surveys/wei2023.py b/apps/wei/forms/surveys/wei2023.py index ee1cc2ef..bf010108 100644 --- a/apps/wei/forms/surveys/wei2023.py +++ b/apps/wei/forms/surveys/wei2023.py @@ -14,17 +14,17 @@ from .base import WEISurvey, WEISurveyInformation, WEISurveyAlgorithm, WEIBusInf from ...models import WEIMembership WORDS = [ - 'ABBA', 'After', 'Alcoolique anonyme', 'Ambiance festive', 'Années 2000', 'Apéro', 'Art', - 'Baby foot billard biere pong', 'BBQ', 'Before', 'Bière pong', 'Bon enfant', 'Calme', 'Canapé', - 'Chanson paillarde', 'Chanson populaire', 'Chartreuse', 'Cheerleader', 'Chill', 'Choré', - 'Cinéma', 'Cocktail', 'Comédie musicle', 'Commercial', 'Copaing', 'Danse', 'Dancefloor', - 'Electro', 'Fanfare', 'Gin tonic', 'Inclusif', 'Jazz', "Jeux d'alcool", 'Jeux de carte', - 'Jeux de rôle', 'Jeux de société', 'JUL', 'Jus de fruit', 'Kfet', 'Kleptomanie assurée', - 'LGBTQ+', 'Livre', 'Morning beer', 'Musique', 'NAPS', 'Paillettes', 'Pastis', 'Paté Hénaff', - 'Peluche', 'Pena baiona', "Peu d'alcool", 'Pilier de bar', 'PMU', 'Poulpe', 'Punch', 'Rap', - 'Réveil', 'Rock', 'Rugby', 'Sandwich', 'Serge', 'Shot', 'Sociable', 'Spectacle', 'Techno', - 'Techno house', 'Thérapie Taxi', 'Tradition kchanaises', 'Troisième mi-temps', 'Turn up', - 'Vodka', 'Vodka pomme', 'Volley', 'Vomi stratégique' + 'ABBA', 'After', 'Alcoolique anonyme', 'Ambiance festive', 'Années 2000', 'Apéro', 'Art', + 'Baby foot billard biere pong', 'BBQ', 'Before', 'Bière pong', 'Bon enfant', 'Calme', 'Canapé', + 'Chanson paillarde', 'Chanson populaire', 'Chartreuse', 'Cheerleader', 'Chill', 'Choré', + 'Cinéma', 'Cocktail', 'Comédie musicle', 'Commercial', 'Copaing', 'Danse', 'Dancefloor', + 'Electro', 'Fanfare', 'Gin tonic', 'Inclusif', 'Jazz', "Jeux d'alcool", 'Jeux de carte', + 'Jeux de rôle', 'Jeux de société', 'JUL', 'Jus de fruit', 'Kfet', 'Kleptomanie assurée', + 'LGBTQ+', 'Livre', 'Morning beer', 'Musique', 'NAPS', 'Paillettes', 'Pastis', 'Paté Hénaff', + 'Peluche', 'Pena baiona', "Peu d'alcool", 'Pilier de bar', 'PMU', 'Poulpe', 'Punch', 'Rap', + 'Réveil', 'Rock', 'Rugby', 'Sandwich', 'Serge', 'Shot', 'Sociable', 'Spectacle', 'Techno', + 'Techno house', 'Thérapie Taxi', 'Tradition kchanaises', 'Troisième mi-temps', 'Turn up', + 'Vodka', 'Vodka pomme', 'Volley', 'Vomi stratégique' ] diff --git a/tox.ini b/tox.ini index 73e80b37..ad3c6798 100644 --- a/tox.ini +++ b/tox.ini @@ -35,7 +35,7 @@ commands = flake8 apps --extend-exclude apps/scripts [flake8] -ignore = W503, I100, I101 +ignore = W503, I100, I101, B019 exclude = .tox, .git,