Skip to content

Commit

Permalink
Fix type hints for read/write_array
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Jan 29, 2024
1 parent c319c14 commit a26ed13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions freeqdsk/_fileutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ def read_line(fh: TextIO, fmt: str) -> List[Any]:
return ff.FortranRecordReader(fmt).read(line)


def read_array(shape: Union[int, str, ArrayLike], fh: TextIO, fmt: str) -> np.ndarray:
def read_array(
shape: Union[int, str, ArrayLike, tuple[int, int]], fh: TextIO, fmt: str
) -> np.ndarray:
r"""
Reads from a Fortran formatted ASCII data file. It is assumed that the array is
flattened and stored in Fortran order (column-major). Information is read from a
Expand Down Expand Up @@ -337,7 +339,7 @@ def write_line(data: Iterable[Any], fh: TextIO, fmt: str) -> None:
fh.write("\n")


def write_array(arr: ArrayLike, fh: TextIO, fmt: str) -> None:
def write_array(arr: Union[ArrayLike, tuple[int, ...]], fh: TextIO, fmt: str) -> None:
r"""
Writes to a Fortran formatted ASCII data file. The provided array is flattened and
written in Fortran order (column-major). Information is written to a file handle
Expand Down

0 comments on commit a26ed13

Please sign in to comment.