Files
NexQuant/rdagent/core/task.py
T

38 lines
894 B
Python
Raw Normal View History

2024-06-14 12:59:44 +08:00
from abc import ABC, abstractmethod
from typing import Tuple
import pandas as pd
"""
2024-06-14 12:59:44 +08:00
This file contains the all the data class for rdagent task.
"""
2024-06-14 12:59:44 +08:00
class BaseTask(ABC):
# 把name放在这里作为主键
pass
2024-06-14 12:59:44 +08:00
class TaskImplementation(ABC):
def __init__(self, target_task: BaseTask) -> None:
self.target_task = target_task
@abstractmethod
def execute(self, *args, **kwargs) -> Tuple[str, pd.DataFrame]:
raise NotImplementedError("__call__ method is not implemented.")
2024-06-14 12:59:44 +08:00
class TestCase:
def __init__(
self,
target_task: BaseTask,
ground_truth: TaskImplementation,
):
self.ground_truth = ground_truth
self.target_task = target_task
class TaskLoader:
@abstractmethod
def load(self, *args, **kwargs) -> BaseTask | list[BaseTask]:
raise NotImplementedError("load method is not implemented.")