Format argument signatures using inspect.Signature on Python 3.x.
Review Request #10632 — Created July 19, 2019 and submitted
inspect.formatargspec()was used to generate Python code
representing function signatures, but modern versions of Python 3.x
provide better support for this through an
This can be populated with information about the function (parameters,
annotations, etc.), and a string can be computed from that.
inspect.formatargspec()now uses this, but emits a
We now use
inspect.Signaturewhen available, and feed in parameters
the same way that
inspect.formatargspec()does, while avoiding its
deprecation warning. Down the road, we'd be able to use this to support
type annotations as well.
Unit tests pass on Python 2.7, 3.5, 3.6, and 3.7.