From 8a92c628f2ecbf0c776eff5ce3b05d37682158ff Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 1 Nov 2014 10:41:54 +1700 Subject: [PATCH] Re: [PATCH] test: Make gen-threads work with python3 --- 92/58866e298b377756e6e5317de5382a8b5b717d | 153 ++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 92/58866e298b377756e6e5317de5382a8b5b717d diff --git a/92/58866e298b377756e6e5317de5382a8b5b717d b/92/58866e298b377756e6e5317de5382a8b5b717d new file mode 100644 index 000000000..1d44550a2 --- /dev/null +++ b/92/58866e298b377756e6e5317de5382a8b5b717d @@ -0,0 +1,153 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 0B87C431FBC + for ; Fri, 31 Oct 2014 10:52:28 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.1 +X-Spam-Level: +X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id koG9-Oa921tT for ; + Fri, 31 Oct 2014 10:52:20 -0700 (PDT) +Received: from resqmta-po-12v.sys.comcast.net (resqmta-po-12v.sys.comcast.net + [96.114.154.171]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 2D14D431FAF + for ; Fri, 31 Oct 2014 10:52:20 -0700 (PDT) +Received: from resomta-po-02v.sys.comcast.net ([96.114.154.226]) + by resqmta-po-12v.sys.comcast.net with comcast + id 9tqZ1p0024tLnxL01tsJle; Fri, 31 Oct 2014 17:52:18 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by resomta-po-02v.sys.comcast.net with comcast + id 9thv1p00Q152l3L01ti3Xl; Fri, 31 Oct 2014 17:42:12 +0000 +Received: by odin.tremily.us (Postfix, from userid 1000) + id 3CD211440A7F; Fri, 31 Oct 2014 10:41:54 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; + t=1414777314; bh=Lutqs67YYHlAbTVAM2EYRXM3FafEluZlR2k48xZ1Q1U=; + h=Date:From:To:Cc:Subject:References:In-Reply-To; + b=DrisrplZj20MsSXDXeBr13AsOIe/ayIhIEY1saJRyuUQY15e/L+soFz3ERLQKAUy3 + 88wk4kGKjQRWhm1zWhQXW6wgBfFLCpti/QOBOimHfoVWHDfHlBmN89AeKXbPQj4Msr + HN5ekoEf4Q2a/uqPOlep+gKSzAn81wBYcmeINgwo= +Date: Fri, 31 Oct 2014 10:41:54 -0700 +From: "W. Trevor King" +To: Jesse Rosenthal +Subject: Re: [PATCH] test: Make gen-threads work with python3 +Message-ID: <20141031174153.GQ15443@odin.tremily.us> +References: <1414776805-30000-1-git-send-email-jrosenthal@jhu.edu> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="1ysCV03AuJYXZqZy" +Content-Disposition: inline +In-Reply-To: <1414776805-30000-1-git-send-email-jrosenthal@jhu.edu> +OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8; + url=http://tremily.us/pubkey.txt +User-Agent: Mutt/1.5.23 (2014-03-12) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20140121; t=1414777938; + bh=4sWcCrYS40AKzwEe2xDTg9efvrUgPgVc8ZBUWnfqLi4=; + h=Received:Received:Received:Date:From:To:Subject:Message-ID: + MIME-Version:Content-Type; + b=XYc565AnV+Vcl0EKK4zPuJVvDo7f2pm+q43iSCfnf32UkT01W1SclqhTCNiaS2+bb + sIUOI5gVIOXPxOntN7Uf21XGf28jS+njThqm9KwX+/AchqQmU8m3OHy9kfcI20NmuK + dDwUwgbI4G5R0xtf/lkSNFJABXJYCU9yMNwIdujR1xiExNNqKcQxm8imC3Te6C8ZEx + +FUxw/JJ1vwjYXcQO2njjuu7r70r5x3BHLygDLRJR4o/OAfbCDnGoRJRc65xzoBO4E + YXkaUvjiqDPw/mpAa6KdTJSAA18rElnTrelCGkKwg4H8Z/lWj4o05RwEmvm+CUfzEa + k1Buk9Tf8w1zw== +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 31 Oct 2014 17:52:28 -0000 + + +--1ysCV03AuJYXZqZy +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +On Fri, Oct 31, 2014 at 01:33:25PM -0400, Jesse Rosenthal wrote: +> We instead initalize the dictionary using the dict comprehension and +> then update it with the values from the tree. This will work with +> both python2 and python3. + +Dict comprehensions are new in 2.7 [1,2], so this drops support for +systems where =E2=80=98python=E2=80=99 means =E2=80=98python2.6=E2=80=99. = +Personally, I'm fine with +that, but I thought I'd point it out in case 2.6 users wanted to push +back ;). + +> diff --git a/test/gen-threads.py b/test/gen-threads.py +> index 9fbb847..70fb1f6 100644 +> --- a/test/gen-threads.py +> +++ b/test/gen-threads.py +> @@ -2,7 +2,6 @@ +> # argv[1]. Each output line is a thread structure, where the n'th +> # field is either a number giving the parent of message n or "None" +> # for the root. +> - +> import sys + +Why remove this blank line? + +> from itertools import chain, combinations +> =20 +> @@ -28,6 +27,7 @@ while queue: +> else: +> # Expand node to_expand[0] with each possible set of children +> for children in subsets(free): +> - ntree =3D dict(tree, **{child: to_expand[0] for child in chi= +ldren}) +> + ntree =3D {child: to_expand[0] for child in children} +> + ntree.update(tree) + +This looks good to me. + +Cheers, +Trevor + +[1]: https://docs.python.org/3/whatsnew/2.7.html#other-language-changes +[2]: http://legacy.python.org/dev/peps/pep-0274/ + +--=20 +This email may be signed or encrypted with GnuPG (http://www.gnupg.org). +For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy + +--1ysCV03AuJYXZqZy +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 + +iQIcBAEBAgAGBQJUU8nZAAoJEG8/JgBt8ol84FEQAOIXlvnkl0mReM3hkg6W4hvJ +AOCdUjUtfE/UGV7SlYFZEuFBLDN4F73DcNvxilF37QaSFf+xoK9FRfMQ5lyPmQW2 +LV51axuXnAqCpHdgWAkurn8VB6KnzQE6nC97iv21ROYXewk3TFPHp9+ZM3+3JAz4 +PjFzcy7hGEKK9AOcS8X7C+SmaF6vZg+Bj+e9qJj1FAAsF9gWoHYOPzYWSdoOAJrG +QI2Pm3vVm6wVRBZOgVshQKl5ZmuK/u2nQZ+8Kf57ttSmZ3D5J+mf1Ufj0sf3DkGo +1umP4EuMcKiJLS8/iAY0wfwj+4qd+Nm5bCxxaRo3DYxWdHeIrvgE1lMnWRD36YzA +0Xa4ZmL+B7L3zAuqorcRk87SXNQ6sgPEK7Q6azG9CSmbC7PBRFLaUtc6ANhc14Lf +FEBusHfYAcACWOE8qfX85AxtshJuf3Y6f7DbXic2sJzVE3t/bkor5IuOy0xenq2/ +eNjenxGgfutE8fCB8abnX0iWha2BYzCqKg8qwlxmGRGk7XwIFqy9CWzAaBR5clHN +FCCZ2aNZlz+F4xDgwbKXh7vlCfzCT3sQ2ZAGoRagbzql2vOOyl9qY0/GKZC2Vvn/ +ka7/y8kRvVl5V0zK7Pgjc75pHm00dqLYIp5McflD2eSaAHDnIATn+y9HHLvJMIAn +K1ln76S+clh2Kb2L/82A +=JwWQ +-----END PGP SIGNATURE----- + +--1ysCV03AuJYXZqZy-- -- 2.26.2