diff --git a/gallery_dl/job.py b/gallery_dl/job.py index a64c040f..c43e112d 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -633,7 +633,7 @@ class KeywordJob(Job): def print_kwdict(self, kwdict, prefix="", markers=None): """Print key-value pairs in 'kwdict' with formatting""" write = sys.stdout.write - suffix = "]" if prefix else "" + suffix = "']" if prefix else "" markerid = id(kwdict) if markers is None: @@ -650,13 +650,13 @@ class KeywordJob(Job): key = prefix + key + suffix if isinstance(value, dict): - self.print_kwdict(value, key + "[", markers) + self.print_kwdict(value, key + "['", markers) elif isinstance(value, list): if not value: pass elif isinstance(value[0], dict): - self.print_kwdict(value[0], key + "[N][", markers) + self.print_kwdict(value[0], key + "[N]['", markers) else: fmt = (" {:>%s} {}\n" % len(str(len(value)))).format write(key + "[N]\n") diff --git a/test/test_job.py b/test/test_job.py index 1bd9ccc4..7dc4a44e 100644 --- a/test/test_job.py +++ b/test/test_job.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2021 Mike Fährmann +# Copyright 2021-2023 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -91,9 +91,9 @@ tags[N] 0 foo 1 bar 2 テスト -user[id] +user['id'] 123 -user[name] +user['name'] test """)