From 063bb398c5c4ed036611c8699668bd0b9a0e3a86 Mon Sep 17 00:00:00 2001 From: mozman Date: Sun, 15 Dec 2024 10:23:46 +0100 Subject: [PATCH] ignore mypy issues --- src/ezdxf/math/linalg.py | 16 ++++++++-------- src/ezdxf/npshapes.py | 2 +- src/ezdxf/render/trace.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ezdxf/math/linalg.py b/src/ezdxf/math/linalg.py index 4a3d00d84..5d4312413 100644 --- a/src/ezdxf/math/linalg.py +++ b/src/ezdxf/math/linalg.py @@ -311,7 +311,7 @@ def __mul__(self, other: Matrix | float) -> Matrix: if isinstance(other, Matrix): return Matrix(matrix=np.matmul(self.matrix, other.matrix)) else: - matrix = Matrix(matrix=self.matrix * float(other)) + matrix = Matrix(matrix=self.matrix * float(other)) # type: ignore return matrix __imul__ = __mul__ @@ -319,9 +319,9 @@ def __mul__(self, other: Matrix | float) -> Matrix: def __add__(self, other: Matrix | float) -> Matrix: """Matrix addition by another matrix or a float, returns a new matrix.""" if isinstance(other, Matrix): - return Matrix(matrix=self.matrix + other.matrix) + return Matrix(matrix=self.matrix + other.matrix) # type: ignore else: - return Matrix(matrix=self.matrix + float(other)) + return Matrix(matrix=self.matrix + float(other)) # type: ignore __iadd__ = __add__ @@ -331,9 +331,9 @@ def __sub__(self, other: Matrix | float) -> Matrix: """ if isinstance(other, Matrix): - return Matrix(matrix=self.matrix - other.matrix) + return Matrix(matrix=self.matrix - other.matrix) # type: ignore else: - return Matrix(matrix=self.matrix - float(other)) + return Matrix(matrix=self.matrix - float(other)) # type: ignore __isub__ = __sub__ @@ -346,7 +346,7 @@ def inverse(self) -> Matrix: if self.nrows != self.ncols: raise TypeError("Inverse of non-square matrix not supported.") try: - return Matrix(matrix=np.linalg.inv(self.matrix)) + return Matrix(matrix=np.linalg.inv(self.matrix)) # type: ignore except np.linalg.LinAlgError: raise ZeroDivisionError @@ -445,7 +445,7 @@ def numpy_matrix_solver(A: MatrixData | NDArray, B: MatrixData | NDArray) -> Mat """ mat_A = np.array(A, dtype=np.float64) mat_B = np.array(B, dtype=np.float64) - return Matrix(matrix=np.linalg.solve(mat_A, mat_B)) + return Matrix(matrix=np.linalg.solve(mat_A, mat_B)) # type: ignore def numpy_vector_solver(A: MatrixData | NDArray, B: Iterable[float]) -> list[float]: @@ -486,7 +486,7 @@ def solve_matrix(self, B: MatrixData | NDArray) -> Matrix: """ mat_B = np.array(B, dtype=np.float64) - return Matrix(matrix=np.linalg.solve(self.mat_A, mat_B)) + return Matrix(matrix=np.linalg.solve(self.mat_A, mat_B)) # type: ignore def solve_vector(self, B: Iterable[float]) -> list[float]: """Solves the linear equation system given by the nxn Matrix diff --git a/src/ezdxf/npshapes.py b/src/ezdxf/npshapes.py index 686d0007f..b548ac8b4 100644 --- a/src/ezdxf/npshapes.py +++ b/src/ezdxf/npshapes.py @@ -113,7 +113,7 @@ def to_list(self) -> list[list[float]]: """Returns the shape vertices as list of lists e.g. [[1, 2], [3, 4], ...] """ - return self._vertices.tolist() + return self._vertices.tolist() # type: ignore def bbox(self) -> BoundingBox2d: """Returns the bounding box of all vertices.""" diff --git a/src/ezdxf/render/trace.py b/src/ezdxf/render/trace.py index d9d104793..4e1d89863 100644 --- a/src/ezdxf/render/trace.py +++ b/src/ezdxf/render/trace.py @@ -338,7 +338,7 @@ def from_spline( spline.derivatives(t, n=1), np.linspace(start_width, end_width, count) ): normal = Vec2(derivative).orthogonal(True) - curve_trace._append(Vec2(point), normal, width) + curve_trace._append(Vec2(point), normal, width) # type: ignore return curve_trace @classmethod @@ -373,7 +373,7 @@ def from_arc( arc.vertices(arc.angles(count)), np.linspace(start_width, end_width, count), ): - curve_trace._append(point, point - center, width) + curve_trace._append(point, point - center, width) # type: ignore return curve_trace def _append(self, point: Vec2, normal: Vec2, width: float) -> None: