diff --git a/xbob/db/replay/models.py b/xbob/db/replay/models.py index fa1fd8ec5fd65d7511c3a918d1984cb3cfc12e64..8a87ea236905262500532a47e562099f223f28a3 100644 --- a/xbob/db/replay/models.py +++ b/xbob/db/replay/models.py @@ -13,6 +13,7 @@ import bob.db.utils from sqlalchemy.orm import backref from sqlalchemy.ext.declarative import declarative_base import numpy +import bob Base = declarative_base() @@ -163,6 +164,24 @@ class File(Base): raise RuntimeError, "%s is not an attack" % self return self.attack[0] + def load(self, directory=None, extension='.hdf5'): + """Loads the data at the specified location and using the given extension. + + Keyword parameters: + + data + The data blob to be saved (normally a :py:class:`numpy.ndarray`). + + directory + [optional] If not empty or None, this directory is prefixed to the final + file destination + + extension + [optional] The extension of the filename - this will control the type of + output and the codec for saving the input blob. + """ + return bob.io.load(self.make_path(directory, extension)) + def save(self, data, directory=None, extension='.hdf5'): """Saves the input data at the specified location and using the given extension. @@ -173,12 +192,12 @@ class File(Base): The data blob to be saved (normally a :py:class:`numpy.ndarray`). directory - If not empty or None, this directory is prefixed to the final file - destination + [optional] If not empty or None, this directory is prefixed to the final + file destination extension - The extension of the filename - this will control the type of output and - the codec for saving the input blob. + [optional] The extension of the filename - this will control the type of + output and the codec for saving the input blob. """ path = self.make_path(directory, extension) diff --git a/xbob/db/replay/query.py b/xbob/db/replay/query.py index 228fe5c2fe96f6b14a01c235ccaa80672cfe0706..c13b1c37fcce364d71caa9913f7e472fad235f93 100644 --- a/xbob/db/replay/query.py +++ b/xbob/db/replay/query.py @@ -210,23 +210,9 @@ class Database(object): return self.session.query(Client).filter(Client.id==id).count() != 0 def protocols(self): - """Returns the names of all registered protocols - - .. deprecated:: 1.1.0 - - This function is *deprecated*, use :py:meth:`.Database.protos` instead. - + """Returns all protocol objects. """ - import warnings - warnings.warn("The method Database.protocols() is deprecated, use Database.protos() for more powerful object retrieval", DeprecationWarning) - - self.assert_validity() - return tuple([k.name for k in self.session.query(Protocol)]) - - def protos(self): - """Returns all registered protocols""" - self.assert_validity() return list(self.session.query(Protocol))