Skip to content

Commit

Permalink
ignore mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mozman committed Dec 15, 2024
1 parent 5847c88 commit 063bb39
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/ezdxf/math/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,17 +311,17 @@ 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__

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__

Expand All @@ -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__

Expand All @@ -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

Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ezdxf/npshapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
4 changes: 2 additions & 2 deletions src/ezdxf/render/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 063bb39

Please sign in to comment.