refactor: Add sphinx.util.inspect.signature()

As a successor of sphinx.util.inspect.Singnature, this adds
signature() function behaves like `inspect.signature()`.  It is
very similar to way of python's inspect module.

In addition, this also adds stringify_annotation() helper to
sphinx.util.inspect module.  With these two functions, we can move
to python's Signature object to represent function signatures
perfectly.  It's natural design for python developers than ever.
This commit is contained in:
Takeshi KOMIYA
2020-01-08 22:57:24 +09:00
parent ae8fc43024
commit 5867416612
6 changed files with 214 additions and 124 deletions

View File

@@ -21,9 +21,7 @@ Deprecated
* ``sphinx.roles.Index``
* ``sphinx.util.detect_encoding()``
* ``sphinx.util.get_module_source()``
* ``sphinx.util.inspect.Signature.format_annotation()``
* ``sphinx.util.inspect.Signature.format_annotation_new()``
* ``sphinx.util.inspect.Signature.format_annotation_old()``
* ``sphinx.util.inspect.Signature``
Features added
--------------