Commit cc10f2da authored by André Anjos's avatar André Anjos 💬
Browse files

[python3] Minor adjustments for py2/3 compatibility

parent 0bfc534f
......@@ -53,6 +53,7 @@ setup(
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Database :: Front-Ends',
],
......
......@@ -54,7 +54,7 @@ class File (xbob.db.verification.utils.File):
@staticmethod
def from_file_id(file_id):
"""Returns the File object for a given file_id"""
client_id = (file_id-1) / len(File.m_valid_file_ids) + 1
client_id = int((file_id-1) / len(File.m_valid_file_ids) + 1)
client_file_id = (file_id-1) % len(File.m_valid_file_ids) + 1
return File(client_id, client_file_id)
......
......@@ -56,7 +56,7 @@ class ATNTDatabaseTest(unittest.TestCase):
f = db.objects(groups = 'dev', purposes = 'enrol', model_ids = [3])
self.assertEqual(len(f), 5)
files = sorted(f, cmp=lambda x,y: cmp(x.id, y.id))
files = sorted(f, key=lambda x: x.id)
values = sorted(list(db.m_enrol_files))
for i in range(5):
self.assertEqual(files[i].path, os.path.join("s3", str(values[i])))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment