Skip to content

Commit 2124d07

Browse files
committed
Use TypeAlias for proper mypy type checking
1 parent 342ee9c commit 2124d07

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

matrix/similar_matrices.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@
3030
from __future__ import annotations
3131

3232
from collections.abc import Sequence
33-
from typing import Any
33+
from typing import Any, TypeAlias
3434

3535
from sympy import Matrix, nsimplify
3636
from sympy.matrices.common import MatrixError
3737

3838
__all__ = ["are_similar_matrices"]
3939

4040

41-
matrix_like = Sequence[Sequence[Any]] | Matrix
41+
MatrixLike: TypeAlias = Sequence[Sequence[Any]] | Matrix
4242

4343

44-
def _as_square_matrix(matrix: matrix_like, *, simplify_entries: bool) -> Matrix:
44+
def _as_square_matrix(matrix: MatrixLike, *, simplify_entries: bool) -> Matrix:
4545
"""Return a SymPy matrix after validating that ``matrix`` is square.
4646
4747
Parameters
@@ -95,8 +95,8 @@ def _jordan_signature(matrix: Matrix) -> tuple[tuple[Any, tuple[int, ...]], ...]
9595

9696

9797
def are_similar_matrices(
98-
matrix_a: matrix_like,
99-
matrix_b: matrix_like,
98+
matrix_a: MatrixLike,
99+
matrix_b: MatrixLike,
100100
*,
101101
simplify_entries: bool = True,
102102
) -> bool:

0 commit comments

Comments
 (0)