Commit 05c7aa82 authored by Manuel Günther's avatar Manuel Günther

Based database on new version of verification utils.

parent 3d56a477
......@@ -9,7 +9,7 @@ from setuptools import setup, find_packages
setup(
name='xbob.db.mobio',
version='1.0.1',
version='1.0.2',
description='MOBIO Database Access API for Bob',
url='http://github.com/bioidiap/xbob.db.mobio',
license='GPLv3',
......@@ -25,7 +25,7 @@ setup(
install_requires=[
'setuptools',
'bob', # base signal proc./machine learning library
'xbob.db.verification.utils' # defines a set of utilities for face verification databases like this one.
'xbob.db.verification.utils>=0.1.4' # defines a set of utilities for face verification databases like this one.
],
namespace_packages = [
......
......@@ -77,7 +77,7 @@ def reverse(args):
output = null()
r = db.reverse(args.path)
for id in r: output.write('%d\n' % id)
for f in r: output.write('%d\n' % f.id)
if not r: return 1
......
......@@ -24,7 +24,7 @@ class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.u
def __init__(self):
# call base class constructors to open a session to the database
xbob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE)
xbob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE, File)
xbob.db.verification.utils.ZTDatabase.__init__(self)
def groups(self):
......@@ -492,48 +492,3 @@ class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.u
return ProtocolPurpose.purpose_choices
def paths(self, ids, prefix=None, suffix=None):
"""Returns a full file paths considering particular file ids, a given
directory and an extension
Keyword Parameters:
id
The ids of the object in the database table "file". This object should be
a python iterable (such as a tuple or list).
prefix
The bit of path to be prepended to the filename stem
suffix
The extension determines the suffix that will be appended to the filename
stem.
Returns a list (that may be empty) of the fully constructed paths given the
file ids.
"""
fobj = self.query(File).filter(File.id.in_(ids))
retval = []
for p in ids:
retval.extend([k.make_path(prefix, suffix) for k in fobj if k.id == p])
return retval
def reverse(self, paths):
"""Reverses the lookup: from certain stems, returning file ids
Keyword Parameters:
paths
The filename stems I'll query for. This object should be a python
iterable (such as a tuple or list)
Returns a list (that may be empty).
"""
fobj = self.query(File).filter(File.path.in_(paths))
retval = []
for p in paths:
retval.extend([k.id for k in fobj if k.path == p])
return retval
......@@ -69,7 +69,7 @@ class MobioDatabaseTest(unittest.TestCase):
self.assertTrue(db.has_subworld('onethird'))
def test03_files(self):
def test03_objects(self):
db = Database()
......
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