Open bnavigator opened 9 months ago
And with typeguard:
[ 6s] ======================================================================
[ 6s] ERROR: test_success (tests.test_typeguard.TypeguardTest)
[ 6s] ----------------------------------------------------------------------
[ 6s] Traceback (most recent call last):
[ 6s] File "/home/abuild/rpmbuild/BUILD/nptyping-2.5.0/tests/test_typeguard.py", line 24, in test_success
[ 6s] fun(np.random.randn(2, 2))
[ 6s] File "/home/abuild/rpmbuild/BUILD/nptyping-2.5.0/tests/test_typeguard.py", line 14, in fun
[ 6s] def fun(_: NDArray[Shape["2, 2"], Float]) -> None:
[ 6s] File "/home/abuild/rpmbuild/BUILD/nptyping-2.5.0/nptyping/base_meta_classes.py", line 145, in __getitem__
[ 6s] args = cls._get_item(item)
[ 6s] File "/home/abuild/rpmbuild/BUILD/nptyping-2.5.0/nptyping/base_meta_classes.py", line 213, in _get_item
[ 6s] raise InvalidArgumentsError(
[ 6s] nptyping.error.InvalidArgumentsError: Unexpected argument of type <class 'tuple'>, expecting a string.
[ 6s]
[ 6s] ----------------------------------------------------------------------
Hello, I have the same problem.
Beartype is testing that PEP 604 is respected this way:
repr(your_nptyping_type | int) == "your_nptyping_type | 1"
The result is different because NDArrayMeta class doesn't have an or dunder method. Btw, the equivalent need to be done for for the DataFrame meta class I guess.
I think that adding one would solve the issue. However, it looks like that nptyping is not maintained anymore, no pull request accepted or commit made since a year. It would be sad to loose such a great tool!
Testing with beartype 0.17 produces the following output: