From b4e819fb4555a20e86cd4afcb99dc3f37bf6d240 Mon Sep 17 00:00:00 2001 From: Olaf Haag Date: Wed, 8 Nov 2023 23:29:07 +0100 Subject: [PATCH] test: fix numpy array return type use numpy.typing.NDArray to type array and dtype correctly --- .pre-commit-config.yaml | 1 + src/readyplayerme/meshops/mesh.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b8e77d8..daf4492 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,6 +45,7 @@ repos: rev: 'v1.5.1' hooks: - id: mypy + additional_dependencies: [numpy] - repo: https://github.com/espressif/conventional-precommit-linter rev: v1.2.1 diff --git a/src/readyplayerme/meshops/mesh.py b/src/readyplayerme/meshops/mesh.py index e29c993..1fd6465 100644 --- a/src/readyplayerme/meshops/mesh.py +++ b/src/readyplayerme/meshops/mesh.py @@ -4,6 +4,7 @@ from typing import TypeAlias import numpy as np +import numpy.typing as npt import trimesh # Abstraction for the mesh type. @@ -37,7 +38,7 @@ def read_glb(filename: str | Path) -> Mesh: return trimesh.load(filename, process=False, force="mesh") -def get_border_vertices(mesh: Mesh) -> np.array: +def get_border_vertices(mesh: Mesh) -> npt.NDArray[np.int64]: """Return the indices of the vertices on the borders of a mesh. :param mesh: The mesh to get the border vertices from.