Skip to content

Commit

Permalink
sound_card_init_yaml_to_xml.py: Remove parent element for lists
Browse files Browse the repository at this point in the history
serde_xml_rs can parse listed items fine as long as they are listed
consecutively.

Remove the parent element generated when parsing YAML lists.

BUG=b:377624799
TEST=`python3 sound_card_init_yaml_to_xml.py \
      ${SRC}/overlays/overlay-brya/chromeos-base/chromeos-bsp-brya/files \
      ../sound_card_init`

Change-Id: Ia170c245d48e827610452073aa80cc3f68b16b72
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/6060362
Tested-by: [email protected] <[email protected]>
Commit-Queue: Baili Deng <[email protected]>
Reviewed-by: Yu-Hsuan Hsu <[email protected]>
  • Loading branch information
baili0411 authored and Chromeos LUCI committed Dec 2, 2024
1 parent cea8077 commit 835f291
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions devtools/sound_card_init_yaml_to_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def dict_to_xml_element(data, root):
sub_element = ET.SubElement(root, key)
dict_to_xml_element(value, sub_element)
elif isinstance(value, list):
sub_element = ET.SubElement(root, key + '_list')
list_to_xml_element(value, sub_element, key)
list_to_xml_element(value, root, key)
else:
ET.SubElement(root, key).text = str(value)

Expand All @@ -46,7 +45,7 @@ def dict_to_xml(data, output_file):
"you may not use this file except in compliance with the License.\n"
"You may obtain a copy of the License at\n\n"
" http://www.apache.org/licenses/LICENSE-2.0\n\n"
"Unless required by applicable law or agreed to in writing, software \n"
"Unless required by applicable law or agreed to in writing, software\n"
"distributed under the License is distributed on an \"AS IS\" BASIS,\n"
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
"See the License for the specific language governing permissions and\n"
Expand Down

0 comments on commit 835f291

Please sign in to comment.