From 35c900b3d7c2c04a811905ad9a0022303fb4b1d8 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 21 Jul 2021 15:57:16 +0300 Subject: [PATCH] Removed support for user defined BONUS functions with TWO arguments --- app/scodoc/notes_table.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index 2f75395f..6e849893 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -72,10 +72,6 @@ from app.scodoc import sco_preferences from app.scodoc import sco_etud -# Support for old user-written "bonus" functions with 2 args: -BONUS_TWO_ARGS = len(inspect.getargspec(scu.CONFIG.compute_bonus)[0]) == 2 - - def comp_ranks(T): """Calcul rangs à partir d'une liste ordonnée de tuples [ (valeur, ..., etudid) ] (valeur est une note numérique), en tenant compte des ex-aequos @@ -934,15 +930,9 @@ class NotesTable(object): if len(coefs_bonus_gen) == 1: coefs_bonus_gen = [1.0] # irrelevant, may be zero - if BONUS_TWO_ARGS: - # backward compat: compute_bonus took only 2 args - bonus = scu.CONFIG.compute_bonus( - notes_bonus_gen, coefs_bonus_gen - ) - else: - bonus = scu.CONFIG.compute_bonus( - notes_bonus_gen, coefs_bonus_gen, infos=infos - ) + bonus = scu.CONFIG.compute_bonus( + notes_bonus_gen, coefs_bonus_gen, infos=infos + ) self.bonus[etudid] = bonus infos["moy"] += bonus infos["moy"] = min(infos["moy"], 20.0) # clip bogus bonus