Skip to content

Commit 7c82635

Browse files
committed
#9 Update return type of list command
1 parent b569dd9 commit 7c82635

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

deshima_rawdata/cli.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# standard library
55
import tarfile
66
from pathlib import Path
7+
from typing import Any, Literal, overload
78

89

910
# dependencies
@@ -79,14 +80,24 @@ def download(
7980
return data_path.with_name(dir_name)
8081

8182

82-
def list(format: str = DEFAULT_LIST_FORMAT) -> str:
83+
@overload
84+
def list(format: Literal["csv", "json", "markdown"]) -> str:
85+
...
86+
87+
88+
@overload
89+
def list(format: Literal["dict"]) -> dict[str, str]:
90+
...
91+
92+
93+
def list(format: str = DEFAULT_LIST_FORMAT) -> Any:
8394
"""List DESHIMA raw datasets available in the package.
8495
8596
Args:
8697
format: Format of the list that can be output by pandas.
8798
8899
Returns:
89-
String of the list with given format.
100+
The list of DESHIMA raw datasets with given format.
90101
91102
"""
92103
return getattr(DATA_LIST, f"to_{format}")()

0 commit comments

Comments
 (0)