Skip to content

Commit 0a9ea12

Browse files
committed
MyPy fixes
1 parent 0985c34 commit 0a9ea12

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/matrix/matrix.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,17 @@ def input_matrix(
213213
cls,
214214
height: Optional[int] = None,
215215
width: Optional[int] = None,
216-
postprocess: Callable[[str], _MVT] = None, # noqa
216+
postprocess: Union[Callable[[str], _MVT], Callable[[str], List[_MVT]]] = None, # noqa
217217
*,
218218
width_first: bool = False,
219219
by_rows: bool = False,
220220
walkthrow: Walkthrow = Walkthrow.DEFAULT,
221221
) -> Matrix: # pragma: no cover
222222
if postprocess is None:
223-
postprocess = int.__call__ if not by_rows else lambda x: list(map(int, x.split()))
223+
if by_rows:
224+
postprocess = lambda x: list(map(int, x.split()))
225+
else:
226+
postprocess = int.__call__
224227
assert postprocess is not None
225228
if width_first:
226229
height = height or int(input())

0 commit comments

Comments
 (0)