aiteamutils 0.2.83__py3-none-any.whl → 0.2.86__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
aiteamutils/enums.py
CHANGED
@@ -1,10 +1,49 @@
|
|
1
1
|
"""시스템 전체에서 사용되는 열거형 정의."""
|
2
2
|
from enum import Enum
|
3
|
+
from typing import Union, Dict
|
4
|
+
import importlib
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
from .exceptions import CustomException, ErrorCode
|
7
|
+
|
8
|
+
def get_enum_class(
|
9
|
+
status_type: str,
|
10
|
+
status_id: Union[str, None] = None,
|
11
|
+
module_name: str = "app.utils.enums"
|
12
|
+
) -> Union[Dict[str, str], str]:
|
13
|
+
"""Enum 클래스에서 모든 값을 반환하거나 특정 ID에 해당하는 값을 반환."""
|
14
|
+
words = status_type.split('-')
|
15
|
+
camel_case_status_type = ''.join(word.capitalize() for word in words)
|
16
|
+
|
17
|
+
try:
|
18
|
+
enum_module = importlib.import_module(module_name)
|
19
|
+
except ModuleNotFoundError:
|
20
|
+
raise CustomException(
|
21
|
+
error_code=ErrorCode.NOT_FOUND,
|
22
|
+
detail="Status module not found",
|
23
|
+
source_function="get_enum_class.enum_module"
|
24
|
+
)
|
25
|
+
|
26
|
+
try:
|
27
|
+
enum_class = getattr(enum_module, camel_case_status_type)
|
28
|
+
except AttributeError:
|
29
|
+
raise CustomException(
|
30
|
+
error_code=ErrorCode.NOT_FOUND,
|
31
|
+
detail=f"Status type '{status_type}' not found",
|
32
|
+
source_function="get_enum_class.enum_class"
|
33
|
+
)
|
34
|
+
|
35
|
+
if status_id:
|
36
|
+
item = next((item for item in enum_class if item.value == status_id), None)
|
37
|
+
if item:
|
38
|
+
return item.value
|
39
|
+
else:
|
40
|
+
raise CustomException(
|
41
|
+
error_code=ErrorCode.NOT_FOUND,
|
42
|
+
detail=f"'{status_id}' not found in '{status_type}'",
|
43
|
+
source_function="get_enum_class"
|
44
|
+
)
|
45
|
+
else:
|
46
|
+
return {status.value: status.value for status in enum_class}
|
8
47
|
|
9
48
|
class UserStatus(str, Enum):
|
10
49
|
"""사용자 상태."""
|
aiteamutils/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
"""버전 정보"""
|
2
|
-
__version__ = "0.2.
|
2
|
+
__version__ = "0.2.86"
|
@@ -5,11 +5,11 @@ aiteamutils/base_service.py,sha256=7DXjEn3e_dve_ZfNwUP1_WD7QnucWRXBq-bYuxVmyXI,8
|
|
5
5
|
aiteamutils/cache.py,sha256=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
|
6
6
|
aiteamutils/config.py,sha256=YdalpJb70-txhGJAS4aaKglEZAFVWgfzw5BXSWpkUz4,3232
|
7
7
|
aiteamutils/database.py,sha256=b4fN0XHNWxMJeS5M95JcJ7tujAJ1x3SPTAfDvJdB4sE,19696
|
8
|
-
aiteamutils/enums.py,sha256=
|
8
|
+
aiteamutils/enums.py,sha256=Z9wzR3H4XLpA4U3urR5e4eDnEY3Qhne34nLXsKXiL64,2177
|
9
9
|
aiteamutils/exceptions.py,sha256=5yREcEUbJPzq2404pFJ4J9047I9_qx2QG5iBND1PjDI,15901
|
10
10
|
aiteamutils/security.py,sha256=tS7gdkCvL0hfgC_FWDSWaCVrzy3zUFpw-PyiFn9yXMM,10839
|
11
11
|
aiteamutils/validators.py,sha256=PvI9hbMEAqTawgxPbiWRyx2r9yTUrpNBQs1AD3w4F2U,7726
|
12
|
-
aiteamutils/version.py,sha256=
|
13
|
-
aiteamutils-0.2.
|
14
|
-
aiteamutils-0.2.
|
15
|
-
aiteamutils-0.2.
|
12
|
+
aiteamutils/version.py,sha256=eTOus5yS8SigW0he6k5xIuMmhc5Y-xL5BWIAl4v4YAM,42
|
13
|
+
aiteamutils-0.2.86.dist-info/METADATA,sha256=oEWD30Y0sHxrbtW9VX0sH9euIwQ2vjvsFOKNQ3c7KPc,1718
|
14
|
+
aiteamutils-0.2.86.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
+
aiteamutils-0.2.86.dist-info/RECORD,,
|
File without changes
|