Commit cbefb62d authored by Manuel Günther's avatar Manuel Günther
Browse files

Based database on new version of verification utils.

parent e42f7caf
...@@ -9,7 +9,7 @@ from setuptools import setup, find_packages ...@@ -9,7 +9,7 @@ from setuptools import setup, find_packages
setup( setup(
name='xbob.db.biosecure', name='xbob.db.biosecure',
version='1.0.0', version='1.0.1',
description='Biosecure Database Access API for Bob', description='Biosecure Database Access API for Bob',
url='http://github.com/bioidiap/xbob.db.biosecure', url='http://github.com/bioidiap/xbob.db.biosecure',
license='GPLv3', license='GPLv3',
...@@ -25,7 +25,7 @@ setup( ...@@ -25,7 +25,7 @@ setup(
install_requires=[ install_requires=[
'setuptools', 'setuptools',
'bob', # base signal proc./machine learning library '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 = [ namespace_packages = [
......
...@@ -81,7 +81,7 @@ def reverse(args): ...@@ -81,7 +81,7 @@ def reverse(args):
output = null() output = null()
r = db.reverse(args.path) 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 if not r: return 1
......
...@@ -24,7 +24,7 @@ class Database(xbob.db.verification.utils.SQLiteDatabase): ...@@ -24,7 +24,7 @@ class Database(xbob.db.verification.utils.SQLiteDatabase):
def __init__(self): def __init__(self):
# call base class constructors # call base class constructors
xbob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE) xbob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE, File)
def groups(self): def groups(self):
"""Returns the names of all registered groups""" """Returns the names of all registered groups"""
...@@ -222,48 +222,4 @@ class Database(xbob.db.verification.utils.SQLiteDatabase): ...@@ -222,48 +222,4 @@ class Database(xbob.db.verification.utils.SQLiteDatabase):
return ProtocolPurpose.purpose_choices 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
Supports Markdown
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