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 11C79158041 for ; Thu, 7 Mar 2024 15:08:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 52E07E29BC; Thu, 7 Mar 2024 15:08:12 +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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2DB9CE29BC for ; Thu, 7 Mar 2024 15:08:12 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 38644343063 for ; Thu, 7 Mar 2024 15:08:11 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 97E471049 for ; Thu, 7 Mar 2024 15:08:09 +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: <1709824084.5c8f8d79a8b6179e50b2eb955eb848096727a9ac.sam@gentoo> Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: pym/gentoolkit/dependencies.py X-VCS-Directories: pym/gentoolkit/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 5c8f8d79a8b6179e50b2eb955eb848096727a9ac X-VCS-Branch: master Date: Thu, 7 Mar 2024 15:08:09 +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: ff2cb4ae-1849-44fd-aa6a-71a902c59b41 X-Archives-Hash: 1747c0b456b210ebf586f37429bf3e21 commit: 5c8f8d79a8b6179e50b2eb955eb848096727a9ac Author: John Turner gmail com> AuthorDate: Wed Mar 6 19:43:03 2024 +0000 Commit: Sam James gentoo 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 gmail.com> Closes: https://github.com/gentoo/gentoolkit/pull/46 Signed-off-by: Sam James 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