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 40BBF158089 for ; Sat, 9 Sep 2023 05:37:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5D7BC2BC01E; Sat, 9 Sep 2023 05:37:17 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3B51C2BC01E for ; Sat, 9 Sep 2023 05:37:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1AEAF335C36 for ; Sat, 9 Sep 2023 05:37:16 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4424410E0 for ; Sat, 9 Sep 2023 05:37:14 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1693369208.379bf7a6cd7fb7b7c3684c834e20b8d4fe1170ae.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/snakeoil:master commit in: src/snakeoil/ X-VCS-Repository: proj/pkgcore/snakeoil X-VCS-Files: src/snakeoil/mappings.py X-VCS-Directories: src/snakeoil/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 379bf7a6cd7fb7b7c3684c834e20b8d4fe1170ae X-VCS-Branch: master Date: Sat, 9 Sep 2023 05:37:14 +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: 6dba2d5d-1a86-4aee-a6d1-61eb0bef183b X-Archives-Hash: 6e1676f96a20679165eee7110d55e351 commit: 379bf7a6cd7fb7b7c3684c834e20b8d4fe1170ae Author: Arthur Zamarin gentoo org> AuthorDate: Wed Aug 30 04:20:08 2023 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Wed Aug 30 04:20:08 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=379bf7a6 mappings: small refactor Signed-off-by: Arthur Zamarin gentoo.org> src/snakeoil/mappings.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/snakeoil/mappings.py b/src/snakeoil/mappings.py index d4ac221d..f3663571 100644 --- a/src/snakeoil/mappings.py +++ b/src/snakeoil/mappings.py @@ -298,7 +298,7 @@ class ProtectedDict(DictMixin): raise KeyError(key) def keys(self): - for k in self.new.keys(): + for k in self.new: yield k for k in self.orig.keys(): if k not in self.blacklist and k not in self.new: @@ -320,14 +320,14 @@ class ImmutableDict(Mapping): elif isinstance(data, Mapping): mapping = data elif isinstance(data, DictMixin): - mapping = {k: v for k, v in data.items()} + mapping = dict(data.items()) elif data is None: mapping = {} else: try: - mapping = {k: v for k, v in data} - except TypeError as e: - raise TypeError(f"unsupported data format: {e}") + mapping = dict(data) + except TypeError as exc: + raise TypeError(f"unsupported data format: {exc}") object.__setattr__(self, "_dict", mapping) def __getitem__(self, key): @@ -362,8 +362,8 @@ class OrderedFrozenSet(Set): def __init__(self, iterable=()): try: self._dict = ImmutableDict({x: None for x in iterable}) - except TypeError as e: - raise TypeError("not iterable") from e + except TypeError as exc: + raise TypeError("not iterable") from exc def __contains__(self, key): return key in self._dict @@ -419,8 +419,8 @@ class OrderedSet(OrderedFrozenSet, MutableSet): def __init__(self, iterable=()): try: self._dict = {x: None for x in iterable} - except TypeError as e: - raise TypeError("not iterable") from e + except TypeError as exc: + raise TypeError("not iterable") from exc def add(self, value): self._dict[value] = None