From a3ede77f2c1b8a91f54d7bc88f05dd501932ba99 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 11 Jul 2021 17:59:47 +0200 Subject: [PATCH] don't use ListType --- app/scodoc/sco_codes_parcours.py | 11 +++++------ app/scodoc/sco_export_results.py | 4 +--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/scodoc/sco_codes_parcours.py b/app/scodoc/sco_codes_parcours.py index 42010c19..a22fb4fc 100644 --- a/app/scodoc/sco_codes_parcours.py +++ b/app/scodoc/sco_codes_parcours.py @@ -27,7 +27,6 @@ """Semestres: Codes gestion parcours (constantes) """ -from types import ListType, TupleType, FloatType import collections from six.moves import range @@ -183,7 +182,7 @@ class DUTRule(object): assert len(state) == len(self.premise) for i in range(len(state)): prem = self.premise[i] - if type(prem) == ListType or type(prem) == TupleType: + if isinstance(prem, (list, tuple)): if not state[i] in prem: return False else: @@ -239,7 +238,7 @@ class TypeParcours(object): ue_status for ue_status in ues_status if ue_status["coef_ue"] > 0 - and type(ue_status["moy"]) == FloatType + and type(ue_status["moy"]) == float and ue_status["moy"] < self.get_barre_ue(ue_status["ue"]["type"]) ] @@ -393,7 +392,7 @@ class ParcoursLP2014(TypeParcours): (ue_status["moy"], ue_status["coef_ue"]) for ue_status in ues_status if ue_status["ue"]["type"] == UE_STAGE_LP - and type(ue_status["moy"]) == FloatType + and type(ue_status["moy"]) == float ] # Moyenne des moyennes: sum_coef = sum(x[1] for x in mc_stages_proj) @@ -627,7 +626,7 @@ class ParcoursMasterIG(ParcoursMasterLMD): for ue_status in ues_status if ue_status["ue"]["type"] == UE_STANDARD and ue_status["coef_ue"] > 0 - and type(ue_status["moy"]) == FloatType + and type(ue_status["moy"]) == float and ue_status["moy"] < self.get_barre_ue(ue_status["ue"]["type"]) ] if len(ue_sb): @@ -641,7 +640,7 @@ class ParcoursMasterIG(ParcoursMasterLMD): (ue_status["moy"], ue_status["coef_ue"]) for ue_status in ues_status if ue_status["ue"]["type"] == UE_STAGE_10 - and type(ue_status["moy"]) == FloatType + and type(ue_status["moy"]) == float ] # Moyenne des moyennes: sum_coef = sum(x[1] for x in mc_stages) diff --git a/app/scodoc/sco_export_results.py b/app/scodoc/sco_export_results.py index 90d15de3..9a682055 100644 --- a/app/scodoc/sco_export_results.py +++ b/app/scodoc/sco_export_results.py @@ -27,8 +27,6 @@ """Export d'une table avec les résultats de tous les étudiants """ -from types import ListType - from flask import url_for, g import app.scodoc.notesdb as ndb @@ -229,7 +227,7 @@ def scodoc_table_results( log("scodoc_table_results: start_date=%s" % (start_date,)) # XXX if not types_parcours: types_parcours = [] - if not isinstance(types_parcours, ListType): + if not isinstance(types_parcours, list): types_parcours = [types_parcours] if start_date: start_date_iso = ndb.DateDMYtoISO(start_date)