mikedh / trimesh

Python library for loading and using triangular meshes.

Home Page:https://trimesh.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typing issue for is_empty

friggog opened this issue · comments

Recent releases cause mypy to fail when typing is_empty -

@abc.abstractmethod
def is_empty(self) -> bool:

The abstract method is typed as a method but the implementation is as a property:

trimesh/trimesh/base.py

Lines 1637 to 1638 in 94b8cea

@property
def is_empty(self) -> bool:

This means mypy fails with truthy-function

Hey, yeah definitely wrong, seems like we could just add the property decorator to the parent and fix this. It would be nice to unit test all the type hints (#2188 ) as otherwise they're likely to be intermittently incorrect.

I thought this should have caught this bug:

pytest --typeguard-packages=trimesh test_mutate.py

However since the subclass has correct type hints the parent isn't caught. Any ideas on how to check these?

Do you have any mypy checks running? this usually turns up any typing errors for us, particularly if configured to be reasonably strict