Closed Yoshanuikabundi closed 1 year ago
Patch coverage: 88.88%
and project coverage change: -0.06%
:warning:
Comparison is base (
799b5b2
) 99.09% compared to head (2d5f27d
) 99.04%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
When the
inspect
module of the standard library is used to get the signature of aGufeTokenizable
class, it sees that the metaclass has an implementation of__call__
and takes the signature from that instead of from the__new__
or__init__
method of the child class:This results in unhelpful API documentation:
But also may affect the signature displayed by IDEs, the Jupyter
help
magic, and so on.This PR restores the signature from
__init__
or__new__
when a child class is created:(I've taken screenshots from the GUFE docs, but this problem affects the OpenFE docs as well, and this solution fixes them too)
See https://stackoverflow.com/questions/49740290/call-from-metaclass-shadows-signature-of-init. I originally wrote a solution defining a
__signature__
property on the metaclass, but this solution seems more... canonical.