Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VIGNET Pierre
cadbiom
Commits
b272b829
Commit
b272b829
authored
Oct 26, 2018
by
VIGNET Pierre
Browse files
Fix bug in solutions_2_json: unable to take only one file; add test for valid file/path
parent
0d47bbf3
Changes
2
Hide whitespace changes
Inline
Side-by-side
command_line/cadbiom_cmd/cadbiom_cmd.py
View file @
b272b829
...
@@ -82,8 +82,6 @@ def solutions_2_json(args):
...
@@ -82,8 +82,6 @@ def solutions_2_json(args):
# Module import
# Module import
import
solution_sort
import
solution_sort
params
=
args_to_param
(
args
)
params
=
args_to_param
(
args
)
params
[
'output'
]
=
params
[
'output'
]
if
params
[
'output'
][
-
1
]
==
'/'
\
else
params
[
'output'
]
+
'/'
solution_sort
.
solutions_2_json
(
solution_sort
.
solutions_2_json
(
params
[
'output'
],
params
[
'output'
],
params
[
'chart_file'
],
params
[
'chart_file'
],
...
...
command_line/cadbiom_cmd/solution_sort.py
View file @
b272b829
...
@@ -128,9 +128,12 @@ def solutions_2_json(output_dir, model_file, solution_path, conditions=True):
...
@@ -128,9 +128,12 @@ def solutions_2_json(output_dir, model_file, solution_path, conditions=True):
def
write_json_file
(
decompiled_filename
,
decomp_solutions
):
def
write_json_file
(
decompiled_filename
,
decomp_solutions
):
# Write file
# Write file
with
open
(
decompiled_filename
,
'w'
)
as
f_d
:
with
open
(
decompiled_filename
,
'w'
)
as
f_d
:
json
.
dump
(
decomp_solutions
,
f_d
,
sort_keys
=
True
,
indent
=
4
)
json
.
dump
(
decomp_solutions
,
f_d
,
sort_keys
=
True
,
indent
=
2
)
# Check valid input file/directory
assert
os
.
path
.
isfile
(
solution_path
)
or
os
.
path
.
isdir
(
solution_path
)
# Get transitions from the model
# Get transitions from the model
model_transitions
=
get_transitions_from_model_file
(
model_file
)
model_transitions
=
get_transitions_from_model_file
(
model_file
)
...
...
Write
Preview
Supports
Markdown
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