[libcamera-devel] [PATCH 05/10] utils: raspberrypi: ctt: json_pretty_print: Skip all spaces

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Jul 3 02:14:17 CEST 2020


Skip all white space characters, not just ' '. This makes a difference
if the input JSON data is already formatted.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 utils/raspberrypi/ctt/ctt_pretty_print_json.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py
index 3de8c108f01c..dfa99a6d4034 100644
--- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py
+++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py
@@ -52,8 +52,6 @@ class JSONPrettyPrinter(object):
         elif c == ':':
             self.fout.write(c)
             self.fout.write(' ')
-        elif c == ' ':
-            pass
         elif c == ',':
             if not self.state["inarray"][0]:
                 self.fout.write(c)
@@ -67,6 +65,8 @@ class JSONPrettyPrinter(object):
                     self.newline()
                 else:
                     self.fout.write(' ')
+        elif c.isspace():
+            pass
         else:
             self.fout.write(c)
         self.state["skipnewline"] = (c == '[')
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list