diff --git a/aidge_core/show_graphview.py b/aidge_core/show_graphview.py index ee7908b12daf8bf400d39c99b2505eac243dbd44..b8521d2c06387cad779d9e0f577337a4c2764e0f 100644 --- a/aidge_core/show_graphview.py +++ b/aidge_core/show_graphview.py @@ -177,14 +177,14 @@ def _write_dict_json(graphview_dict : dict[str, int, float, bool, None], json_pa return None -def gview_to_json(gview : aidge_core.GraphView, json_path : str, write_trainable_params_embed : bool = False, write_trainable_params_ext : bool = False, params_file_format : str = 'json') -> None: +def gview_to_json(gview : aidge_core.GraphView, json_path : Path, write_trainable_params_embed : bool = False, write_trainable_params_ext : bool = False, params_file_format : str = 'json') -> None: """ Generates the description for a GraphView in the JSON format. :param graph: A GraphView of Aidge. :type graph: aidge_core.GraphView :param json_path: Path to write JSON file. - :type json_path: str + :type json_path: Path :param write_trainable_params_embed: Whether or not to write the eventual trainable parameters of the Nodes in the same file as the dict (embed). :type write_trainable_params_embed: bool, optional :param write_trainable_params_ext: Whether or not to write the eventual trainable parameters of the Nodes in an external file. diff --git a/aidge_core/unit_tests/test_show_graphview.py b/aidge_core/unit_tests/test_show_graphview.py index 58547301230f589723615e88f35358f470b536f5..4c68e93e39a543e96c2b664dbe554660bf37cc91 100644 --- a/aidge_core/unit_tests/test_show_graphview.py +++ b/aidge_core/unit_tests/test_show_graphview.py @@ -3,6 +3,7 @@ import tempfile import unittest import builtins import aidge_core +from pathlib import Path from aidge_core.show_graphview import gview_to_json def create_gview(): @@ -64,9 +65,9 @@ class test_show_gview(unittest.TestCase): gview = create_gview() # Create temporary file to store JSON model description - model_description_file = tempfile.NamedTemporaryFile(mode="w+") + model_description_file = tempfile.NamedTemporaryFile(mode="w+", suffix='.json') - gview_to_json(gview, model_description_file.name) + gview_to_json(gview, Path(model_description_file.name)) # Load JSON with open(model_description_file.name, 'r') as fp: