From: Muhammad Rizki <[email protected]>
Cc: Muhammad Rizki <[email protected]>,
Alviro Iskandar Setiawan <[email protected]>,
Ammar Faizi <[email protected]>,
GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH 08/28] enum: Add Platform enumeration
Date: Tue, 20 Dec 2022 06:52:06 +0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Add a Platform enum class to use it for enumeration instead of a string.
Signed-off-by: Muhammad Rizki <[email protected]>
Acked-by: Alviro Iskandar Setiawan <[email protected]>
Link: https://lore.gnuweeb.org/gwml/[email protected]
Cc: Ammar Faizi <[email protected]>
Cc: GNU/Weeb Mailing List <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
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
next prev parent reply other threads:[~2022-12-19 23:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 23:51 [PATCH 01/28] discord: Add send_text_mail_interaction() Muhammad Rizki
2022-12-19 23:52 ` [PATCH 02/28] discord: Add send_patch_mail_interaction() Muhammad Rizki
2022-12-19 23:52 ` [PATCH 03/28] discord: Add get lore mail slash command Muhammad Rizki
2022-12-19 23:52 ` [PATCH 04/28] atom: Improve remove_patch() Muhammad Rizki
2022-12-19 23:52 ` [PATCH 05/28] atom: add get_decoded_payload() Muhammad Rizki
2022-12-19 23:52 ` [PATCH 06/28] telegram: Fix get lore command Muhammad Rizki
2022-12-19 23:52 ` [PATCH 07/28] atom: Improve extract_body() Muhammad Rizki
2022-12-19 23:52 ` Muhammad Rizki [this message]
2022-12-19 23:52 ` [PATCH 09/28] enum: Use the created Platform class enumeration Muhammad Rizki
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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