Skip to content

Commit 48fa391

Browse files
committed
modify get method to use use_chache by default
Signed-off-by: Omswastik-11 <omswastikpanda11@gmail.com>
1 parent 4560b6b commit 48fa391

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

openml/_api/resources/base/resources.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ class RunsAPI(ResourceAPI, ABC):
3838
resource_type: ResourceType = ResourceType.RUN
3939

4040
@abstractmethod
41-
def get(
42-
self, run_id: int, *, use_cache: bool = True, reset_cache: bool = False
43-
) -> OpenMLRun: ...
41+
def get(self, run_id: int, *, reset_cache: bool = False) -> OpenMLRun: ...
4442

4543
@abstractmethod
4644
def list( # type: ignore[valid-type] # noqa: PLR0913

openml/_api/resources/runs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def get(
2121
self,
2222
run_id: int,
2323
*,
24-
use_cache: bool = True,
2524
reset_cache: bool = False,
2625
) -> OpenMLRun: # type: ignore[override]
2726
"""Fetch a single run from the OpenML server.
@@ -44,7 +43,7 @@ def get(
4443
path = f"run/{run_id}"
4544
response = self._http.get(
4645
path,
47-
use_cache=use_cache,
46+
use_cache=True,
4847
reset_cache=reset_cache,
4948
use_api_key=True,
5049
)
@@ -189,7 +188,6 @@ def get(
189188
self,
190189
run_id: int, # noqa: ARG002
191190
*,
192-
use_cache: bool = True, # noqa: ARG002
193191
reset_cache: bool = False, # noqa: ARG002
194192
) -> OpenMLRun: # type: ignore[override]
195193
"""Fetch a single run from the V2 server.

openml/runs/functions.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -812,19 +812,18 @@ def get_run(run_id: int, ignore_cache: bool = False) -> OpenMLRun: # noqa: FBT0
812812
Whether to ignore the cache. If ``true`` this will download and overwrite the run xml
813813
even if the requested run is already cached.
814814
815-
ignore_cache
815+
ignore_cache : bool
816+
Whether to ignore the cache. If ``true`` this will download and overwrite the run xml
817+
even if the requested run is already cached.
816818
817819
Returns
818820
-------
819821
run : OpenMLRun
820822
Run corresponding to ID, fetched from the server.
821823
"""
822-
use_cache = not ignore_cache
823-
reset_cache = ignore_cache
824824
return api_context.backend.runs.get(
825825
run_id,
826-
use_cache=use_cache,
827-
reset_cache=reset_cache,
826+
reset_cache=ignore_cache,
828827
)
829828

830829

0 commit comments

Comments
 (0)