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,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.123]) by gnuweeb.org (Postfix) with ESMTPSA id 916EC80908; Sat, 22 Oct 2022 06:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666421546; bh=54QxIPsr/pvyr/I+qF2sZnFIqMwGgrWHdmbsnkCQff0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mkbfzhV6tIiE1kDlFI/9aP+5XuqOnHsfkEzvyGHXZQpkXB41ntfkmQFshEQqRaZhn ku0I4kAt/FX2l9RlObdpmJW5ZoMYIKVL+2Mio/+4xdvo6HglE7oLyTtVbKV+z0wpt7 HNZzlWyZDlGz/WSY4RgJytONj4J52DFOA5hdpgwpw1XjzVKAo6ROJBzlEAYNRB2Obn SSgm3p0vLc3ha1XJMoLCkSeLXyEX3XEfA4fLTI4VJ9aBZ8Q2ZA3yuCnH4cg6+F4SpA pGd8tPAaf8wRqHYuyTckGq162xmYqRiSHkC2dSDfG2C1dZtvStVjbeLnhReo/gqKQR hb41Vb9dtnoOw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v4 8/9] enum: Add Platform enumeration Date: Sat, 22 Oct 2022 13:51:48 +0700 Message-Id: <20221022065149.865-9-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221022065149.865-1-kiizuha@gnuweeb.org> References: <20221022065149.865-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 --- 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() -- Muhammad Rizki