replace api.run with static methods

This commit is contained in:
Andrej
2025-06-09 10:59:22 +05:00
parent 02d359d0e6
commit 8b4683aef1
122 changed files with 1334 additions and 1370 deletions
@@ -38,7 +38,7 @@ from typing import Any, Union
class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
def test_np_rotation_matrix(self):
from mathutils import Matrix, Vector
from mathutils import Matrix, Vector # pyright: ignore[reportMissingImports]
# 2D.
assert np.allclose(Matrix.Rotation(radians(45), 2), np_rotation_matrix(radians(45), 2))
@@ -59,7 +59,7 @@ class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
assert np.allclose(Matrix.Rotation(*rotation_vector_args), np_rotation_matrix(*rotation_vector_args))
def test_np_matrix_to_euler(self):
from mathutils import Euler
from mathutils import Euler # pyright: ignore[reportMissingImports]
# Test 3x3.
rot = Euler((0.5, 0.5, 0.5)).to_matrix()
@@ -74,7 +74,7 @@ class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
assert np.allclose(rot.to_euler(), np_matrix_to_euler(V(rot)))
def test_np_angle(self):
from mathutils import Vector
from mathutils import Vector # pyright: ignore[reportMissingImports]
v1, v2 = (1, 0, 0), (0, 1, 0)
angle = np_angle(v1, v2)
@@ -97,7 +97,7 @@ class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
assert is_x(angle, radians(90))
def test_np_normal(self):
import mathutils.geometry
import mathutils.geometry # pyright: ignore[reportMissingImports]
vectors = (0, 0, 0), (1, 0, 0), (0, 1, 0)
n = mathutils.geometry.normal(vectors)
@@ -110,7 +110,7 @@ class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
assert np.allclose(n, (0, 0, -1))
def test_np_intersect_line_line(self):
import mathutils.geometry
import mathutils.geometry # pyright: ignore[reportMissingImports]
p1, p2 = [0, 0, 0], [1, 1, 1]
q1, q2 = [0, 1, 0], [1, 0, 1]