From patchwork Fri Jul 3 00:14:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8570 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AD780BE905 for ; Fri, 3 Jul 2020 00:14:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 316B160C5F; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="W7b0ECgw"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 59338609C7 for ; Fri, 3 Jul 2020 02:14:34 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DF230A2D; Fri, 3 Jul 2020 02:14:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735274; bh=6cVZuua9BYmUrOOA7o5LCM5TKsuZcuOUdWeLqktF5wU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7b0ECgwyTU1lYlCMDC+mdnil9XETYtq6XLPkjJKJ4TIPlaHCn8kZg3snO44Vw+uj vgLthYkBENYEPQSWJPPPB0GRwY/C1e8qr58ahXB3YLk1IwrOnL7dI/+O3K2q28Ea+8 cEEcIjQuX8NHwr345emLu8k/UEEF5eCuvd5EWawg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:13 +0300 Message-Id: <20200703001422.24324-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/10] utils: raspberrypi: ctt: json_pretty_print: Fix printer test X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The ctt_pretty_print_json.py file supports being run standalone to test the code. It however suffers from multiple issues: - The same input file name is hardcoded, and doesn't exist in the repository - The input file name is used instead of JSON data Fix both issues and make the input file selectable on the command line. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- utils/raspberrypi/ctt/ctt_pretty_print_json.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index 73383ea09665..18938c828b4e 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -4,6 +4,8 @@ # # ctt_pretty_print_json.py - camera tuning tool JSON formatter +import sys + """ takes a collapsed json file and makes it more readable @@ -72,4 +74,10 @@ def pretty_print_json(str_in, output_filename): if __name__ == '__main__': - pretty_print_json("../ctt/ref_json/final_imx477.json", "pretty.json") + if len(sys.argv) != 2: + print("Usage: %s filename" % sys.argv[0]) + sys.exit(1) + + input_filename = sys.argv[1] + with open(input_filename, "r") as fin: + pretty_print_json(fin.read(), "pretty.json") From patchwork Fri Jul 3 00:14:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8571 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 62B17BE905 for ; Fri, 3 Jul 2020 00:14:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7B6BE60C57; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LAfuRE/6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A49C8609C7 for ; Fri, 3 Jul 2020 02:14:34 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 416041450; Fri, 3 Jul 2020 02:14:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735274; bh=CO5S+VTGnkOoEXjTW13pkq4J1r6yPzWmL2gw5xuMEag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAfuRE/6xg2C7uND7esb1VD6q6UBpmuU92LLEmW5YgUZ661OpBFXa89JdC+vxW1tH F3M9uP62w4f4Sa2a/0SnvS+Zb4XbvSXpMPcVxa7gEldSwbI/ImZhTTtyUM0SEioAqu KMkEZSg566wVXoF4P0MvyTEPYxbQwA7KthShBB/o= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:14 +0300 Message-Id: <20200703001422.24324-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 02/10] utils: raspberrypi: ctt: json_pretty_print: Turn printer into a class X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Instead of passing a state dictionary to every method, turn the printer into a class and store the state internally. Signed-off-by: Laurent Pinchart --- .../raspberrypi/ctt/ctt_pretty_print_json.py | 117 ++++++++++-------- 1 file changed, 62 insertions(+), 55 deletions(-) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index 18938c828b4e..0e9c56234f5c 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -7,70 +7,77 @@ import sys -""" -takes a collapsed json file and makes it more readable -""" -def process_file(string, fout, state): - for c in string: - process_char(c, fout, state) +class JSONPrettyPrinter(object): + """ + Take a collapsed JSON file and make it more readable + """ + def __init__(self): + self.state = { + "indent": 0, + "inarray": [False], + "arraycount": [], + "skipnewline": True + } + def newline(self, fout): + fout.write('\n') + fout.write(' ' * self.state["indent"] * 4) -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"]: - print_newline(fout, state) - fout.write(c) - state["indent"] += 1 - print_newline(fout, state) - elif c == '}': - state["indent"] -= 1 - print_newline(fout, state) - fout.write(c) - elif c == '[': - print_newline(fout, state) - fout.write(c) - state["indent"] += 1 - print_newline(fout, state) - state["inarray"] = [True] + state["inarray"] - state["arraycount"] = [0] + state["arraycount"] - elif c == ']': - state["indent"] -= 1 - print_newline(fout, state) - state["inarray"].pop(0) - state["arraycount"].pop(0) - fout.write(c) - elif c == ':': - fout.write(c) - fout.write(' ') - elif c == ' ': - pass - elif c == ',': - if not state["inarray"][0]: + def process_char(self, c, fout): + if c == '{': + if not self.state["skipnewline"]: + self.newline(fout) + fout.write(c) + self.state["indent"] += 1 + self.newline(fout) + elif c == '}': + self.state["indent"] -= 1 + self.newline(fout) + fout.write(c) + elif c == '[': + self.newline(fout) + fout.write(c) + self.state["indent"] += 1 + self.newline(fout) + self.state["inarray"] = [True] + self.state["inarray"] + self.state["arraycount"] = [0] + self.state["arraycount"] + elif c == ']': + self.state["indent"] -= 1 + self.newline(fout) + self.state["inarray"].pop(0) + self.state["arraycount"].pop(0) + fout.write(c) + elif c == ':': fout.write(c) fout.write(' ') - print_newline(fout, state) - else: - fout.write(c) - state["arraycount"][0] += 1 - if state["arraycount"][0] == 16: - state["arraycount"][0] = 0 - print_newline(fout, state) - else: + elif c == ' ': + pass + elif c == ',': + if not self.state["inarray"][0]: + fout.write(c) fout.write(' ') - else: - fout.write(c) - state["skipnewline"] = (c == '[') + self.newline(fout) + else: + fout.write(c) + self.state["arraycount"][0] += 1 + if self.state["arraycount"][0] == 16: + self.state["arraycount"][0] = 0 + self.newline(fout) + else: + fout.write(' ') + else: + fout.write(c) + self.state["skipnewline"] = (c == '[') + + def print(self, string, fout): + for c in string: + self.process_char(c, fout) def pretty_print_json(str_in, output_filename): - state = {"indent": 0, "inarray": [False], "arraycount": [], "skipnewline": True} with open(output_filename, "w") as fout: - process_file(str_in, fout, state) + printer = JSONPrettyPrinter() + printer.print(str_in, fout) if __name__ == '__main__': From patchwork Fri Jul 3 00:14:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8572 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id BF5AFC2E69 for ; Fri, 3 Jul 2020 00:14:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BFDE360CAF; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YN5cK8aW"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0855D609C7 for ; Fri, 3 Jul 2020 02:14:35 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 99524213C; Fri, 3 Jul 2020 02:14:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735274; bh=Ohj9+zn2nWRqdDDpCrzPbv0tERDEiXU/N8GfcL7ksMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YN5cK8aWEJAX85igbUlXYqGBsV6AsDzdPGJwkRa2ReeUzIvlyXOFeKOAM13EbQbwY yNHrZVSW2xqL8DZ4KnN4YT7EjDOu99AsIGTbReF0VBaMIf+Kk+fOjC/9fB+iojEkPf 6VXvz+uDFg2iWKhDwVOo4AuI2ZpeFmyE/2enltWg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:15 +0300 Message-Id: <20200703001422.24324-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/10] utils: raspberrypi: ctt: json_pretty_print: Make output file a class member X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Instead of passing the output file to every method of the printer class, make it a class member. Signed-off-by: Laurent Pinchart --- .../raspberrypi/ctt/ctt_pretty_print_json.py | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index 0e9c56234f5c..703a23fe25db 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -11,7 +11,7 @@ class JSONPrettyPrinter(object): """ Take a collapsed JSON file and make it more readable """ - def __init__(self): + def __init__(self, fout): self.state = { "indent": 0, "inarray": [False], @@ -19,65 +19,67 @@ class JSONPrettyPrinter(object): "skipnewline": True } - def newline(self, fout): - fout.write('\n') - fout.write(' ' * self.state["indent"] * 4) + self.fout = fout - def process_char(self, c, fout): + def newline(self): + self.fout.write('\n') + self.fout.write(' ' * self.state["indent"] * 4) + + def process_char(self, c): if c == '{': if not self.state["skipnewline"]: - self.newline(fout) - fout.write(c) + self.newline() + self.fout.write(c) self.state["indent"] += 1 - self.newline(fout) + self.newline() elif c == '}': self.state["indent"] -= 1 - self.newline(fout) - fout.write(c) + self.newline() + self.fout.write(c) elif c == '[': - self.newline(fout) - fout.write(c) + self.newline() + self.fout.write(c) self.state["indent"] += 1 - self.newline(fout) + self.newline() self.state["inarray"] = [True] + self.state["inarray"] self.state["arraycount"] = [0] + self.state["arraycount"] elif c == ']': self.state["indent"] -= 1 - self.newline(fout) + self.newline() self.state["inarray"].pop(0) self.state["arraycount"].pop(0) - fout.write(c) + self.fout.write(c) elif c == ':': - fout.write(c) - fout.write(' ') + self.fout.write(c) + self.fout.write(' ') elif c == ' ': pass elif c == ',': if not self.state["inarray"][0]: - fout.write(c) - fout.write(' ') - self.newline(fout) + self.fout.write(c) + self.fout.write(' ') + self.newline() else: - fout.write(c) + self.fout.write(c) self.state["arraycount"][0] += 1 if self.state["arraycount"][0] == 16: self.state["arraycount"][0] = 0 - self.newline(fout) + self.newline() else: - fout.write(' ') + self.fout.write(' ') else: - fout.write(c) + self.fout.write(c) self.state["skipnewline"] = (c == '[') - def print(self, string, fout): + def print(self, string): for c in string: - self.process_char(c, fout) + self.process_char(c) def pretty_print_json(str_in, output_filename): with open(output_filename, "w") as fout: - printer = JSONPrettyPrinter() - printer.print(str_in, fout) + printer = JSONPrettyPrinter(fout) + printer.print(str_in) if __name__ == '__main__': From patchwork Fri Jul 3 00:14:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8573 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1860BBE905 for ; Fri, 3 Jul 2020 00:14:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 30F6760CB7; Fri, 3 Jul 2020 02:14:37 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ptIrEzMX"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A844609C7 for ; Fri, 3 Jul 2020 02:14:35 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EE2AB9CB; Fri, 3 Jul 2020 02:14:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735275; bh=+ZoDm2gyEdqwJPQPIr9PHcKnllY+qdM5cVObzly7BCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptIrEzMXxSsy+IRjp15gMFv+VaKF03bwr8KOKALttmI1u7/1U/XwMI7ggetZxogZC xhGF+vnX4IzyHvg2b6aPq0MHFxOpi/o+BfwdGtWJAXWytFTzjYavuJI6rJ8EnpkClg 8jKEh0cZK/IfHnSGLvu9x+izyQS7bqFSVZl3P9MI= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:16 +0300 Message-Id: <20200703001422.24324-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/10] utils: raspberrypi: ctt: json_pretty_print: Make test output to stdout X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The standalone test mode output to a file name "pretty.json". To make the test mode more versatile, output to stdout instead. The user can then decide how to use the output. Signed-off-by: Laurent Pinchart --- utils/raspberrypi/ctt/ctt_pretty_print_json.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index 703a23fe25db..3de8c108f01c 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -89,4 +89,5 @@ if __name__ == '__main__': input_filename = sys.argv[1] with open(input_filename, "r") as fin: - pretty_print_json(fin.read(), "pretty.json") + printer = JSONPrettyPrinter(sys.stdout) + printer.print(fin.read()) From patchwork Fri Jul 3 00:14:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8574 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5F406C2E69 for ; Fri, 3 Jul 2020 00:14:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A03FB60C55; Fri, 3 Jul 2020 02:14:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tCuwPsUT"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B21A560C55 for ; Fri, 3 Jul 2020 02:14:35 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4E50AA2D; Fri, 3 Jul 2020 02:14:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735275; bh=waxWcBtbaHpMnw59ICDSApPk1sfE874sepgQYB1a13w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCuwPsUTFaWuAYO18O9LtFNPZWnp7v3B2tk+woZp/JYXmphCZ9V0bXgpk8hvbGBR7 5ME5Vn24N3mbLVMqysAW4vJLk86ATX213Y1St1xa5ps/sCWOcWTIlJ+S4KW9BKakuS JaXbWZRgcj8UALLSETRPkOUkXz1oNuVoZZ0fhZDk= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:17 +0300 Message-Id: <20200703001422.24324-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/10] utils: raspberrypi: ctt: json_pretty_print: Skip all spaces X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Skip all white space characters, not just ' '. This makes a difference if the input JSON data is already formatted. Signed-off-by: Laurent Pinchart --- 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 == '[') From patchwork Fri Jul 3 00:14:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8575 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2B5A9BE905 for ; Fri, 3 Jul 2020 00:14:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EA15C60C58; Fri, 3 Jul 2020 02:14:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZmAEorVS"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0E431609C7 for ; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A11A01450; Fri, 3 Jul 2020 02:14:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735275; bh=cKxC+ZjyOzongWJSon59Bi6YEc0GqqQHKdyZmhGtTUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmAEorVSmipXxiCuio/eIxatgU9Tjq5x284aR6DvOlJyE1df/VsM0nwXBlpZutMMD irxeEL5KQtdcMvEqRpXO0EQMjOmnaYchD7kBbCc8pjM7p/yDvw0hxxm+N705NEJwdX cE5aDgTkm+6fhTj+4FkslQnzNBFMn35wYFqB/jZg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:18 +0300 Message-Id: <20200703001422.24324-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/10] utils: raspberrypi: ctt: json_pretty_print: Add character write method X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a write method to the JSONPrettyPrinter class to output a character. This will be used to handle state updates when outputting individual characters. Signed-off-by: Laurent Pinchart --- .../raspberrypi/ctt/ctt_pretty_print_json.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index dfa99a6d4034..9d450f6d300c 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -25,20 +25,23 @@ class JSONPrettyPrinter(object): self.fout.write('\n') self.fout.write(' ' * self.state["indent"] * 4) + def write(self, c): + self.fout.write(c) + def process_char(self, c): if c == '{': if not self.state["skipnewline"]: self.newline() - self.fout.write(c) + self.write(c) self.state["indent"] += 1 self.newline() elif c == '}': self.state["indent"] -= 1 self.newline() - self.fout.write(c) + self.write(c) elif c == '[': self.newline() - self.fout.write(c) + self.write(c) self.state["indent"] += 1 self.newline() self.state["inarray"] = [True] + self.state["inarray"] @@ -48,27 +51,27 @@ class JSONPrettyPrinter(object): self.newline() self.state["inarray"].pop(0) self.state["arraycount"].pop(0) - self.fout.write(c) + self.write(c) elif c == ':': - self.fout.write(c) - self.fout.write(' ') + self.write(c) + self.write(' ') elif c == ',': if not self.state["inarray"][0]: - self.fout.write(c) - self.fout.write(' ') + self.write(c) + self.write(' ') self.newline() else: - self.fout.write(c) + self.write(c) self.state["arraycount"][0] += 1 if self.state["arraycount"][0] == 16: self.state["arraycount"][0] = 0 self.newline() else: - self.fout.write(' ') + self.write(' ') elif c.isspace(): pass else: - self.fout.write(c) + self.write(c) self.state["skipnewline"] = (c == '[') def print(self, string): From patchwork Fri Jul 3 00:14:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8576 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 8A70AC2E69 for ; Fri, 3 Jul 2020 00:14:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4FD02609C7; Fri, 3 Jul 2020 02:14:40 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bojpdbHn"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B9DD60C82 for ; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0106F9CB; Fri, 3 Jul 2020 02:14:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735276; bh=7hroq+IlpH3NtH5Uj9dOXaPGPeSNlTT7GPsKpXxkETk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bojpdbHnU9izoaIUIk03rTkmouPrvp1BxZHZNjuOx33ntMaZIYDOt/gq1AtrhQF+B QLOag33hsn6JQvfQL9pSHgJ2OjWoFiA7rwHqe0WmIBAQAjzzQvyGzneeCuSUuefc13 ShRnC2NecrCl/4xLhMZjiWQEKWQWbqoYUvrc954Y= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:19 +0300 Message-Id: <20200703001422.24324-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 07/10] utils: raspberrypi: ctt: json_pretty_print: Fix indentation handling X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Indentation is handled by outputting spaces right after outputting a newline character. That works in most cases, but would result in the input '{}' being printed as { } instead of { } Fix it by outputting the indentation before outputting the next character after a newline. The indentation value will be updated by then. Signed-off-by: Laurent Pinchart --- utils/raspberrypi/ctt/ctt_pretty_print_json.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index 9d450f6d300c..f1c61347d8fc 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -16,16 +16,20 @@ class JSONPrettyPrinter(object): "indent": 0, "inarray": [False], "arraycount": [], - "skipnewline": True + "skipnewline": True, + "need_indent": False, } self.fout = fout def newline(self): self.fout.write('\n') - self.fout.write(' ' * self.state["indent"] * 4) + self.state["need_indent"] = True def write(self, c): + if self.state["need_indent"]: + self.fout.write(' ' * self.state["indent"] * 4) + self.state["need_indent"] = False self.fout.write(c) def process_char(self, c): From patchwork Fri Jul 3 00:14:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8577 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id EE10AC2E6B for ; Fri, 3 Jul 2020 00:14:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B80F560C6A; Fri, 3 Jul 2020 02:14:40 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="EiQX2PE0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BFED160CB1 for ; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 55C9AA2D; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735276; bh=Q0nEgp51+e1442dz9uoGps0KFX1YFA9EyoPGVUQ41L8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EiQX2PE0z1lXKpEX5UdQ7waj6HwHLMim3Hy++EKTJn+Sj5mOSHVZknqo89Lv9mdVq nIQOfZxDjo6mbPjYCxl83aVZ+lrmxMOsjuYBRcgozxib0bRhZabu7uNsWhV4rwlxwO ZEj9Lixjy+kjbqlFNKTZSsqQQch+RMzAq592SbbE= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:20 +0300 Message-Id: <20200703001422.24324-9-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 08/10] utils: raspberrypi: ctt: json_pretty_print: Collapse newlines X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Simplify the newline skipping logic by simply collapsing newlines. If a newline has been output, all subsequent newlines will be skipped until the next non-newline character is output. Signed-off-by: Laurent Pinchart --- utils/raspberrypi/ctt/ctt_pretty_print_json.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index f1c61347d8fc..f7fdb65116bc 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -23,19 +23,21 @@ class JSONPrettyPrinter(object): self.fout = fout def newline(self): - self.fout.write('\n') - self.state["need_indent"] = True + if not self.state["skipnewline"]: + self.fout.write('\n') + self.state["need_indent"] = True + self.state["skipnewline"] = True def write(self, c): if self.state["need_indent"]: self.fout.write(' ' * self.state["indent"] * 4) self.state["need_indent"] = False self.fout.write(c) + self.state["skipnewline"] = False def process_char(self, c): if c == '{': - if not self.state["skipnewline"]: - self.newline() + self.newline() self.write(c) self.state["indent"] += 1 self.newline() @@ -76,7 +78,6 @@ class JSONPrettyPrinter(object): pass else: self.write(c) - self.state["skipnewline"] = (c == '[') def print(self, string): for c in string: From patchwork Fri Jul 3 00:14:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8578 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5A4EEBE905 for ; Fri, 3 Jul 2020 00:14:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2929460C62; Fri, 3 Jul 2020 02:14:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uejkICwv"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 239AA60C63 for ; Fri, 3 Jul 2020 02:14:37 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A7AB71450; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735276; bh=NLtrgA4b/wli+aqEmSZI/blphIJQ64+h7IVFpFZn0FQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uejkICwvcfAre708jbdTl/0o2qoOFIrTmw56/G5XF/+EFNulHMpa3MvAlqJN4mmeP wyi6mMmcnFu/JuqtXDXmBWLegc8PkjE/7mbBOB11CtJGpbUaszd36/jedoUc77ttSg s+nibSRGRlb97dTmXj5rQcn8Qo9qvTjJTmuMJjOU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:21 +0300 Message-Id: <20200703001422.24324-10-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 09/10] utils: raspberrypi: ctt: json_pretty_print: Avoid spaces at end of lines X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Avoid outputting spaces at end of lines by recording the need for a space and outputting it before the next character only if not a newline. Signed-off-by: Laurent Pinchart --- utils/raspberrypi/ctt/ctt_pretty_print_json.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index f7fdb65116bc..2ca307a0af11 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -18,6 +18,7 @@ class JSONPrettyPrinter(object): "arraycount": [], "skipnewline": True, "need_indent": False, + "need_space": False, } self.fout = fout @@ -26,12 +27,16 @@ class JSONPrettyPrinter(object): if not self.state["skipnewline"]: self.fout.write('\n') self.state["need_indent"] = True + self.state["need_space"] = False self.state["skipnewline"] = True def write(self, c): if self.state["need_indent"]: self.fout.write(' ' * self.state["indent"] * 4) self.state["need_indent"] = False + if self.state["need_space"]: + self.fout.write(' ') + self.state["need_space"] = False self.fout.write(c) self.state["skipnewline"] = False @@ -60,11 +65,10 @@ class JSONPrettyPrinter(object): self.write(c) elif c == ':': self.write(c) - self.write(' ') + self.state["need_space"] = True elif c == ',': if not self.state["inarray"][0]: self.write(c) - self.write(' ') self.newline() else: self.write(c) @@ -73,7 +77,7 @@ class JSONPrettyPrinter(object): self.state["arraycount"][0] = 0 self.newline() else: - self.write(' ') + self.state["need_space"] = True elif c.isspace(): pass else: From patchwork Fri Jul 3 00:14:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8579 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B7150C2E69 for ; Fri, 3 Jul 2020 00:14:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8105960C61; Fri, 3 Jul 2020 02:14:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ARFJM8X7"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6952260CB9 for ; Fri, 3 Jul 2020 02:14:37 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 07CCBA2D; Fri, 3 Jul 2020 02:14:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593735277; bh=sqLf8UMz1zJcq+Wp7Rc0tXVgDQUtvSu8jJRCNyOib20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ARFJM8X7uJdT0Oc6nb+5qTT2k7jlUzW3VHBFZ4a/6ZXmWMt2RI9NjTDurRZ1yeX5k fCdEOQVqwPy4uNv/uoNQ6lzRIhqNzKSEgpxEbYaTd3lg6zVyPjFWj54Rodf4w+NzUv 9B8LRg9uGbQr2tkcbuEHNdfAqIqERfcT4tzahx1k= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Jul 2020 03:14:22 +0300 Message-Id: <20200703001422.24324-11-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> References: <20200703001422.24324-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 10/10] utils: raspberrypi: ctt: json_pretty_print: Add newline at end of output X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Make sure the output ends with a newline. Signed-off-by: Laurent Pinchart --- utils/raspberrypi/ctt/ctt_pretty_print_json.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index 2ca307a0af11..d38ae6178524 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -86,6 +86,7 @@ class JSONPrettyPrinter(object): def print(self, string): for c in string: self.process_char(c) + self.newline() def pretty_print_json(str_in, output_filename):