Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.db.replay
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.db.replay
Commits
8e8f16b5
Commit
8e8f16b5
authored
12 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Adds load method to File
parent
9312f570
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
xbob/db/replay/models.py
+23
-4
23 additions, 4 deletions
xbob/db/replay/models.py
xbob/db/replay/query.py
+1
-15
1 addition, 15 deletions
xbob/db/replay/query.py
with
24 additions
and
19 deletions
xbob/db/replay/models.py
+
23
−
4
View file @
8e8f16b5
...
...
@@ -13,6 +13,7 @@ import bob.db.utils
from
sqlalchemy.orm
import
backref
from
sqlalchemy.ext.declarative
import
declarative_base
import
numpy
import
bob
Base
=
declarative_base
()
...
...
@@ -163,6 +164,24 @@ class File(Base):
raise
RuntimeError
,
"
%s is not an attack
"
%
self
return
self
.
attack
[
0
]
def
load
(
self
,
directory
=
None
,
extension
=
'
.hdf5
'
):
"""
Loads the data at the specified location and using the given extension.
Keyword parameters:
data
The data blob to be saved (normally a :py:class:`numpy.ndarray`).
directory
[optional] If not empty or None, this directory is prefixed to the final
file destination
extension
[optional] The extension of the filename - this will control the type of
output and the codec for saving the input blob.
"""
return
bob
.
io
.
load
(
self
.
make_path
(
directory
,
extension
))
def
save
(
self
,
data
,
directory
=
None
,
extension
=
'
.hdf5
'
):
"""
Saves the input data at the specified location and using the given
extension.
...
...
@@ -173,12 +192,12 @@ class File(Base):
The data blob to be saved (normally a :py:class:`numpy.ndarray`).
directory
If not empty or None, this directory is prefixed to the final
file
destination
[optional]
If not empty or None, this directory is prefixed to the final
file
destination
extension
The extension of the filename - this will control the type of
output and
the codec for saving the input blob.
[optional]
The extension of the filename - this will control the type of
output and
the codec for saving the input blob.
"""
path
=
self
.
make_path
(
directory
,
extension
)
...
...
This diff is collapsed.
Click to expand it.
xbob/db/replay/query.py
+
1
−
15
View file @
8e8f16b5
...
...
@@ -210,23 +210,9 @@ class Database(object):
return
self
.
session
.
query
(
Client
).
filter
(
Client
.
id
==
id
).
count
()
!=
0
def
protocols
(
self
):
"""
Returns the names of all registered protocols
.. deprecated:: 1.1.0
This function is *deprecated*, use :py:meth:`.Database.protos` instead.
"""
Returns all protocol objects.
"""
import
warnings
warnings
.
warn
(
"
The method Database.protocols() is deprecated, use Database.protos() for more powerful object retrieval
"
,
DeprecationWarning
)
self
.
assert_validity
()
return
tuple
([
k
.
name
for
k
in
self
.
session
.
query
(
Protocol
)])
def
protos
(
self
):
"""
Returns all registered protocols
"""
self
.
assert_validity
()
return
list
(
self
.
session
.
query
(
Protocol
))
...
...
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