[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Description
As of NumPy 1.25, functions like np.mean are no longer instances of types.FunctionType (because they are C, rather than Python, functions). See this discussion. This was leading to the error in #683 and #682, and causing a number of tests to fail.
This PR fixes the issue by replacing types.FunctionType with typing.Callable. (If this is considered too broad, an alternative solution would be to add type(np.mean) to the relevant type checks; I'd be happy to write this up instead.)
Tests on the files I updated are passing; some other tests are failing for me for reasons having to do with a behavior change in sklearn, unrelated to this PR.
@allispaul thank you for your PR and contribution. as I mentioned in my other message, i will force merge this PR and try to fix all the CI and make a new realease.
Reference issues/PRs Fixes #682. Fixes #683.
Types of changes
Description As of NumPy 1.25, functions like
np.mean
are no longer instances oftypes.FunctionType
(because they are C, rather than Python, functions). See this discussion. This was leading to the error in #683 and #682, and causing a number of tests to fail.This PR fixes the issue by replacing
types.FunctionType
withtyping.Callable
. (If this is considered too broad, an alternative solution would be to addtype(np.mean)
to the relevant type checks; I'd be happy to write this up instead.)Tests on the files I updated are passing; some other tests are failing for me for reasons having to do with a behavior change in
sklearn
, unrelated to this PR.Checklist
flake8
to check my Python changes.pytest
to check this on Python tests.