Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
bioroboticslab
robofish
io
Commits
170bfc8d
Commit
170bfc8d
authored
4 years ago
by
Andi Gerken
Browse files
Options
Downloads
Plain Diff
Merge branch 'error-codes' into 'master'
Fix
#12
: Return error codes instead of ouput text Closes
#12
See merge request
!13
parents
81dec7eb
636b8416
No related branches found
No related tags found
1 merge request
!13
Fix #12: Return error codes instead of ouput text
Pipeline
#37802
passed
4 years ago
Stage: package
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
setup.py
+9
-2
9 additions, 2 deletions
setup.py
src/robofish/io/app.py
+11
-11
11 additions, 11 deletions
src/robofish/io/app.py
tests/robofish/io/test_app_io.py
+2
-2
2 additions, 2 deletions
tests/robofish/io/test_app_io.py
with
22 additions
and
15 deletions
setup.py
+
9
−
2
View file @
170bfc8d
...
@@ -8,7 +8,7 @@ from setuptools import setup, find_packages
...
@@ -8,7 +8,7 @@ from setuptools import setup, find_packages
entry_points
=
{
entry_points
=
{
"
console_scripts
"
:
[
"
console_scripts
"
:
[
"
robofish-io-validate=robofish.io.app:validate
"
,
"
robofish-io-validate=robofish.io.app:validate
"
,
"
robofish-io-print=robofish.io.app:print
"
,
"
robofish-io-print=robofish.io.app:print
_file
"
,
# TODO: This should be called robofish-evaluate which is not possible because of the package name (guess) ask moritzs
# TODO: This should be called robofish-evaluate which is not possible because of the package name (guess) ask moritzs
"
robofish-io-evaluate=robofish.evaluate.app:evaluate
"
,
"
robofish-io-evaluate=robofish.evaluate.app:evaluate
"
,
]
]
...
@@ -48,7 +48,14 @@ setup(
...
@@ -48,7 +48,14 @@ setup(
version
=
source_version
(),
version
=
source_version
(),
author
=
""
,
author
=
""
,
author_email
=
""
,
author_email
=
""
,
install_requires
=
[
"
h5py>=3.1.0
"
,
"
numpy
"
,
"
seaborn
"
,
"
pandas
"
,
"
deprecation
"
],
install_requires
=
[
"
h5py>=3.1.0
"
,
"
numpy
"
,
"
seaborn
"
,
"
pandas
"
,
"
deprecation
"
,
"
tqdm
"
,
],
classifiers
=
[
classifiers
=
[
"
Development Status :: 3 - Alpha
"
,
"
Development Status :: 3 - Alpha
"
,
"
Intended Audience :: Science/Research
"
,
"
Intended Audience :: Science/Research
"
,
...
...
This diff is collapsed.
Click to expand it.
src/robofish/io/app.py
+
11
−
11
View file @
170bfc8d
...
@@ -15,7 +15,7 @@ import argparse
...
@@ -15,7 +15,7 @@ import argparse
import
logging
import
logging
def
print
(
args
=
None
):
def
print
_file
(
args
=
None
):
"""
This function can be used to print hdf5 files from the command line
"""
This function can be used to print hdf5 files from the command line
Returns:
Returns:
...
@@ -39,12 +39,11 @@ def print(args=None):
...
@@ -39,12 +39,11 @@ def print(args=None):
sf
=
robofish
.
io
.
File
(
path
=
args
.
path
,
strict_validate
=
False
)
sf
=
robofish
.
io
.
File
(
path
=
args
.
path
,
strict_validate
=
False
)
output_str
=
sf
.
to_string
(
args
.
output_format
)
print
(
sf
.
to_string
(
args
.
output_format
))
output_str
+=
"
\n
"
print
()
output_str
+=
(
valid
=
sf
.
validate
(
strict_validate
=
False
)[
0
]
"
Valid file
"
if
sf
.
validate
(
strict_validate
=
False
)[
0
]
else
"
Invalid file
"
print
(
"
Valid file
"
if
valid
else
"
Invalid file
"
)
)
return
not
valid
return
output_str
def
validate
(
args
=
None
):
def
validate
(
args
=
None
):
...
@@ -93,10 +92,11 @@ def validate(args=None):
...
@@ -93,10 +92,11 @@ def validate(args=None):
return
sf_dict
return
sf_dict
max_filename_width
=
max
([
len
((
str
)(
f
))
for
f
in
sf_dict
.
keys
()])
max_filename_width
=
max
([
len
((
str
)(
f
))
for
f
in
sf_dict
.
keys
()])
text
=
""
error_code
=
0
for
file
,
sf
in
sf_dict
.
items
():
for
file
,
sf
in
sf_dict
.
items
():
filled_file
=
(
str
)(
file
).
ljust
(
max_filename_width
+
3
)
filled_file
=
(
str
)(
file
).
ljust
(
max_filename_width
+
3
)
validity
,
validity_message
=
sf
.
validate
(
strict_validate
=
False
)
validity
,
validity_message
=
sf
.
validate
(
strict_validate
=
False
)
text
+=
f
"
{
filled_file
}
:
{
validity
}
\t
{
validity_message
}
\n
"
if
not
validity
:
error_code
=
1
return
text
print
(
f
"
{
filled_file
}
:
{
validity
}
\t
{
validity_message
}
"
)
return
error_code
This diff is collapsed.
Click to expand it.
tests/robofish/io/test_app_io.py
+
2
−
2
View file @
170bfc8d
...
@@ -32,9 +32,9 @@ def test_app_print():
...
@@ -32,9 +32,9 @@ def test_app_print():
self
.
path
=
path
self
.
path
=
path
self
.
output_format
=
output_format
self
.
output_format
=
output_format
app
.
print
(
app
.
print
_file
(
DummyArgs
(
utils
.
full_path
(
__file__
,
"
../../resources/valid.hdf5
"
),
"
full
"
)
DummyArgs
(
utils
.
full_path
(
__file__
,
"
../../resources/valid.hdf5
"
),
"
full
"
)
)
)
app
.
print
(
app
.
print
_file
(
DummyArgs
(
utils
.
full_path
(
__file__
,
"
../../resources/valid.hdf5
"
),
"
shape
"
)
DummyArgs
(
utils
.
full_path
(
__file__
,
"
../../resources/valid.hdf5
"
),
"
shape
"
)
)
)
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