Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correct the downloaded parameters path
Browse files Browse the repository at this point in the history
MAfarrag committed Jan 5, 2025

Verified

This commit was signed with the committer’s verified signature.
prusnak Pavol Rusnak
1 parent ab77c23 commit 098a276
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/Hapi/parameters/parameters.py
Original file line number Diff line number Diff line change
@@ -393,14 +393,14 @@ def __init__(self, api_client: FigshareAPIClient):
self.api_client = api_client

def get_parameter_set_details(
self, set_id: int, version: Optional[int] = None
self, set_id: Union[int, str], version: Optional[int] = None
) -> Dict[str, int]:
"""
Retrieve details of a parameter set from the Figshare API.
Parameters
----------
set_id : int
set_id : int/str
The ID of the parameter set to retrieve.
version : int, optional, default is None
The version of the parameter set.
@@ -445,7 +445,7 @@ def get_parameter_set_details(
endpoint += f"/versions/{version}"
return self.api_client.send_request("GET", endpoint)

def list_files(self, set_id: int, version: Optional[int] = None):
def list_files(self, set_id: Union[int, str], version: Optional[int] = None):
"""
List all files in an article.
@@ -484,7 +484,7 @@ def list_files(self, set_id: int, version: Optional[int] = None):
return details.get("files", [])

def download_files(
self, set_id: int, download_dir: Path, version: Optional[int] = None
self, set_id: Union[int, str], download_dir: Path, version: Optional[int] = None
):
r"""
Download all files in an article to the specified directory.
@@ -640,7 +640,9 @@ def get_parameters(self, download_dir: Path):
self.get_parameter_set(set_id, download_dir)
logger.debug(f"Downloaded parameter set: {set_id} to {download_dir}")

def get_parameter_set(self, set_id: int, download_dir: Optional[Path] = None):
def get_parameter_set(
self, set_id: Union[int, str], download_dir: Optional[Path] = None
):
r"""
Download all parameter sets to the specified directory.
2 changes: 1 addition & 1 deletion tests/rrm/conftest.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
@pytest.fixture(scope="session")
def download_03_parameter():
"""Download Parameter Set 03"""
if not os.path.exists("Hapi/parameters/3"):
if not os.path.exists("src/Hapi/parameters/3"):
par = Parameter()
par.get_parameter_set(3)

0 comments on commit 098a276

Please sign in to comment.