Skip to content

Commit

Permalink
More AI Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tovrstra committed Jul 14, 2024
1 parent aa2cc20 commit 0a4d979
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
14 changes: 11 additions & 3 deletions iodata/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""CLI for file conversion."""

import argparse
from typing import Optional

import numpy as np

Expand All @@ -31,7 +32,7 @@
__version__ = "0.0.0.post0"


__all__ = ()
__all__ = ("convert",)


DESCRIPTION = """\
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down
10 changes: 9 additions & 1 deletion iodata/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 0a4d979

Please sign in to comment.