Commit 38497686 authored by Manuel Günther's avatar Manuel Günther

Based database on new version of verification utils.

parent 2aeb5003
......@@ -9,7 +9,7 @@ from setuptools import setup, find_packages
setup(
name='xbob.db.banca',
version='1.0.0',
version='1.0.1',
description='BANCA Database Access API for Bob',
url='http://github.com/bioidiap/xbob.db.banca',
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 = [
......
......@@ -80,7 +80,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
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 __group_replace_alias__(self, l):
......@@ -487,48 +487,3 @@ class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.u
return ProtocolPurpose.purpose_choices
def paths(self, ids, prefix='', suffix=''):
"""Returns a full file paths considering particular file ids, a given
directory and an extension
Keyword Parameters:
ids
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).
"""
retval = []
fobj = self.query(File).filter(File.path.in_(paths))
for p in paths:
retval.extend([k.id for k in fobj if k.path == p])
return retval
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