-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(enums): generating auto names staticmethod
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |