video_downloader_service/src/core/result.py

19 lines
446 B
Python
Raw Normal View History

2023-09-22 00:17:24 +03:00
import types
2023-08-24 16:45:55 +03:00
from enum import Enum
2023-09-22 00:17:24 +03:00
from inspect import Traceback
2023-08-24 16:45:55 +03:00
class ResultTypeEnum(Enum):
EXCEPTION = "Error"
DONE = "Done"
EXIST = "Exist"
2023-08-24 16:45:55 +03:00
class Result:
def __init__(self, result_type: ResultTypeEnum, value: str | dict | list = None):
2023-08-24 16:45:55 +03:00
self.result_type = result_type
self.value = value
def __repr__(self):
2023-09-22 00:17:24 +03:00
return f'Result: {self.result_type.value}. Value: {self.value if self.value else None}'