Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.backend.python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.backend.python
Commits
a5eb55f5
Commit
a5eb55f5
authored
7 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Patches
Plain Diff
[database] Added missing doc and fixed doc related warnings
parent
e6af7edc
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!17
Merge development branch 1.5.x
,
!13
Improve documentation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/backend/python/database.py
+39
-24
39 additions, 24 deletions
beat/backend/python/database.py
with
39 additions
and
24 deletions
beat/backend/python/database.py
+
39
−
24
View file @
a5eb55f5
...
...
@@ -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
):
# Initialisation
s
# 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
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment