1
0
forked from ScoDoc/ScoDoc

don't use ListType

This commit is contained in:
Emmanuel Viennet 2021-07-11 17:59:47 +02:00
parent c6f0fa86ea
commit a3ede77f2c
2 changed files with 6 additions and 9 deletions

View File

@ -27,7 +27,6 @@
"""Semestres: Codes gestion parcours (constantes) """Semestres: Codes gestion parcours (constantes)
""" """
from types import ListType, TupleType, FloatType
import collections import collections
from six.moves import range from six.moves import range
@ -183,7 +182,7 @@ class DUTRule(object):
assert len(state) == len(self.premise) assert len(state) == len(self.premise)
for i in range(len(state)): for i in range(len(state)):
prem = self.premise[i] prem = self.premise[i]
if type(prem) == ListType or type(prem) == TupleType: if isinstance(prem, (list, tuple)):
if not state[i] in prem: if not state[i] in prem:
return False return False
else: else:
@ -239,7 +238,7 @@ class TypeParcours(object):
ue_status ue_status
for ue_status in ues_status for ue_status in ues_status
if ue_status["coef_ue"] > 0 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"]) 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"]) (ue_status["moy"], ue_status["coef_ue"])
for ue_status in ues_status for ue_status in ues_status
if ue_status["ue"]["type"] == UE_STAGE_LP if ue_status["ue"]["type"] == UE_STAGE_LP
and type(ue_status["moy"]) == FloatType and type(ue_status["moy"]) == float
] ]
# Moyenne des moyennes: # Moyenne des moyennes:
sum_coef = sum(x[1] for x in mc_stages_proj) sum_coef = sum(x[1] for x in mc_stages_proj)
@ -627,7 +626,7 @@ class ParcoursMasterIG(ParcoursMasterLMD):
for ue_status in ues_status for ue_status in ues_status
if ue_status["ue"]["type"] == UE_STANDARD if ue_status["ue"]["type"] == UE_STANDARD
and ue_status["coef_ue"] > 0 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"]) and ue_status["moy"] < self.get_barre_ue(ue_status["ue"]["type"])
] ]
if len(ue_sb): if len(ue_sb):
@ -641,7 +640,7 @@ class ParcoursMasterIG(ParcoursMasterLMD):
(ue_status["moy"], ue_status["coef_ue"]) (ue_status["moy"], ue_status["coef_ue"])
for ue_status in ues_status for ue_status in ues_status
if ue_status["ue"]["type"] == UE_STAGE_10 if ue_status["ue"]["type"] == UE_STAGE_10
and type(ue_status["moy"]) == FloatType and type(ue_status["moy"]) == float
] ]
# Moyenne des moyennes: # Moyenne des moyennes:
sum_coef = sum(x[1] for x in mc_stages) sum_coef = sum(x[1] for x in mc_stages)

View File

@ -27,8 +27,6 @@
"""Export d'une table avec les résultats de tous les étudiants """Export d'une table avec les résultats de tous les étudiants
""" """
from types import ListType
from flask import url_for, g from flask import url_for, g
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
@ -229,7 +227,7 @@ def scodoc_table_results(
log("scodoc_table_results: start_date=%s" % (start_date,)) # XXX log("scodoc_table_results: start_date=%s" % (start_date,)) # XXX
if not types_parcours: if not types_parcours:
types_parcours = [] types_parcours = []
if not isinstance(types_parcours, ListType): if not isinstance(types_parcours, list):
types_parcours = [types_parcours] types_parcours = [types_parcours]
if start_date: if start_date:
start_date_iso = ndb.DateDMYtoISO(start_date) start_date_iso = ndb.DateDMYtoISO(start_date)