MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

Commit ae0f47fe authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[cmd] add json, graphs, csv options to queries_2_common_graph; add checking...

[cmd] add json, graphs, csv options to queries_2_common_graph; add checking routines to force at least 1 flag
parent 7d9f163c
......@@ -34,6 +34,7 @@ from functools import wraps
import cadbiom.commons as cm
LOGGER = cm.logger()
parser = None
def check_output_dir(function):
......@@ -146,11 +147,9 @@ def queries_2_common_graph(args):
# Module import
import solution_sort
if not any((args["graphs"], args["csv"], args["json"])):
parser.error("at least one flag is required")
......@@ -337,6 +336,7 @@ def main():
"""Argument parser"""
# parser configuration
global parser
parser = argparse.ArgumentParser(description=__doc__)
# Default log level: debug
parser.add_argument('-vv', '--verbose', nargs='?', default='info')
......@@ -477,6 +477,15 @@ def main():
help="Complete solution file or directory with MAC solutions files "
"(*mac_complete.txt files) generated with the 'compute_macs' command.")
# Outputs
parser_trajectories.add_argument('--graphs', action='store_true',
help="Create a GraphML file for each MAC file.")
parser_trajectories.add_argument('--csv', action='store_true',
help="Create a CSV file containing a summary about places/entities "
"of the solutions.")
parser_trajectories.add_argument('--json', action='store_true',
help="Create a JSON formated file containing a summary about "
"places/entities of the solutions.")
parser_trajectories.add_argument('--output', action=ReadableDir,
nargs='?', default='graphs/',
help="Output directory for GraphML files.")
......@@ -346,7 +346,8 @@ def get_solution_graphs(sol_steps, transitions):
def queries_2_common_graph(output_dir, model_file, path,
make_graphs=True, make_csv=False, make_json=False):
make_graphs=True, make_csv=False, make_json=False,
*args, **kwargs):
"""Entry point for solutions_2_common_graph
Create a GraphML formated file containing a unique representation of **all**
......@@ -483,6 +484,11 @@ def queries_2_common_graph(output_dir, model_file, path,
# Check valid input file/directory
assert os.path.isfile(path) or os.path.isdir(path)
# Bind arguments to avoid overwriting previous imports
make_graphs = kwargs['graphs']
make_json = kwargs['json']
make_csv = kwargs['csv']
# Get transitions from the model
model_transitions, parser = get_transitions_from_model_file(model_file)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment