Skip to content

Commit

Permalink
chore(enums): generating auto names staticmethod
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima committed Nov 4, 2023
1 parent 798793c commit 564d583
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mdsanima_cli/core/enums/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2023 MDSANIMA

"""This module holds the global enumerations related code."""


from mdsanima_cli.core.enums.auto import AutoName
from mdsanima_cli.core.enums.auto import AutoNameLower
from mdsanima_cli.core.enums.auto import AutoNameUpper


__all__ = ["AutoName", "AutoNameLower", "AutoNameUpper"]
32 changes: 32 additions & 0 deletions mdsanima_cli/core/enums/auto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2023 MDSANIMA

"""Generating the name automatically for enumeration next value."""


from __future__ import annotations

from enum import Enum


class AutoName(Enum):
"""Generate next value the name automatically."""

@staticmethod
def _generate_next_value_(name, start, count, last_values):
return name


class AutoNameLower(Enum):
"""Generate next value the name automatically and converting to lowercase."""

@staticmethod
def _generate_next_value_(name, start, count, last_values):
return name.lower()


class AutoNameUpper(Enum):
"""Generate next value the name automatically and converting to uppercase."""

@staticmethod
def _generate_next_value_(name, start, count, last_values):
return name.upper()

0 comments on commit 564d583

Please sign in to comment.