1
0
forked from ScoDoc/ScoDoc

code cleaning

This commit is contained in:
Emmanuel Viennet 2022-09-30 16:01:43 +02:00
parent 9527240ea8
commit d6be0e131f

View File

@ -63,10 +63,10 @@ def formsemestre_get_ics_url(sem):
ics_url = ics_url_tmpl.format(sem=sem)
except:
log(
"Exception in formsemestre_get_ics_url(formsemestre_id=%s)"
% sem["formsemestre_id"]
f"""Exception in formsemestre_get_ics_url(formsemestre_id={sem["formsemestre_id"]})
ics_url_tmpl='{ics_url_tmpl}'
"""
)
log("ics_url_tmpl='%s'" % ics_url_tmpl)
log(traceback.format_exc())
return None
return ics_url
@ -79,10 +79,9 @@ def formsemestre_load_ics(sem):
if not ics_url:
ics_data = ""
else:
log("Loading edt from %s" % ics_url)
f = urllib.request.urlopen(
ics_url, timeout=5
) # 5s TODO: add config parameter, eg for slow networks
log(f"Loading edt from {ics_url}")
# 5s TODO: add config parameter, eg for slow networks
f = urllib.request.urlopen(ics_url, timeout=5)
ics_data = f.read()
f.close()
@ -90,12 +89,6 @@ def formsemestre_load_ics(sem):
return cal
# def formsemestre_edt_groups_used(sem):
# """L'ensemble des groupes EDT utilisés dans l'emploi du temps publié"""
# cal = formsemestre_load_ics(sem)
# return {e["X-GROUP-ID"].decode("utf8") for e in events}
def get_edt_transcodage_groups(formsemestre_id):
"""-> { nom_groupe_edt : nom_groupe_scodoc }"""
# TODO: valider ces données au moment où on enregistre les préférences
@ -116,10 +109,10 @@ def get_edt_transcodage_groups(formsemestre_id):
edt2sco[fs[0]] = fs[1]
sco2edt[fs[1]] = fs[0]
else:
msg = "ligne %s invalide" % line_num
msg = f"ligne {line_num} invalide"
line_num += 1
log("sco2edt=%s" % pprint.pformat(sco2edt))
log(f"sco2edt={pprint.pformat(sco2edt)}")
return edt2sco, sco2edt, msg
@ -152,13 +145,6 @@ def group_edt_json(group_id, start="", end=""): # actuellement inutilisé
return scu.sendJSON(J)
"""XXX
for e in events:
if 'DESCRIPTION' in e:
print e.decoded('DESCRIPTION')
"""
def experimental_calendar(group_id=None, formsemestre_id=None): # inutilisé
"""experimental page"""
return "\n".join(