1+ """
2+ Author: Steffen Vogel <[email protected] > 3+ SPDX-FileCopyrightText: 2025 OPAL-RT Germany GmbH
4+ SPDX-License-Identifier: Apache-2.0
5+ """ # noqa: E501
6+
17import argparse
28import sys
39import xml .etree .ElementTree as ET
@@ -14,7 +20,8 @@ def generate_ddf(node_cfg):
1420 Generate an OPAL-RT Orchestra DDF XML file from a VILLASnode configuration.
1521
1622 Args:
17- node_cfg: Dictionary containing the node configuration from VILLASnode config
23+ node_cfg: Dictionary containing the node configuration
24+ from VILLASnode config
1825
1926 Returns:
2027 str: XML-encoded string representing the Orchestra DDF
@@ -65,16 +72,15 @@ def generate_ddf(node_cfg):
6572
6673def add_connection (parent_elem , conn_cfg ):
6774 """
68- Add a connection element to the parent XML element based on connection configuration.
75+ Add a connection element to the parent XML element based
76+ on connection configuration.
6977
7078 Args:
7179 parent_elem: ET.Element to add the connection to
7280 conn_cfg: Dictionary containing connection configuration
7381 """
7482 conn_type = conn_cfg .get ("type" , "local" )
7583
76- conn_attrs = {}
77-
7884 if conn_type == "local" :
7985 conn_elem = ET .SubElement (
8086 parent_elem ,
@@ -118,7 +124,8 @@ def add_signals_to_set(parent_elem, signals, is_publish=True):
118124 Args:
119125 parent_elem: ET.Element to add signals to
120126 signals: List of signal configurations
121- is_publish: Boolean indicating if this is for PUBLISH (True) or SUBSCRIBE (False)
127+ is_publish: Boolean indicating if this is for
128+ PUBLISH (True) or SUBSCRIBE (False)
122129 """
123130 # Group signals by their orchestra names and build nested structure
124131 signal_tree = {}
@@ -155,11 +162,11 @@ def add_signals_to_set(parent_elem, signals, is_publish=True):
155162 else :
156163 if orchestra_type != signal ["type" ]:
157164 raise RuntimeError (
158- f "Conflicting definitions for signal '{ orchestra_name } '"
165+ "Conflicting definitions for signal " + f" '{ orchestra_name } '"
159166 )
160167
161168 index = orchestra_index
162- if index == None :
169+ if index is None :
163170 index = signal ["length" ]
164171
165172 if index >= signal ["length" ]:
@@ -210,7 +217,10 @@ def build_xml_from_tree(parent_elem, tree, is_publish):
210217 else :
211218 default_text = str (default_val )
212219 else :
213- default_text = "0" if signal ["type" ] != "boolean" else "no"
220+ if signal ["type" ] == "boolean" :
221+ default_text = "no"
222+ else :
223+ default_text = "0"
214224 ET .SubElement (item , "default" ).text = default_text
215225 elif children :
216226 # This is a bus without direct signals
0 commit comments