forked from openml/openml-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.py
More file actions
60 lines (45 loc) 路 1.42 KB
/
Copy pathbase.py
File metadata and controls
60 lines (45 loc) 路 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import pandas as pd
from requests import Response
from openml._api.http import HTTPClient
from openml.datasets.dataset import OpenMLDataset
from openml.flows.flow import OpenMLFlow
from openml.tasks.task import OpenMLTask
class ResourceAPI:
def __init__(self, http: HTTPClient):
self._http = http
class DatasetsAPI(ResourceAPI, ABC):
@abstractmethod
def get(self, dataset_id: int) -> OpenMLDataset | tuple[OpenMLDataset, Response]: ...
class TasksAPI(ResourceAPI, ABC):
@abstractmethod
def get(
self,
task_id: int,
*,
return_response: bool = False,
) -> OpenMLTask | tuple[OpenMLTask, Response]: ...
class FlowsAPI(ResourceAPI, ABC):
@abstractmethod
def get(
self,
flow_id: int,
) -> OpenMLFlow: ...
@abstractmethod
def exists(self, name: str, external_version: str) -> int | bool: ...
@abstractmethod
def list(
self,
*,
limit: int | None = None,
offset: int | None = None,
tag: str | None = None,
uploader: str | None = None,
) -> pd.DataFrame: ...
@abstractmethod
def create(self, flow: OpenMLFlow) -> OpenMLFlow | tuple[OpenMLFlow, Response]: ...
@abstractmethod
def delete(self, flow_id: int) -> None | Response: ...