Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tiny refactor in opuscleaner.datasets #136

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions opuscleaner/datasets.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
"""Lists datasets given a directory. It works by scanning the directory and looking for gz files."""
import os
from functools import wraps
from glob import glob
from itertools import groupby
from pathlib import Path as Path
from typing import Iterable, Dict, List, Tuple
from typing import Dict, List, Tuple

from opuscleaner.config import DATA_PATH


def list_datasets(path:str) -> Dict[str,List[Tuple[str,Path]]]:
Expand Down Expand Up @@ -42,7 +42,10 @@ def list_datasets(path:str) -> Dict[str,List[Tuple[str,Path]]]:
def main() -> None:
import sys
import pprint
pprint.pprint(list_datasets(sys.argv[1]))
if len(sys.argv) == 1:
pprint.pprint(list_datasets(DATA_PATH))
else:
pprint.pprint(list_datasets(sys.argv[1]))


if __name__ == '__main__':
Expand Down