public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/snakeoil:master commit in: src/snakeoil/
Date: Sat,  9 Sep 2023 05:37:14 +0000 (UTC)	[thread overview]
Message-ID: <1693369208.379bf7a6cd7fb7b7c3684c834e20b8d4fe1170ae.arthurzam@gentoo> (raw)

commit:     379bf7a6cd7fb7b7c3684c834e20b8d4fe1170ae
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 30 04:20:08 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> 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 <arthurzam <AT> 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


             reply	other threads:[~2023-09-09  5:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-09  5:37 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-26 20:14 [gentoo-commits] proj/pkgcore/snakeoil:master commit in: src/snakeoil/ Arthur Zamarin
2024-01-18 17:15 Arthur Zamarin
2024-01-17  8:34 Arthur Zamarin
2023-01-20  7:36 Arthur Zamarin
2023-01-17 20:39 Arthur Zamarin
2022-12-25 18:22 Arthur Zamarin
2022-11-19 13:57 Arthur Zamarin
2022-11-08 19:39 Arthur Zamarin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1693369208.379bf7a6cd7fb7b7c3684c834e20b8d4fe1170ae.arthurzam@gentoo \
    --to=arthurzam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox