-
-
Notifications
You must be signed in to change notification settings - Fork 270
Expand file tree
/
Copy pathbase.py
More file actions
55 lines (41 loc) · 1.34 KB
/
base.py
File metadata and controls
55 lines (41 loc) · 1.34 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
from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Iterable
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from requests import Response
from openml._api.http import HTTPClient
from openml.datasets.dataset import OpenMLDataset
from openml.setups.setup import OpenMLSetup
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 SetupsAPI(ResourceAPI, ABC):
@abstractmethod
def list(
self,
limit: int,
offset: int,
*,
setup: Iterable[int] | None = None,
flow: int | None = None,
tag: str | None = None,
) -> list[OpenMLSetup]: ...
@abstractmethod
def _create_setup(self, result_dict: dict) -> OpenMLSetup: ...
@abstractmethod
def get(self, setup_id: int) -> tuple[str, OpenMLSetup]: ...
@abstractmethod
def exists(self, file_elements: dict[str, Any]) -> int: ...