Commit 3b6cfe07 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch...

Merge branch '88-there-is-absolutely-no-need-for-having-a-client-class-in-the-filelistdatabase-implementation' into 'master'

Resolve "There is absolutely no need for having a "Client" class in the FileListDatabase implementation"

Closes #88

See merge request !95
parents 73171120 f27b6449
Pipeline #12015 failed with stages
in 16 minutes and 7 seconds
...@@ -2,8 +2,7 @@ from .file import BioFile ...@@ -2,8 +2,7 @@ from .file import BioFile
from .file import BioFileSet from .file import BioFileSet
from .database import BioDatabase from .database import BioDatabase
from .database import ZTBioDatabase from .database import ZTBioDatabase
from .filelist.query import FileListBioDatabase from .filelist import FileListBioDatabase
from .filelist.models import Client
from . import filelist from . import filelist
# gets sphinx autodoc done right - don't remove it # gets sphinx autodoc done right - don't remove it
...@@ -27,7 +26,6 @@ __appropriate__( ...@@ -27,7 +26,6 @@ __appropriate__(
BioFileSet, BioFileSet,
BioDatabase, BioDatabase,
ZTBioDatabase, ZTBioDatabase,
FileListBioDatabase, FileListBioDatabase
Client,
) )
__all__ = [_ for _ in dir() if not _.startswith('_')] __all__ = [_ for _ in dir() if not _.startswith('_')]
...@@ -5,21 +5,24 @@ import bob.db.base ...@@ -5,21 +5,24 @@ import bob.db.base
class BioFile(bob.db.base.File): class BioFile(bob.db.base.File):
"""A simple base class that defines basic properties of File object for the use in verification experiments""" """A simple base class that defines basic properties of File object for the use in verification experiments
def __init__(self, client_id, path, file_id=None): Parameters
"""**Constructor Documentation** ----------
client_id : object
The id of the client this file belongs to.
Its type depends on your implementation.
If you use an SQL database, this should be an SQL type like Integer or String.
Initialize the File object with the minimum required data. file_id : object
see :py:class:`bob.db.base.File` constructor
Parameters: path : object
see :py:class:`bob.db.base.File` constructor
"""
client_id : various type def __init__(self, client_id, path, file_id=None):
The id of the client this file belongs to.
Its type depends on your implementation.
If you use an SQL database, this should be an SQL type like Integer or String.
For path and file_id, please refer to :py:class:`bob.db.base.File` constructor
"""
bob.db.base.File.__init__(self, path, file_id) bob.db.base.File.__init__(self, path, file_id)
# just copy the information # just copy the information
...@@ -34,18 +37,18 @@ class BioFileSet(BioFile): ...@@ -34,18 +37,18 @@ class BioFileSet(BioFile):
type :py:class:`bob.bio.base.database.BioFile` of the same client. type :py:class:`bob.bio.base.database.BioFile` of the same client.
The file set id can be anything hashable, but needs to be unique all over the database. The file set id can be anything hashable, but needs to be unique all over the database.
**Parameters:** Parameters
----------
file_set_id : str or int file_set_id : str or int
A unique ID that identifies the file set. A unique ID that identifies the file set.
files : [:py:class:`bob.bio.base.database.BioFile`] files : [:py:class:`bob.bio.base.database.BioFile`]
A non-empty list of BioFile objects that should be stored inside this file. A non-empty list of BioFile objects that should be stored inside this file.
All files of that list need to have the same client ID. All files of that list need to have the same client ID.
""" """
def __init__(self, file_set_id, files, path=None): def __init__(self, file_set_id, files, path=None):
"""The list of :py:class:`bob.bio.base.database.BioFile` objects stored in this file set"""
# don't accept empty file lists # don't accept empty file lists
assert len(files), "Cannot create an empty BioFileSet" assert len(files), "Cannot create an empty BioFileSet"
......
from .models import ListReader, Client, FileListFile from .models import FileListFile
from .query import FileListBioDatabase from .query import FileListBioDatabase
from .driver import Interface from .driver import Interface
...@@ -20,8 +20,6 @@ def __appropriate__(*args): ...@@ -20,8 +20,6 @@ def __appropriate__(*args):
__appropriate__( __appropriate__(
ListReader,
Client,
FileListFile, FileListFile,
FileListBioDatabase, FileListBioDatabase,
Interface, Interface,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
This file defines simple Client and File interfaces that are comparable with other bob.db databases. This file defines a simple interface that are comparable with other bob.db databases.
""" """
import os import os
...@@ -26,16 +26,6 @@ import fileinput ...@@ -26,16 +26,6 @@ import fileinput
import re import re
class Client(object):
"""
The clients of this database contain ONLY client ids. Nothing special.
"""
def __init__(self, client_id):
self.id = client_id
"""The ID of the client, which is stored as a :py:class:`str` object."""
class FileListFile(object): class FileListFile(object):
""" """
Initialize the File object with the minimum required data. Initialize the File object with the minimum required data.
...@@ -43,16 +33,19 @@ class FileListFile(object): ...@@ -43,16 +33,19 @@ class FileListFile(object):
If the ``model_id`` is not specified, ``model_id`` and ``client_id`` are identical. If the ``model_id`` is not specified, ``model_id`` and ``client_id`` are identical.
If the ``claimed_id`` is not specified, it is expected to be the ``client_id``. If the ``claimed_id`` is not specified, it is expected to be the ``client_id``.
**Parameters** Parameters
----------
client_id : various type client_id : various type
The id of the client, this file belongs to. The id of the client, this file belongs to.
The type of it is dependent on your implementation. The type of it is dependent on your implementation.
If you use an SQL database, this should be an SQL type like Integer or String. If you use an SQL database, this should be an SQL type like Integer or String.
path : str path : str
The path of this file, relative to the basic directory. The path of this file, relative to the basic directory.
If you use an SQL database, this should be the SQL type String. If you use an SQL database, this should be the SQL type String.
Please do not specify any file extensions. Please do not specify any file extensions.
file_id : various type file_id : various type
The id of the file. The id of the file.
The type of it is dependent on your implementation. The type of it is dependent on your implementation.
......
This diff is collapsed.
...@@ -28,8 +28,10 @@ Implementations ...@@ -28,8 +28,10 @@ Implementations
bob.bio.base.algorithm.LDA bob.bio.base.algorithm.LDA
bob.bio.base.algorithm.PLDA bob.bio.base.algorithm.PLDA
bob.bio.base.algorithm.BIC bob.bio.base.algorithm.BIC
bob.bio.base.database.BioFile
bob.bio.base.database.BioDatabase bob.bio.base.database.BioDatabase
bob.bio.base.database.ZTBioDatabase bob.bio.base.database.ZTBioDatabase
bob.bio.base.database.FileListBioDatabase
Preprocessors Preprocessors
......
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