From 332ddac905f97d354ee71845d6f6b132a86c4ece Mon Sep 17 00:00:00 2001 From: Marco Herrn Date: Fri, 30 Jun 2023 23:01:16 +0200 Subject: [PATCH] Correctly handle metadata in JSON templates The dict will be copied as is rather than transformed into a list. Closes https://github.com/yskoht/keymapviz/issues/93 --- keymapviz/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keymapviz/__init__.py b/keymapviz/__init__.py index 0b5b126..ffa59ac 100644 --- a/keymapviz/__init__.py +++ b/keymapviz/__init__.py @@ -103,7 +103,7 @@ def __legends(self, keymap): def __json_format(self, json_, keymap): legends = self.__legends(keymap) ret = [[_.format(*legends) if isinstance(_, str) else _ for _ in __] - for __ in json_] + if isinstance(__, list) else __ for __ in json_] with io.StringIO() as sio: json.dump(ret, sio, indent=4) ret_str = sio.getvalue()