From 888bd52677248549f5c0657d992e81d7edf6ba9d Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Tue, 7 Nov 2023 13:28:32 +0000 Subject: [PATCH] feat(graph-generator): allow passing kwargs to GraphVizHandler So that it can be used via pyneuroml without requiring users to figure out how to use it through neuromllite --- pyneuroml/pynml.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pyneuroml/pynml.py b/pyneuroml/pynml.py index 6d0258731..703e54022 100644 --- a/pyneuroml/pynml.py +++ b/pyneuroml/pynml.py @@ -602,12 +602,22 @@ def convert_to_units(nml2_quantity: str, unit: str) -> float: return new_value -def generate_nmlgraph(nml2_file_name: str, level: int = 1, engine: str = "dot") -> None: +def generate_nmlgraph( + nml2_file_name: str, level: int = 1, engine: str = "dot", **kwargs +) -> None: """Generate NeuroML graph. - :nml2_file_name (string): NML file to parse - :level (string): level of graph to generate (default: '1') - :engine (string): graph engine to use (default: 'dot') + :param nml2_file_name: NML file to parse + :type nml2_file_name: str + :param level: level of graph to generate (default: '1') + :type level: int + :param engine: graph engine to use (default: 'dot') + :type engine: str + :param kwargs: other key word agruments to pass to GraphVizHandler + See the GraphVizHandler in NeuroMLlite for information on permissible + arguments: + https://github.com/NeuroML/NeuroMLlite/blob/master/neuromllite/GraphVizHandler.py + """ from neuromllite.GraphVizHandler import GraphVizHandler @@ -618,7 +628,7 @@ def generate_nmlgraph(nml2_file_name: str, level: int = 1, engine: str = "dot") % (nml2_file_name, level, engine) ) - handler = GraphVizHandler(level=level, engine=engine, nl_network=None) + handler = GraphVizHandler(level=level, engine=engine, nl_network=None, **kwargs) currParser = NeuroMLXMLParser(handler) currParser.parse(nml2_file_name) handler.finalise_document()