refactor: replace enum with intenum and strenum

This commit is contained in:
2023-11-05 01:26:28 +02:00
parent a73341e885
commit 6b755b4828
13 changed files with 118 additions and 78 deletions

View File

@ -17,10 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from enum import Enum
from enum import StrEnum
class Action(str, Enum):
class Action(StrEnum):
"""
base action enumeration

View File

@ -19,10 +19,10 @@
#
from __future__ import annotations
from enum import Enum
from enum import StrEnum
class AuthSettings(str, Enum):
class AuthSettings(StrEnum):
"""
web authorization type

View File

@ -18,13 +18,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from dataclasses import dataclass, field, fields
from enum import Enum
from enum import StrEnum
from typing import Any, Self
from ahriman.core.util import filter_json, pretty_datetime, utcnow
class BuildStatusEnum(str, Enum):
class BuildStatusEnum(StrEnum):
"""
build status enumeration

View File

@ -17,10 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from enum import Enum
from enum import StrEnum
class LogHandler(str, Enum):
class LogHandler(StrEnum):
"""
log handler as described by default configuration

View File

@ -19,7 +19,7 @@
#
from __future__ import annotations
from enum import Enum
from enum import StrEnum
from pathlib import Path
from urllib.parse import urlparse
@ -27,7 +27,7 @@ from ahriman.core.util import package_like
from ahriman.models.repository_paths import RepositoryPaths
class PackageSource(str, Enum):
class PackageSource(StrEnum):
"""
package source for addition enumeration

View File

@ -17,10 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from enum import Enum
from enum import IntEnum
class PacmanSynchronization(int, Enum):
class PacmanSynchronization(IntEnum):
"""
pacman database synchronization flag

View File

@ -19,10 +19,10 @@
#
from __future__ import annotations
from enum import Enum
from enum import StrEnum
class ReportSettings(str, Enum):
class ReportSettings(StrEnum):
"""
report targets enumeration

View File

@ -19,10 +19,10 @@
#
from __future__ import annotations
from enum import Enum
from enum import StrEnum
class SignSettings(str, Enum):
class SignSettings(StrEnum):
"""
sign targets enumeration

View File

@ -19,10 +19,10 @@
#
from __future__ import annotations
from enum import Enum
from enum import StrEnum
class SmtpSSLSettings(str, Enum):
class SmtpSSLSettings(StrEnum):
"""
SMTP SSL mode enumeration

View File

@ -19,10 +19,10 @@
#
from __future__ import annotations
from enum import Enum
from enum import StrEnum
class UploadSettings(str, Enum):
class UploadSettings(StrEnum):
"""
remote synchronization targets enumeration

View File

@ -19,10 +19,10 @@
#
from __future__ import annotations
from enum import Enum
from enum import StrEnum
class UserAccess(str, Enum):
class UserAccess(StrEnum):
"""
web user access enumeration