Skip to content

Commit

Permalink
#9 Update return type of list command
Browse files Browse the repository at this point in the history
  • Loading branch information
astropenguin committed Nov 16, 2023
1 parent b569dd9 commit 7c82635
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions deshima_rawdata/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# standard library
import tarfile
from pathlib import Path
from typing import Any, Literal, overload


# dependencies
Expand Down Expand Up @@ -79,14 +80,24 @@ def download(
return data_path.with_name(dir_name)


def list(format: str = DEFAULT_LIST_FORMAT) -> str:
@overload
def list(format: Literal["csv", "json", "markdown"]) -> str:
...


@overload
def list(format: Literal["dict"]) -> dict[str, str]:
...


def list(format: str = DEFAULT_LIST_FORMAT) -> Any:
"""List DESHIMA raw datasets available in the package.
Args:
format: Format of the list that can be output by pandas.
Returns:
String of the list with given format.
The list of DESHIMA raw datasets with given format.
"""
return getattr(DATA_LIST, f"to_{format}")()
Expand Down

0 comments on commit 7c82635

Please sign in to comment.