From nobody Wed Oct 30 19:55:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15215679117464.264163254063305; Tue, 20 Mar 2018 10:45:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF8502D1D2; Tue, 20 Mar 2018 17:45:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BEE465C545; Tue, 20 Mar 2018 17:45:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ADF73181B9FB; Tue, 20 Mar 2018 17:45:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2KHj8BI008335 for ; Tue, 20 Mar 2018 13:45:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id D49E6AB587; Tue, 20 Mar 2018 17:45:08 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-128.ams2.redhat.com [10.36.117.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63A70AB5BC for ; Tue, 20 Mar 2018 17:45:02 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Tue, 20 Mar 2018 18:45:01 +0100 Message-Id: <20180320174501.5591-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] patchew-cli: print well-formed JSON in "patchew-cli project --raw" X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 20 Mar 2018 17:45:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" "print(r)" use single quotes for dictionary keys. Using json.dumps makes sure that we produce valid JSON, and that is useful from tests. Signed-off-by: Paolo Bonzini --- I have not yet posted the test that uses this trivial change, but it is pretty obvious so I'm pushing it. patchew-cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patchew-cli b/patchew-cli index 51a89c5..5369ae3 100755 --- a/patchew-cli +++ b/patchew-cli @@ -223,7 +223,7 @@ class ProjectCommand(SubCommand): args =3D parser.parse_args(argv) r =3D self.api_do("get-projects") if args.raw: - print(r) + print(json.dumps(r, indent=3D2, separators=3D",:")) return 0 for p in r: print(p["name"]) --=20 2.16.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel