From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.209]) by gnuweeb.org (Postfix) with ESMTPSA id DEC158194D; Mon, 19 Dec 2022 23:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1671493984; bh=r95DCddlFYFDq5aUnX3Wfxa7qXtWyOA4mWu+O+os6+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bx8Ts0n7C7t3C+MP1x/F+oTMr6i4lMpjSBIfpzoNSX3Jy4RDbnOBlbtcgJ2i+TpnA e0kDGZETZMqBkjVppfMb/JyUQiVVJieQ/SNcxfvwEuhojJ6vM49ueln584onxE3sYy pSK64WKeOAhLel9QiXO4A6mqBdHRbRluMs0wQQ4EM+mVKtQYy3S4zkG0nJHDEBiQbr bPsVUqLNGIeQTpReprJdmCjRQvvBgarQuUrCZh4AIBIx47NcGjIougnxogp11wWL6G ekherFIPy+I1JunW524AeiB0UXBIgzuE+3tEmAXLvx1RnxdB1t62RRMJNSUjd6FOiM cjovDi1IRFyUw== From: Muhammad Rizki To: Cc: Muhammad Rizki , Alviro Iskandar Setiawan , Ammar Faizi , GNU/Weeb Mailing List Subject: [PATCH 08/28] enum: Add Platform enumeration Date: Tue, 20 Dec 2022 06:52:06 +0700 Message-Id: <20221219235226.1567-8-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221219235226.1567-1-kiizuha@gnuweeb.org> References: <20221219235226.1567-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add a Platform enum class to use it for enumeration instead of a string. Signed-off-by: Muhammad Rizki Acked-by: Alviro Iskandar Setiawan Link: https://lore.gnuweeb.org/gwml/20221022065149.865-9-kiizuha@gnuweeb.org Cc: Ammar Faizi Cc: GNU/Weeb Mailing List Signed-off-by: Ammar Faizi --- daemon/enums/__init__.py | 1 + daemon/enums/base.py | 9 +++++++++ daemon/enums/platform.py | 7 +++++++ 3 files changed, 17 insertions(+) create mode 100644 daemon/enums/__init__.py create mode 100644 daemon/enums/base.py create mode 100644 daemon/enums/platform.py diff --git a/daemon/enums/__init__.py b/daemon/enums/__init__.py new file mode 100644 index 0000000..efe9c79 --- /dev/null +++ b/daemon/enums/__init__.py @@ -0,0 +1 @@ +from .platform import Platform diff --git a/daemon/enums/base.py b/daemon/enums/base.py new file mode 100644 index 0000000..526aba5 --- /dev/null +++ b/daemon/enums/base.py @@ -0,0 +1,9 @@ +import enum + + +class EnumBase(enum.Enum): + def _generate_next_value_(self, *args): + return self.lower() + + def __repr__(self): + return f"enums.{self}" diff --git a/daemon/enums/platform.py b/daemon/enums/platform.py new file mode 100644 index 0000000..638d8dd --- /dev/null +++ b/daemon/enums/platform.py @@ -0,0 +1,7 @@ +import enum +from .base import EnumBase + + +class Platform(EnumBase): + DISCORD = enum.auto() + TELEGRAM = enum.auto() -- 2.34.1.windows.1