utils: raspberrypi: ctt: Fix pycodestyle E302
E302 expected 2 blank lines, found 0 Note that issues are still flagged, due to the use of docstrings as multi-lines comments. This will be addressed separately. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
This commit is contained in:
parent
33c4221e87
commit
e8655c2161
12 changed files with 20 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
#
|
||||
# ctt_pretty_print_json.py - camera tuning tool JSON formatter
|
||||
|
||||
|
||||
"""
|
||||
takes a collapsed json file and makes it more readable
|
||||
"""
|
||||
|
@ -11,10 +12,12 @@ def process_file(string, fout, state):
|
|||
for c in string:
|
||||
process_char(c, fout, state)
|
||||
|
||||
|
||||
def print_newline(fout, state):
|
||||
fout.write('\n')
|
||||
fout.write(' '*state["indent"]*4)
|
||||
|
||||
|
||||
def process_char(c, fout, state):
|
||||
if c == '{':
|
||||
if not state["skipnewline"]:
|
||||
|
@ -61,6 +64,7 @@ def process_char(c, fout, state):
|
|||
fout.write(c)
|
||||
state["skipnewline"] = (c == '[')
|
||||
|
||||
|
||||
def pretty_print_json(str_in, output_filename):
|
||||
state = {"indent": 0, "inarray": [False], "arraycount": [], "skipnewline": True}
|
||||
with open(output_filename, "w") as fout:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue