Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.stream
Commits
0358e8f5
Commit
0358e8f5
authored
Sep 08, 2020
by
Vincent POLLET
Browse files
Remove handle_file indicator, bob.io.base.HDF5File files must be managed by StreamFile.
parent
3b41869d
Pipeline
#42528
canceled with stage
in 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/io/stream/stream_file.py
View file @
0358e8f5
...
...
@@ -11,10 +11,8 @@ class StreamFile:
def
__init__
(
self
,
hdf5_file
=
None
,
data_format_config_file_path
=
None
,
camera_config_file_path
=
None
,
mode
=
"r"
):
if
isinstance
(
hdf5_file
,
str
):
# case string: it is a path, use bob.io.base.HDF5File
self
.
hdf5_file
=
HDF5File
(
hdf5_file
,
mode
)
self
.
handle_file
=
True
elif
hdf5_file
is
not
None
:
# otherwise expect a file object (bob.io.base.HDF5File, h5py.File, etc...)
elif
hdf5_file
is
not
None
:
# otherwise expect an opened file object (h5py.File, etc...)
self
.
hdf5_file
=
hdf5_file
self
.
handle_file
=
False
# do not handle opening or closing the actual file object
else
:
self
.
hdf5_file
=
None
if
data_format_config_file_path
is
not
None
:
...
...
@@ -30,7 +28,7 @@ class StreamFile:
pass
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
if
self
.
hdf5_file
is
not
None
and
self
.
handle_file
:
if
isinstance
(
self
.
hdf5_file
,
HDF5File
)
:
self
.
hdf5_file
.
close
()
# set source
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment