Loading data from databases with minimal parameters provided
As of now it seems that we do not have a single way to load a sample in our databases.
The old db's load like this:
db = Database(original_directory='/some/path')
sample = db.objects()[0]
data = sample.load(db.original_directory, db.original_extension)
The current guide advices this:
db = Database(original_directory='/some/path')
sample = db.objects()[0]
data = sample.load()
but this requires changes in all db interfaces because it suggests that each db sample object will carry a reference to original_directory
.
I suggest we do like this:
db = Database(original_directory='/some/path')
sample = db.objects()[0]
data = db.load(sample)
This is similar in how annotations are returned in high-level interfaces and hides away the fact that the database is a file-based one.
It can be easily implemented for all current databases that we have like this:
class bob.db.base.Database:
def load(self, file):
return file.load(self.original_directory, self.original_extension)
What do you think?