File tree Expand file tree Collapse file tree 8 files changed +48
-20
lines changed
Expand file tree Collapse file tree 8 files changed +48
-20
lines changed Original file line number Diff line number Diff line change 11"""Logs ABC"""
22
33from typing import Literal
4- from enum import StrEnum
54
65from abc import ABC , abstractmethod
76
7+ from dotflow .core .types .enum import StrEnum
8+
89
910class TypeLog (StrEnum ):
1011
Original file line number Diff line number Diff line change 1+ """Enum Type module"""
2+
3+ import sys
4+
5+ from enum import Enum
6+
7+
8+ class StrEnumType (str , Enum ):
9+ ...
10+
11+
12+ if sys .version_info >= (3 , 11 ):
13+ from enum import StrEnum as StrEnum
14+ else :
15+ StrEnum = StrEnumType
16+
17+
18+ __all__ = ["StrEnum" ]
Original file line number Diff line number Diff line change 11"""Execution Mode Type module"""
22
3- from enum import StrEnum
43from typing import Literal
54
5+ from dotflow .core .types .enum import StrEnum
6+
67
78class ExecutionModeType (StrEnum ):
89 """
Original file line number Diff line number Diff line change 11"""Status Task Type module"""
22
3- from enum import StrEnum
43from typing_extensions import Literal
54
5+ from dotflow .core .types .enum import StrEnum
6+
67
78class StatusTaskType (StrEnum ):
89 """
@@ -19,18 +20,6 @@ class StatusTaskType(StrEnum):
1920 RETRY = "Retry"
2021 FAILED = "Failed"
2122
22- @classmethod
23- def get_symbol (cls , value : str ) -> str :
24- status = {
25- StatusTaskType .NOT_STARTED : "⚪" ,
26- StatusTaskType .IN_PROGRESS : "🔵" ,
27- StatusTaskType .COMPLETED : "✅" ,
28- StatusTaskType .PAUSED : "◼️" ,
29- StatusTaskType .RETRY : "❗" ,
30- StatusTaskType .FAILED : "❌"
31- }
32- return status .get (value )
33-
3423
3524TYPE_STATUS_TASK = Literal [
3625 StatusTaskType .NOT_STARTED ,
Original file line number Diff line number Diff line change 11"""Storage Type module"""
22
3- from enum import StrEnum
43from typing import Literal
54
5+ from dotflow .core .types .enum import StrEnum
6+
67
78class StorageType (StrEnum ):
89 """
Original file line number Diff line number Diff line change 11"""Workflow Status Type module"""
22
3- from enum import StrEnum
43from typing import Literal
54
5+ from dotflow .core .types .enum import StrEnum
6+
67
78class WorkflowStatusType (StrEnum ):
89 """
@@ -21,4 +22,4 @@ class WorkflowStatusType(StrEnum):
2122 WorkflowStatusType .NEW ,
2223 WorkflowStatusType .IN_PROGRESS ,
2324 WorkflowStatusType .COMPLETED
24- ]
25+ ]
Original file line number Diff line number Diff line change 1010from dotflow .logging import logger
1111
1212
13+ def get_symbol (value : str ) -> str :
14+ status = {
15+ StatusTaskType .NOT_STARTED : "⚪" ,
16+ StatusTaskType .IN_PROGRESS : "🔵" ,
17+ StatusTaskType .COMPLETED : "✅" ,
18+ StatusTaskType .PAUSED : "◼️" ,
19+ StatusTaskType .RETRY : "❗" ,
20+ StatusTaskType .FAILED : "❌"
21+ }
22+ return status .get (value )
23+
24+
1325class NotifyTelegram (Notify ):
1426
1527 MESSAGE = "{symbol} {status}\n ```json\n {task}```\n {workflow_id}-{task_id}"
@@ -50,7 +62,7 @@ def send(self, task: Any) -> None:
5062
5163 def _get_text (self , task : Any ) -> str :
5264 return self .MESSAGE .format (
53- symbol = StatusTaskType . get_symbol (task .status ),
65+ symbol = get_symbol (task .status ),
5466 status = task .status ,
5567 workflow_id = task .workflow_id ,
5668 task_id = task .task_id ,
Original file line number Diff line number Diff line change 11"""Types module"""
22
3+ from dotflow .core .types .execution import ExecutionModeType
34from dotflow .core .types .status import StatusTaskType
45from dotflow .core .types .storage import StorageType
6+ from dotflow .core .types .worflow import WorkflowStatusType
7+
58
69__all__ = [
10+ "ExecutionModeType" ,
711 "StatusTaskType" ,
8- "StorageType"
12+ "StorageType" ,
13+ "WorkflowStatusType"
914]
You can’t perform that action at this time.
0 commit comments