mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
update -K output to include quotes around keys
This commit is contained in:
parent
fe41a2b159
commit
2ab66ad899
@ -633,7 +633,7 @@ class KeywordJob(Job):
|
|||||||
def print_kwdict(self, kwdict, prefix="", markers=None):
|
def print_kwdict(self, kwdict, prefix="", markers=None):
|
||||||
"""Print key-value pairs in 'kwdict' with formatting"""
|
"""Print key-value pairs in 'kwdict' with formatting"""
|
||||||
write = sys.stdout.write
|
write = sys.stdout.write
|
||||||
suffix = "]" if prefix else ""
|
suffix = "']" if prefix else ""
|
||||||
|
|
||||||
markerid = id(kwdict)
|
markerid = id(kwdict)
|
||||||
if markers is None:
|
if markers is None:
|
||||||
@ -650,13 +650,13 @@ class KeywordJob(Job):
|
|||||||
key = prefix + key + suffix
|
key = prefix + key + suffix
|
||||||
|
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
self.print_kwdict(value, key + "[", markers)
|
self.print_kwdict(value, key + "['", markers)
|
||||||
|
|
||||||
elif isinstance(value, list):
|
elif isinstance(value, list):
|
||||||
if not value:
|
if not value:
|
||||||
pass
|
pass
|
||||||
elif isinstance(value[0], dict):
|
elif isinstance(value[0], dict):
|
||||||
self.print_kwdict(value[0], key + "[N][", markers)
|
self.print_kwdict(value[0], key + "[N]['", markers)
|
||||||
else:
|
else:
|
||||||
fmt = (" {:>%s} {}\n" % len(str(len(value)))).format
|
fmt = (" {:>%s} {}\n" % len(str(len(value)))).format
|
||||||
write(key + "[N]\n")
|
write(key + "[N]\n")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
# 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
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
@ -91,9 +91,9 @@ tags[N]
|
|||||||
0 foo
|
0 foo
|
||||||
1 bar
|
1 bar
|
||||||
2 テスト
|
2 テスト
|
||||||
user[id]
|
user['id']
|
||||||
123
|
123
|
||||||
user[name]
|
user['name']
|
||||||
test
|
test
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user