Commit 362b118f authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Merge branch 'p-1' into 'master'

Do not use kwargs for pretty printing

See merge request !21
parents 1475c8ea b5bd1703
Pipeline #14378 passed with stages
in 13 minutes and 2 seconds
......@@ -104,12 +104,7 @@ class FileListPadDatabase(PadDatabase, FileListBioDatabase):
keep_read_lists_in_memory=True,
**kwargs
):
"""We call PadDatabase.__init__() instead of super() because of we do not want
bob.bio.base.database.FileListBioDatabase.__init__() to be called by super().
bob.bio.base.database.FileListBioDatabase depends on bob.bio.base.database.ZTBioDatabase, which would
throw an exception, since we do not implement here methods for ZT-based metric."""
PadDatabase.__init__(self,
super(FileListPadDatabase, self).__init__(
name=name,
protocol=protocol,
original_directory=original_directory,
......@@ -118,13 +113,15 @@ class FileListPadDatabase(PadDatabase, FileListBioDatabase):
annotation_extension=annotation_extension,
annotation_type=annotation_type,
filelists_directory=filelists_directory,
# extra args for pretty printing
train_sub_directory=train_subdir,
dev_sub_directory=dev_subdir,
eval_sub_directory=eval_subdir,
real_filename=real_filename,
attack_filename=attack_filename,
**kwargs)
# extra args for pretty printing
self._kwargs.update(dict(
train_sub_directory=train_subdir,
real_filename=real_filename,
attack_filename=attack_filename,
))
self.pad_file_class = pad_file_class
self.list_readers = {}
......
......@@ -28,14 +28,16 @@ class TestFileSql (Base, bob.pad.base.database.PadFile):
path = Column(String(100), unique=True)
def __init__(self):
bob.pad.base.database.PadFile.__init__(self, client_id=5, path="test/path")
bob.pad.base.database.PadFile.__init__(
self, client_id=5, path="test/path")
def create_database():
if os.path.exists(dbfile):
os.remove(dbfile)
import bob.db.base.utils
engine = bob.db.base.utils.create_engine_try_nolock('sqlite', dbfile, echo=True)
engine = bob.db.base.utils.create_engine_try_nolock(
'sqlite', dbfile, echo=True)
Base.metadata.create_all(engine)
session = bob.db.base.utils.session('sqlite', dbfile, echo=True)
session.add(TestFileSql())
......@@ -48,9 +50,11 @@ def create_database():
class TestDatabaseSql (bob.pad.base.database.PadDatabase, bob.db.base.SQLiteBaseDatabase):
def __init__(self):
bob.pad.base.database.PadDatabase.__init__(self, 'pad_test',
original_directory="original/directory", original_extension=".orig")
bob.db.base.SQLiteBaseDatabase.__init__(self, dbfile, TestFileSql)
super(TestDatabaseSql, self).__init__(
name='pad_test',
original_directory="original/directory",
original_extension=".orig", sqlite_file=dbfile,
file_class=TestFileSql)
def groups(self, protocol=None):
return ['group']
......@@ -61,4 +65,5 @@ class TestDatabaseSql (bob.pad.base.database.PadDatabase, bob.db.base.SQLiteBase
def annotations(self, file):
return None
database = TestDatabaseSql()
\ No newline at end of file
database = TestDatabaseSql()
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