Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.io.base
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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.io.base
Commits
cf9aa2d4
Commit
cf9aa2d4
authored
2 years ago
by
Yannick DAYER
Browse files
Options
Downloads
Patches
Plain Diff
[doc] Add external docs links and fix wrong refs.
parent
9d8c8d29
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!45
Switch to the new package structure using citools
Pipeline
#66602
failed
2 years ago
Stage: qa
Stage: test
Stage: doc
Stage: dist
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/conf.py
+3
-0
3 additions, 0 deletions
doc/conf.py
src/bob/io/base/__init__.py
+11
-23
11 additions, 23 deletions
src/bob/io/base/__init__.py
src/bob/io/image.py
+2
-2
2 additions, 2 deletions
src/bob/io/image.py
with
16 additions
and
25 deletions
doc/conf.py
+
3
−
0
View file @
cf9aa2d4
...
@@ -109,4 +109,7 @@ autodoc_default_options = {
...
@@ -109,4 +109,7 @@ autodoc_default_options = {
intersphinx_mapping
=
{
intersphinx_mapping
=
{
"
python
"
:
(
"
https://docs.python.org/3
"
,
None
),
"
python
"
:
(
"
https://docs.python.org/3
"
,
None
),
"
scipy
"
:
(
"
https://docs.scipy.org/doc/scipy/
"
,
None
),
"
scipy
"
:
(
"
https://docs.scipy.org/doc/scipy/
"
,
None
),
"
numpy
"
:
(
"
https://numpy.org/doc/stable/
"
,
None
),
"
matplotlib
"
:
(
"
https://matplotlib.org/stable/
"
,
None
),
"
PIL
"
:
(
"
https://pillow.readthedocs.io/en/latest/
"
,
None
),
}
}
This diff is collapsed.
Click to expand it.
src/bob/io/base/__init__.py
+
11
−
23
View file @
cf9aa2d4
...
@@ -58,10 +58,8 @@ def create_directories_safe(directory, dryrun=False):
...
@@ -58,10 +58,8 @@ def create_directories_safe(directory, dryrun=False):
os
.
makedirs
(
directory
,
exist_ok
=
True
)
os
.
makedirs
(
directory
,
exist_ok
=
True
)
def
open_file
(
filename
):
def
open_file
(
filename
)
->
np
.
ndarray
:
"""
open_file(filename) -> file.
"""
Reads a file content.
Opens a file for reading.
Parameters
Parameters
----------
----------
...
@@ -118,10 +116,8 @@ def open_file(filename):
...
@@ -118,10 +116,8 @@ def open_file(filename):
raise
ValueError
(
f
"
Unknown file extension:
{
extension
}
"
)
raise
ValueError
(
f
"
Unknown file extension:
{
extension
}
"
)
def
write_file
(
filename
,
data
,
format
=
"
pillow
"
):
def
write_file
(
filename
,
data
,
format
=
"
pillow
"
)
->
None
:
"""
write_file(filename, data) -> None.
"""
Writes the contents of a :py:class:`numpy.ndarray` to a file.
Writes the contents of a :py:class:`numpy.ndarray` to a file.
Parameters
Parameters
----------
----------
...
@@ -150,11 +146,11 @@ def write_file(filename, data, format="pillow"):
...
@@ -150,11 +146,11 @@ def write_file(filename, data, format="pillow"):
raise
RuntimeError
(
f
"
Unknown file extension:
{
extension
}
"
)
raise
RuntimeError
(
f
"
Unknown file extension:
{
extension
}
"
)
def
load
(
inputs
):
def
load
(
inputs
)
->
np
.
ndarray
:
"""
l
oad
(inputs) -> data
.
"""
L
oad
s the content of a file
.
Loads the contents of a file, an iterable of files, or an iterable of
Will take a filename (or an iterable of filenames) and put the content into a
:class:`File` objects into a
:py:class:`numpy.ndarray`.
:py:class:`numpy.ndarray`.
**Parameters:**
**Parameters:**
...
@@ -169,13 +165,6 @@ def load(inputs):
...
@@ -169,13 +165,6 @@ def load(inputs):
would assume that each file contains a single 1D sample or a set of 1D
would assume that each file contains a single 1D sample or a set of 1D
samples, load them in memory and concatenate them into a single and
samples, load them in memory and concatenate them into a single and
returned 2D :py:class:`numpy.ndarray`.
returned 2D :py:class:`numpy.ndarray`.
3. An iterable of :py:class:`File`. In this case, this would assume
that each :py:class:`File` contains a single 1D sample or a set
of 1D samples, load them in memory if required and concatenate them into
a single and returned 2D :py:class:`numpy.ndarray`.
4. An iterable with mixed filenames and :py:class:`File`. In this
case, this would returned a 2D :py:class:`numpy.ndarray`, as described
by points 2 and 3 above.
**Returns:**
**Returns:**
...
@@ -208,16 +197,15 @@ def load(inputs):
...
@@ -208,16 +197,15 @@ def load(inputs):
else
:
else
:
raise
TypeError
(
raise
TypeError
(
"
Unexpected input object. This function is expecting a filename,
"
"
Unexpected input object. This function is expecting a filename,
"
"
or an iterable of filenames
and/or File objects
.
"
"
or an iterable of filenames.
"
)
)
def
save
(
array
,
filename
,
create_directories
=
False
):
def
save
(
array
,
filename
,
create_directories
=
False
):
"""
Saves the contents of an array-like object to file.
"""
Saves the contents of an array-like object to file.
Effectively, this is the same as creating a :py:class:`File` object
Effectively, this is the same as opening a file with the mode flag set to ``
'
w
'
``
with the mode flag set to ``
'
w
'
`` (write with truncation) and calling
(write with truncation) and calling ``file.write`` passing ``array`` as parameter.
:py:meth:`File.write` passing ``array`` as parameter.
Parameters:
Parameters:
...
...
This diff is collapsed.
Click to expand it.
src/bob/io/image.py
+
2
−
2
View file @
cf9aa2d4
...
@@ -57,7 +57,7 @@ def bob_to_pillow(img):
...
@@ -57,7 +57,7 @@ def bob_to_pillow(img):
Returns
Returns
-------
-------
Image
PIL.Image.
Image
An object of pillow.Image.
An object of pillow.Image.
"""
"""
# first convert to matplotlib format
# first convert to matplotlib format
...
@@ -78,7 +78,7 @@ def pillow_to_bob(img):
...
@@ -78,7 +78,7 @@ def pillow_to_bob(img):
Parameters
Parameters
----------
----------
img
: Image
img:
PIL.Image.
Image
A Pillow Image
A Pillow Image
Returns
Returns
...
...
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