summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-08-09 22:54:49 +0300
committerMaxim Devaev <[email protected]>2023-08-09 22:54:49 +0300
commite140b4f29debee6cdb13fbad34ae8062f6b4c6fd (patch)
treefe0b61ad0635aea33dc70c1d2ce1a8ced5a5e675
parentdab99240962beb2818b8f9f7a979f3e9c2c0e288 (diff)
improved outout puf kvmd-otgconf --make-gpio-config
-rw-r--r--kvmd/apps/otgconf/__init__.py19
-rw-r--r--testenv/linters/vulture-wl.py2
2 files changed, 20 insertions, 1 deletions
diff --git a/kvmd/apps/otgconf/__init__.py b/kvmd/apps/otgconf/__init__.py
index 4e429aba..ee0982d2 100644
--- a/kvmd/apps/otgconf/__init__.py
+++ b/kvmd/apps/otgconf/__init__.py
@@ -85,6 +85,23 @@ class _GadgetControl:
print(f"{'+' if enabled else '-'} {meta['func']} # {meta['name']}")
def make_gpio_config(self) -> None:
+ class Dumper(yaml.Dumper):
+ def increase_indent(self, flow: bool=False, indentless: bool=False) -> None:
+ _ = indentless
+ super().increase_indent(flow, False)
+
+ def ignore_aliases(self, data) -> bool: # type: ignore
+ _ = data
+ return True
+
+ class InlineList(list):
+ pass
+
+ def represent_inline_list(dumper: yaml.Dumper, data): # type: ignore
+ return dumper.represent_sequence("tag:yaml.org,2002:seq", data, flow_style=True)
+
+ Dumper.add_representer(InlineList, represent_inline_list)
+
config = {
"drivers": {"otgconf": {"type": "otgconf"}},
"scheme": {},
@@ -102,7 +119,7 @@ class _GadgetControl:
"#" + meta["func"],
meta["func"],
])
- print(yaml.dump({"kvmd": {"gpio": config}}, indent=4))
+ print(yaml.dump({"kvmd": {"gpio": config}}, indent=4, Dumper=Dumper))
def reset(self) -> None:
with self.__udc_stopped():
diff --git a/testenv/linters/vulture-wl.py b/testenv/linters/vulture-wl.py
index 6a947776..326d5c91 100644
--- a/testenv/linters/vulture-wl.py
+++ b/testenv/linters/vulture-wl.py
@@ -52,5 +52,7 @@ _Edid.set_serial
_Edid.set_monitor_name
_Edid.set_audio
+Dumper.ignore_aliases
+
_auth_server_port_fixture
_test_user