forked from ScoDoc/ScoDoc
fix some divisions for py3
This commit is contained in:
parent
9199a01f94
commit
79b8b3c180
@ -224,9 +224,9 @@ def bonus_iutam(notes_sport, coefs, infos=None):
|
|||||||
# une seule note
|
# une seule note
|
||||||
note_sport = notes_sport[0]
|
note_sport = notes_sport[0]
|
||||||
if note_sport < 10.0:
|
if note_sport < 10.0:
|
||||||
return 0
|
return 0.0
|
||||||
prc = min((int(2 * note_sport - 20.0) + 2) * 0.25, 5)
|
prc = min((int(2 * note_sport - 20.0) + 2) * 0.25, 5)
|
||||||
bonus = infos["moy"] * prc / 100
|
bonus = infos["moy"] * prc / 100.0
|
||||||
return bonus
|
return bonus
|
||||||
|
|
||||||
|
|
||||||
@ -332,8 +332,8 @@ def bonus_iuto(notes_sport, coefs, infos=None):
|
|||||||
infos["sem"]["date_debut_iso"] > "2013-08-01"
|
infos["sem"]["date_debut_iso"] > "2013-08-01"
|
||||||
): # changement de regle en aout 2013.
|
): # changement de regle en aout 2013.
|
||||||
return bonus
|
return bonus
|
||||||
coefs = 0
|
coefs = 0.0
|
||||||
coefs_total = 0
|
coefs_total = 0.0
|
||||||
for ue_id in infos["moy_ues"]:
|
for ue_id in infos["moy_ues"]:
|
||||||
ue_status = infos["moy_ues"][ue_id]
|
ue_status = infos["moy_ues"][ue_id]
|
||||||
coefs_total = coefs_total + ue_status["sum_coefs"]
|
coefs_total = coefs_total + ue_status["sum_coefs"]
|
||||||
|
@ -19,7 +19,7 @@ def ImageScaleH(img_file, W=None, H=90):
|
|||||||
im = PILImage.open(img_file)
|
im = PILImage.open(img_file)
|
||||||
if W is None:
|
if W is None:
|
||||||
# keep aspect
|
# keep aspect
|
||||||
W = (im.size[0] * H) / im.size[1]
|
W = int((im.size[0] * H) / float(im.size[1]))
|
||||||
im.thumbnail((W, H), PILImage.ANTIALIAS)
|
im.thumbnail((W, H), PILImage.ANTIALIAS)
|
||||||
out_file_str = StringIO()
|
out_file_str = StringIO()
|
||||||
im.save(out_file_str, im.format)
|
im.save(out_file_str, im.format)
|
||||||
|
@ -941,7 +941,9 @@ def MonthTableBody(
|
|||||||
if legend or d == 1:
|
if legend or d == 1:
|
||||||
n = 3 - len(legend) # pad to 3 cars
|
n = 3 - len(legend) # pad to 3 cars
|
||||||
if n > 0:
|
if n > 0:
|
||||||
legend = " " * (n / 2) + legend + " " * ((n + 1) / 2)
|
legend = (
|
||||||
|
" " * (n // 2) + legend + " " * ((n + 1) // 2)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
legend = " " # empty cell
|
legend = " " # empty cell
|
||||||
cc.append(legend)
|
cc.append(legend)
|
||||||
|
@ -553,7 +553,7 @@ class ApoEtud(dict):
|
|||||||
# print 'note=%s autre_note=%s' % (note, autre_note)
|
# print 'note=%s autre_note=%s' % (note, autre_note)
|
||||||
try:
|
try:
|
||||||
moy_annuelle = (note + autre_note) / 2
|
moy_annuelle = (note + autre_note) / 2
|
||||||
except:
|
except TypeError:
|
||||||
moy_annuelle = ""
|
moy_annuelle = ""
|
||||||
note_str = _apo_fmt_note(moy_annuelle)
|
note_str = _apo_fmt_note(moy_annuelle)
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ def etud_upload_file_form(context, REQUEST, etudid):
|
|||||||
% etud,
|
% etud,
|
||||||
"""<p>Le fichier ne doit pas dépasser %sMo.</p>
|
"""<p>Le fichier ne doit pas dépasser %sMo.</p>
|
||||||
"""
|
"""
|
||||||
% (scu.CONFIG.ETUD_MAX_FILE_SIZE / (1024 * 1024)),
|
% (scu.CONFIG.ETUD_MAX_FILE_SIZE // (1024 * 1024)),
|
||||||
]
|
]
|
||||||
tf = TrivialFormulator(
|
tf = TrivialFormulator(
|
||||||
REQUEST.URL0,
|
REQUEST.URL0,
|
||||||
|
@ -203,7 +203,7 @@ def formsemestre_bulletinetud_published_dict(
|
|||||||
ue_status = nt.get_etud_ue_status(etudid, ue["ue_id"])
|
ue_status = nt.get_etud_ue_status(etudid, ue["ue_id"])
|
||||||
try:
|
try:
|
||||||
ects_txt = str(int(ue["ects"]))
|
ects_txt = str(int(ue["ects"]))
|
||||||
except:
|
except ValueError:
|
||||||
ects_txt = ""
|
ects_txt = ""
|
||||||
u = dict(
|
u = dict(
|
||||||
id=ue["ue_id"],
|
id=ue["ue_id"],
|
||||||
|
@ -84,9 +84,9 @@ def ListMedian(L):
|
|||||||
raise ValueError("empty list")
|
raise ValueError("empty list")
|
||||||
L.sort()
|
L.sort()
|
||||||
if n % 2:
|
if n % 2:
|
||||||
return L[n / 2]
|
return L[n // 2]
|
||||||
else:
|
else:
|
||||||
return (L[n / 2] + L[n / 2 - 1]) / 2
|
return (L[n // 2] + L[n // 2 - 1]) / 2
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
@ -313,7 +313,7 @@ def save_image(context, etudid, data):
|
|||||||
def scale_height(img, W=None, H=REDUCED_HEIGHT):
|
def scale_height(img, W=None, H=REDUCED_HEIGHT):
|
||||||
if W is None:
|
if W is None:
|
||||||
# keep aspect
|
# keep aspect
|
||||||
W = (img.size[0] * H) / img.size[1]
|
W = int((img.size[0] * H) / img.size[1])
|
||||||
img.thumbnail((W, H), PILImage.ANTIALIAS)
|
img.thumbnail((W, H), PILImage.ANTIALIAS)
|
||||||
return img
|
return img
|
||||||
|
|
||||||
@ -355,7 +355,9 @@ def copy_portal_photo_to_fs(context, etud, REQUEST=None):
|
|||||||
f = None
|
f = None
|
||||||
try:
|
try:
|
||||||
log("copy_portal_photo_to_fs: getting %s" % url)
|
log("copy_portal_photo_to_fs: getting %s" % url)
|
||||||
f = six.moves.urllib.request.urlopen(url, timeout=portal_timeout) # python >= 2.7
|
f = six.moves.urllib.request.urlopen(
|
||||||
|
url, timeout=portal_timeout
|
||||||
|
) # python >= 2.7
|
||||||
except:
|
except:
|
||||||
log("download failed: exception:\n%s" % traceback.format_exc())
|
log("download failed: exception:\n%s" % traceback.format_exc())
|
||||||
log("called from:\n" + "".join(traceback.format_stack()))
|
log("called from:\n" + "".join(traceback.format_stack()))
|
||||||
|
@ -465,7 +465,7 @@ def Excel_feuille_placement(
|
|||||||
# ajuste largeurs colonnes (unite inconnue, empirique)
|
# ajuste largeurs colonnes (unite inconnue, empirique)
|
||||||
width = 4500
|
width = 4500
|
||||||
if nbcolumns > 5:
|
if nbcolumns > 5:
|
||||||
width = 22500 / nbcolumns
|
width = 22500 // nbcolumns
|
||||||
|
|
||||||
for col in range(nbcolumns):
|
for col in range(nbcolumns):
|
||||||
ws0.col(col + 1).width = width
|
ws0.col(col + 1).width = width
|
||||||
|
Loading…
Reference in New Issue
Block a user