Skip to content
Snippets Groups Projects
Commit e8849568 authored by Amir Mohammadi's avatar Amir Mohammadi
Browse files

Add another method for the filelistbiodatabase class

parent 0ab2e9a5
No related branches found
No related tags found
1 merge request!54Add the filelist interface
Pipeline #
This commit is part of merge request !54. Comments created here will be created in the context of that merge request.
......@@ -4,7 +4,7 @@ from .database import BioDatabase
from .database import ZTBioDatabase
from .filelist.query import FileListBioDatabase
from .filelist.models import Client
from . import filelist
# gets sphinx autodoc done right - don't remove it
def __appropriate__(*args):
......
from .models import ListReader, Client
from .models import ListReader, Client, FileListFile
from .query import FileListBioDatabase
from .driver import Interface
# gets sphinx autodoc done right - don't remove it
......@@ -21,6 +22,8 @@ def __appropriate__(*args):
__appropriate__(
ListReader,
Client,
FileListFile,
FileListBioDatabase,
Interface,
)
__all__ = [_ for _ in dir() if not _.startswith('_')]
......@@ -21,6 +21,16 @@ class FileListBioDatabase(ZTBioDatabase):
attribute when querying the database, it will be appended to the base directory, such that
several protocols are supported by the same class instance of `bob.bio.base`.
name : str
The name of the database
protocol : str
The protocol of the database. This should be a folder inside ``base_dir``.
biofilecls : class
The class that should be used for return the files.
This can be `BioFile`, `AudioBioFile`, `FaceBioFile`, or anything similar.
original_directory : str or ``None``
The directory, where the original data can be found
......@@ -222,6 +232,17 @@ class FileListBioDatabase(ZTBioDatabase):
def _make_bio(self, files):
return [self.biofilecls(client_id=f.client_id, path=f.path, file_id=f.id) for f in files]
def all_files(self, groups=['dev']):
files = self.objects(groups, self.protocol, None, None, **self.all_files_options)
# add all files that belong to the ZT-norm
for group in groups:
if group == 'world':
continue
if self.implements_zt(self.protocol, group):
files += self.tobjects(group, self.protocol, None)
files += self.zobjects(group, self.protocol, **self.z_probe_options)
return self.sort(self._make_bio(files))
def groups(self, protocol=None):
"""This function returns the list of groups for this database.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment