diff --git a/app/scodoc/debug.py b/app/scodoc/debug.py
index a619eede76..2d74450798 100644
--- a/app/scodoc/debug.py
+++ b/app/scodoc/debug.py
@@ -31,6 +31,8 @@ nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
"""
+from __future__ import absolute_import
+from __future__ import print_function
import pdb # pylint: disable=unused-import
import pprint
diff --git a/app/scodoc/dutrules.py b/app/scodoc/dutrules.py
index ed281bb9eb..b9c8a524a1 100644
--- a/app/scodoc/dutrules.py
+++ b/app/scodoc/dutrules.py
@@ -4,6 +4,7 @@
#
# Command: ./csv2rules.py misc/parcoursDUT.csv
#
+from __future__ import absolute_import
from app.scodoc.sco_codes_parcours import (
DUTRule,
ADC,
diff --git a/app/scodoc/gen_tables.py b/app/scodoc/gen_tables.py
index c43f56f297..7e04c9d5a1 100644
--- a/app/scodoc/gen_tables.py
+++ b/app/scodoc/gen_tables.py
@@ -40,6 +40,8 @@ Par exemple, la clé '_css_row_class' spécifie le style CSS de la ligne.
"""
+from __future__ import absolute_import
+from __future__ import print_function
import random
from collections import OrderedDict
@@ -209,7 +211,7 @@ class GenTable:
if with_titles and self.titles:
l = []
if with_lines_titles:
- if self.titles.has_key("row_title"):
+ if "row_title" in self.titles:
l = [self.titles["row_title"]]
T.append(l + [self.titles.get(cid, "") for cid in self.columns_ids])
@@ -218,7 +220,7 @@ class GenTable:
line_num += 1
l = []
if with_lines_titles:
- if row.has_key("row_title"):
+ if "row_title" in row:
l = [row["row_title"]]
if not (omit_hidden_lines and row.get("_hidden", False)):
@@ -262,7 +264,7 @@ class GenTable:
line_num += 1
l = []
if with_lines_titles:
- if self.bottom_titles.has_key("row_title"):
+ if "row_title" in self.bottom_titles:
l = [self.bottom_titles["row_title"]]
T.append(l + [self.bottom_titles.get(cid, "") for cid in self.columns_ids])
@@ -310,7 +312,7 @@ class GenTable:
cls = ""
H = ["
" % (cls, row.get("_tr_attrs", ""))]
# titre ligne
- if row.has_key("row_title"):
+ if "row_title" in row:
content = str(row["row_title"])
help = row.get("row_title_help", "")
if help:
@@ -517,7 +519,7 @@ class GenTable:
("VALIGN", (0, 0), (-1, -1), "TOP"),
]
nb_cols = len(self.columns_ids)
- if self.rows and self.rows[0].has_key("row_title"):
+ if self.rows and "row_title" in self.rows[0]:
nb_cols += 1
if not self.pdf_col_widths:
self.pdf_col_widths = (None,) * nb_cols
diff --git a/app/scodoc/html_sco_header.py b/app/scodoc/html_sco_header.py
index 656a8e63e2..f1c1ba3efa 100644
--- a/app/scodoc/html_sco_header.py
+++ b/app/scodoc/html_sco_header.py
@@ -28,6 +28,7 @@
"""HTML Header/Footer for ScoDoc pages
"""
+from __future__ import absolute_import
import cgi
from flask_login import current_user
@@ -167,7 +168,7 @@ def sco_header(
REQUEST.RESPONSE.setHeader("X-ScoDoc-User", str(REQUEST.AUTHENTICATED_USER))
# Get more parameters from REQUEST
- if not head_message and REQUEST.form.has_key("head_message"):
+ if not head_message and "head_message" in REQUEST.form:
head_message = REQUEST.form["head_message"]
params = {
diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py
index a411ed1062..75e6f0a28c 100644
--- a/app/scodoc/html_sidebar.py
+++ b/app/scodoc/html_sidebar.py
@@ -28,6 +28,7 @@
"""
Génération de la "sidebar" (marge gauche des pages HTML)
"""
+from __future__ import absolute_import
from flask import url_for
import app.scodoc.sco_utils as scu
@@ -95,7 +96,7 @@ def sidebar(context, REQUEST=None):
% params
)
# ---- s'il y a un etudiant selectionné:
- if REQUEST.form.has_key("etudid"):
+ if "etudid" in REQUEST.form:
etudid = REQUEST.form["etudid"]
etud = sco_etud.get_etud_info(filled=1, etudid=etudid)[0]
params.update(etud)
diff --git a/app/scodoc/htmlutils.py b/app/scodoc/htmlutils.py
index 0ea71ba05a..bd3490be12 100644
--- a/app/scodoc/htmlutils.py
+++ b/app/scodoc/htmlutils.py
@@ -27,9 +27,10 @@
"""Various HTML generation functions
"""
+from __future__ import absolute_import
from flask import g, url_for
-import listhistogram
+from . import listhistogram
import app.scodoc.sco_utils as scu
diff --git a/app/scodoc/imageresize.py b/app/scodoc/imageresize.py
index 252a6f6dce..122ee837af 100644
--- a/app/scodoc/imageresize.py
+++ b/app/scodoc/imageresize.py
@@ -1,5 +1,6 @@
"""Simple image resize using PIL"""
+from __future__ import absolute_import
from PIL import Image as PILImage
from cStringIO import StringIO
diff --git a/app/scodoc/intervals.py b/app/scodoc/intervals.py
index 7517e603d7..8469c54558 100644
--- a/app/scodoc/intervals.py
+++ b/app/scodoc/intervals.py
@@ -4,8 +4,11 @@
# Code from http://code.activestate.com/recipes/457411/
+from __future__ import absolute_import
+from __future__ import print_function
from bisect import bisect_left, bisect_right
-from itertools import izip
+
+from six.moves import zip
class intervalmap(object):
@@ -129,7 +132,7 @@ class intervalmap(object):
in order.
"""
previous_bound = None
- for b, v in izip(self._bounds, self._items):
+ for b, v in zip(self._bounds, self._items):
if v is not None:
yield (previous_bound, b), v
previous_bound = b
@@ -188,7 +191,7 @@ if __name__ == "__main__":
repr(i)
== "{[None, 3] => 'My,', [3, 5] => 'Hello', [5.5, 5.9000000000000004] => 'Cruel', [6.5999999999999996, 7] => 'World', [8, 10] => '(Test)', [10, None] => '!'}"
)
- assert " ".join(i.values()) == "My, Hello Cruel World (Test) !"
+ assert " ".join(list(i.values())) == "My, Hello Cruel World (Test) !"
print("Test 1 OK")
# Test 2