public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/
Date: Thu,  7 Mar 2024 15:08:09 +0000 (UTC)	[thread overview]
Message-ID: <1709824084.5c8f8d79a8b6179e50b2eb955eb848096727a9ac.sam@gentoo> (raw)

commit:     5c8f8d79a8b6179e50b2eb955eb848096727a9ac
Author:     John Turner <jturner.usa <AT> gmail <DOT> com>
AuthorDate: Wed Mar  6 19:43:03 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar  7 15:08:04 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5c8f8d79

dependencies.py: use Enum rather than StrEnum for DependencyKind

StrEnum is only supported in Python versions 3.11 and
newer. Gentoolkit should not require >=3.11, so DependencyKind will
use the regular Enum feature instead.

The difference between StrEnum and Enum is that StrEnum members are
strings and can generally be used in place of strings in APIs
expecting string input. Non-StrEnum members are not strings, but you
can get members values by accessing their value field (DependencyKind.DEPEND.value).

Fixes: 78464ec40bad9a0f824b063506f58296cc3ed9f3
Signed-off-by: John Turner <jturner.usa <AT> gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/46
Signed-off-by: Sam James <sam <AT> gentoo.org>

 pym/gentoolkit/dependencies.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index f296e27..c6abff0 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -13,7 +13,7 @@ __all__ = ("Dependencies",)
 
 import itertools
 from functools import cache
-from enum import StrEnum
+from enum import Enum
 from typing import List, Dict
 
 import portage
@@ -28,7 +28,7 @@ from gentoolkit.query import Query
 # =======
 
 
-class DependencyKind(StrEnum):
+class DependencyKind(Enum):
     DEPEND = "DEPEND"
     RDEPEND = "RDEPEND"
     BDEPEND = "BDEPEND"
@@ -104,13 +104,13 @@ class Dependencies(Query):
 
     @cache
     def get_raw_depends(self) -> str:
-        return self._get_depend([depkind for depkind in DependencyKind], raw=True)
+        return self._get_depend([depkind.value for depkind in DependencyKind], raw=True)
 
     @cache
     def get_depends(self) -> Dict[DependencyKind, List[Atom]]:
         depends = dict()
         for depkind in DependencyKind:
-            depend = self._get_depend([depkind])
+            depend = self._get_depend([depkind.value])
             depends[depkind] = depend
         return depends
 


             reply	other threads:[~2024-03-07 15:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 15:08 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-03  5:55 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ Sam James
2024-03-07 18:49 Sam James
2024-02-17  0:01 Sam James
2024-02-16 20:39 Sam James
2024-02-16 20:39 Sam James
2024-02-16 20:39 Sam James
2022-12-14  9:24 Sam James
2022-07-10  7:53 Brian Dolbec
2022-07-10  7:53 Brian Dolbec
2021-09-21 21:01 Matt Turner
2020-10-13 14:14 Brian Dolbec
2020-10-09  6:29 Georgy Yakovlev
2020-04-24  8:06 Michał Górny
2019-07-29  0:51 Zac Medico
2019-05-11 22:43 Virgil Dupras
2018-09-17 23:32 Virgil Dupras
2017-09-06 18:33 Paul Varner
2016-09-15 16:02 Brian Dolbec
2016-08-16 16:05 Paul Varner
2016-07-25 18:04 Paul Varner
2016-07-08 15:37 Brian Dolbec
2015-10-22 16:13 Paul Varner

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=1709824084.5c8f8d79a8b6179e50b2eb955eb848096727a9ac.sam@gentoo \
    --to=sam@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