diff --git a/.gitignore b/.gitignore index 2c31706949f33af3995780d347f97a1e3d0dc6aa..217296866c86503c594cfb0fd1d251b71466e60c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +LOCAL/ build/ dist/ _build @@ -6,3 +7,4 @@ grewpy.native bin MANIFEST *.pyc +UD_French-GSD diff --git a/grew/graph.py b/grew/graph.py index 54d9d5b4ccb23e76025056096ece87d1298fd565..a10edb6341c3c6747703c528cf4a9a6e813efe27 100644 --- a/grew/graph.py +++ b/grew/graph.py @@ -64,6 +64,10 @@ def graph(data=None): raise GrewError('Library call error') +def save(gr, filename): + req = { "command": "save_graph", "graph": json.dumps(gr), "filename": filename } + reply = network.send_and_receive(req) + return def add_node(g, s, a): """ diff --git a/setup.py b/setup.py index 6deb4feaaac2c9fff1e87262713fc6c0a70ef44b..4cabc9bdf394fa4c536b3c4c1852ab59b7b14d34 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setuptools.setup( description="A binding to the Grew software", long_description=long_description, long_description_content_type="text/markdown", - url="http://grew.fr", + url="https://grew.fr", author="bguil", author_email="Bruno.Guillaume@loria.fr" ) diff --git a/src_ocaml/grewpy.ml b/src_ocaml/grewpy.ml index 0e9e97021abb41f5b15515c62d1f53c0d41869f3..f83738700cee7d7df4936c76b0026e5749d3f39f 100644 --- a/src_ocaml/grewpy.ml +++ b/src_ocaml/grewpy.ml @@ -43,6 +43,20 @@ let run_command request = | None -> json_error "no 'filename' in 'load_grs' command" end + (* ======================= save_graph ======================= *) + | Some "save_graph" -> + begin + match ( + json |> member "graph" |> to_string_option, + json |> member "filename" |> to_string_option + ) with + | Some graph, Some filename -> + let gr = Graph.of_json_python ~config (Yojson.Basic.from_string graph) in + Yojson.Basic.to_file filename (Graph.to_json gr); + Yojson.Basic.to_string (`Assoc [("status", `String "OK"); ("data", `Null)]) + | _ -> json_error "incomplete 'save_graph' command" + end + (* ======================= load_grs ======================= *) | Some "load_grs" -> begin