use isclass instead of not isfunction

It is not always true that `not isfunction(...) is isclass(...)`
This commit is contained in:
Ryan Morshead 2022-09-02 17:12:31 -07:00 committed by GitHub
parent a929f124c8
commit 88bd986740
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -272,7 +272,7 @@ def _parameters_for(func: Any) -> dict[str, bool]:
A dictionary mapping the parameter name to whether or not it is
required (a.k.a., is positional only/does not have a default).
"""
is_class = not inspect.isfunction(func)
is_class = inspect.isclass(func)
if is_class:
func = func.__init__