From 417c842f8a616b49d8b4f096ed2452de8ed1622e Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Fri, 5 Aug 2022 18:45:48 +0200 Subject: [PATCH] Add suggestions from #186 --- src/wireviz/wv_dataclasses.py | 2 +- src/wireviz/wv_utils.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wireviz/wv_dataclasses.py b/src/wireviz/wv_dataclasses.py index 2b5ef87c..3081ae49 100644 --- a/src/wireviz/wv_dataclasses.py +++ b/src/wireviz/wv_dataclasses.py @@ -747,7 +747,7 @@ def __post_init__(self) -> None: if self.show_name is None: self.show_name = not self.is_autogenerated - if not self.show_wirenumbers: + if self.show_wirenumbers is None: # by default, show wire numbers for cables, hide for bundles self.show_wirenumbers = self.category != "bundle" diff --git a/src/wireviz/wv_utils.py b/src/wireviz/wv_utils.py index a2bff03f..58209e12 100644 --- a/src/wireviz/wv_utils.py +++ b/src/wireviz/wv_utils.py @@ -70,9 +70,10 @@ def expand(yaml_data): def get_single_key_and_value(d: dict): - k = list(d.keys())[0] - v = d[k] - return (k, v) + # used for defining a line in a harness' connection set + # E.g. for the YAML input `- X1: 1` + # this function returns a tuple in the form ("X1", "1") + return next(iter(d.items())) def int2tuple(inp):