diff --git a/iodata/__main__.py b/iodata/__main__.py index 4fa75fdc..47f5f49c 100755 --- a/iodata/__main__.py +++ b/iodata/__main__.py @@ -20,6 +20,7 @@ """CLI for file conversion.""" import argparse +from typing import Optional import numpy as np @@ -31,7 +32,7 @@ __version__ = "0.0.0.post0" -__all__ = () +__all__ = ("convert",) DESCRIPTION = """\ @@ -88,7 +89,7 @@ def parse_args(): "--allow-changes", default=False, action="store_true", - help="Allow (not trivially reversible) conversion the input data to make it compatible " + help="Allow (not trivially reversible) conversion of the input data to make it compatible " "with the output format. Warnings will be emitted for all changes made.", ) parser.add_argument( @@ -103,7 +104,14 @@ def parse_args(): return parser.parse_args() -def convert(infn: str, outfn: str, many: bool, infmt: str, outfmt: str, allow_changes: bool): +def convert( + infn: str, + outfn: str, + many: bool = False, + infmt: Optional[str] = None, + outfmt: Optional[str] = None, + allow_changes: bool = False, +): """Convert file from one format to another. Parameters diff --git a/iodata/test/test_cli.py b/iodata/test/test_cli.py index 37d71b7b..a0b1f131 100644 --- a/iodata/test/test_cli.py +++ b/iodata/test/test_cli.py @@ -23,6 +23,7 @@ import sys from functools import partial from importlib.resources import as_file, files +from typing import Optional from warnings import warn import pytest @@ -33,7 +34,14 @@ from ..utils import FileFormatError, PrepareDumpError, PrepareDumpWarning -def _convscript(infn: str, outfn: str, many: bool, infmt: str, outfmt: str, allow_changes: bool): +def _convscript( + infn: str, + outfn: str, + many: bool = False, + infmt: Optional[str] = None, + outfmt: Optional[str] = None, + allow_changes: bool = False, +): """Simulate the convert function by calling iodata-convert in a subprocess.""" args = [sys.executable, "-m", "iodata.__main__", infn, outfn] if many: