From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6602315808C for ; Sun, 27 Mar 2022 23:07:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BB19FE0990; Sun, 27 Mar 2022 23:07:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6F139E0990 for ; Sun, 27 Mar 2022 23:07:14 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6B15C343113 for ; Sun, 27 Mar 2022 23:07:13 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8739034C for ; Sun, 27 Mar 2022 23:07:10 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1648422403.6fb8ee74b3f334a7e2d82ce674a4b98e49f78b06.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/checksum.py lib/portage/eclass_cache.py lib/portage/getbinpkg.py X-VCS-Directories: lib/portage/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 6fb8ee74b3f334a7e2d82ce674a4b98e49f78b06 X-VCS-Branch: master Date: Sun, 27 Mar 2022 23:07:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 4c52afa0-b47b-4855-8509-bc3e4fefb335 X-Archives-Hash: ce42789e628501ad45032e0484323ddf commit: 6fb8ee74b3f334a7e2d82ce674a4b98e49f78b06 Author: Kenneth Raplee kennethraplee com> AuthorDate: Tue Mar 22 07:54:21 2022 +0000 Commit: Sam James gentoo org> CommitDate: Sun Mar 27 23:06:43 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=6fb8ee74 Use dict expressions instead of looping or dict() Signed-off-by: Kenneth Raplee kennethraplee.com> Signed-off-by: Sam James gentoo.org> lib/portage/checksum.py | 10 ++++------ lib/portage/eclass_cache.py | 5 +---- lib/portage/getbinpkg.py | 22 +++++++++++++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/portage/checksum.py b/lib/portage/checksum.py index d7e800c47..72d20525a 100644 --- a/lib/portage/checksum.py +++ b/lib/portage/checksum.py @@ -367,9 +367,7 @@ def _perform_md5_merge(x, **kwargs): def perform_all(x, calc_prelink=0): - mydict = {} - for k in hashfunc_keys: - mydict[k] = perform_checksum(x, k, calc_prelink)[0] + mydict = {k: perform_checksum(x, k, calc_prelink)[0] for k in hashfunc_keys} return mydict @@ -458,11 +456,11 @@ def _apply_hash_filter(digests, hash_filter): break if modified: - digests = dict( - (k, v) + digests = { + k: v for (k, v) in digests.items() if k == "size" or k in verifiable_hash_types - ) + } return digests diff --git a/lib/portage/eclass_cache.py b/lib/portage/eclass_cache.py index 2545ed9b2..c4c783168 100644 --- a/lib/portage/eclass_cache.py +++ b/lib/portage/eclass_cache.py @@ -169,10 +169,7 @@ class cache: return d def get_eclass_data(self, inherits): - ec_dict = {} - for x in inherits: - ec_dict[x] = self.eclasses[x] - + ec_dict = {x: self.eclasses[x] for x in inherits} return ec_dict @property diff --git a/lib/portage/getbinpkg.py b/lib/portage/getbinpkg.py index bf99fd2be..f357a91df 100644 --- a/lib/portage/getbinpkg.py +++ b/lib/portage/getbinpkg.py @@ -55,20 +55,24 @@ def make_metadata_dict(data): ) myid, _myglob = data - - mydict = {} - for k_bytes in portage.xpak.getindex_mem(myid): - k = _unicode_decode( - k_bytes, encoding=_encodings["repo.content"], errors="replace" + metadata = ( + ( + k_bytes, + _unicode_decode( + k_bytes, encoding=_encodings["repo.content"], errors="replace" + ), ) - if k not in _all_metadata_keys and k != "CATEGORY": - continue - v = _unicode_decode( + for k_bytes in portage.xpak.getindex_mem(myid) + ) + mydict = { + k: _unicode_decode( portage.xpak.getitem(data, k_bytes), encoding=_encodings["repo.content"], errors="replace", ) - mydict[k] = v + for k_bytes, k in metadata + if k in _all_metadata_keys or k == "CATEGORY" + } return mydict