Skip to content
Snippets Groups Projects
Commit a5eb55f5 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[database] Added missing doc and fixed doc related warnings

parent e6af7edc
Branches
Tags
2 merge requests!17Merge development branch 1.5.x,!13Improve documentation
......@@ -26,7 +26,13 @@
###############################################################################
"""Validation of databases"""
"""
========
database
========
Validation of databases
"""
import os
import sys
......@@ -70,7 +76,8 @@ class Storage(utils.CodeStorage):
path = os.path.join(self.prefix, 'databases', name + '.json')
path = path[:-5]
super(Storage, self).__init__(path, 'python') #views are coded in Python
# views are coded in Python
super(Storage, self).__init__(path, 'python')
# ----------------------------------------------------------
......@@ -330,8 +337,9 @@ class Database(object):
@property
def valid(self):
return not bool(self.errors)
"""A boolean that indicates if this database is valid or not"""
return not bool(self.errors)
@property
def protocols(self):
......@@ -380,13 +388,15 @@ class Database(object):
Parameters:
protocol (str): The name of the protocol where to retrieve the view from
protocol (str): The name of the protocol where to retrieve the view
from
name (str): The name of the set in the protocol where to retrieve the
view from
exc (:std:term:`class`): If passed, must be a valid exception class
that will be used to report errors in the read-out of this database's view.
that will be used to report errors in the read-out of this
database's view.
Returns:
......@@ -407,7 +417,8 @@ class Database(object):
raise RuntimeError(message)
# loads the module only once through the lifetime of the database object
# loads the module only once through the lifetime of the database
# object
try:
if not hasattr(self, '_module'):
self._module = loader.load_module(self.name.replace(os.sep, '_'),
......@@ -432,7 +443,8 @@ class Database(object):
Parameters:
indent (int): The number of indentation spaces at every indentation level
indent (int): The number of indentation spaces at every indentation
level
Returns:
......@@ -515,8 +527,8 @@ class View(object):
"""Returns a list of (named) tuples describing the data provided by the view.
The ordering of values inside the tuples is free, but it is expected
that the list is ordered in a consistent manner (ie. all train images of
person A, then all train images of person B, ...).
that the list is ordered in a consistent manner (ie. all train images
of person A, then all train images of person B, ...).
For instance, assuming a view providing that kind of data:
......@@ -558,7 +570,7 @@ class View(object):
def setup(self, root_folder, parameters, objs, start_index=None, end_index=None):
# Initialisations
# Initialisation
self.root_folder = root_folder
self.parameters = parameters
self.objs = objs
......@@ -571,9 +583,10 @@ class View(object):
def get(self, output, index):
"""Returns the data of the provided output at the provided index in the list
of (named) tuples describing the data provided by the view (accessible at
self.objs)"""
"""Returns the data of the provided output at the provided index in the
list of (named) tuples describing the data provided by the view
(accessible at self.objs)
"""
raise NotImplementedError
......@@ -807,7 +820,8 @@ class DatabaseTester:
# Compute the next data index that should be produced
next_index = 1 + min([ x.written_data[-1][1] for x in outputs if x.isConnected() ])
# Compute the next data index that should be produced by each connected output
# Compute the next data index that should be produced by each
# connected output
for name in connected_outputs.keys():
if name not in self.irregular_outputs:
if next_index == next_expected_indices[name] + connected_outputs[name]:
......@@ -827,7 +841,8 @@ class DatabaseTester:
assert(outputs[name].written_data[-1][1] == next_index - 1)
# Generate a text file with lots of details (only if all outputs are connected)
# Generate a text file with lots of details (only if all outputs are
# connected)
if len(connected_outputs) == len(self.outputs_declaration):
sorted_outputs = sorted(outputs, key=lambda x: len(x.written_data))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment