Commit Graph

82 Commits

Author SHA1 Message Date
Takeshi KOMIYA
6d1cafe7bd autodoc: Add Optional[t] to annotation of function and method
As typing.get_type_hints() doing, this adds Optional[t] to type
annotations if a default value equal to None is set.

Note: this is default behavior of inspect.signature() since Python 3.10.
2020-11-10 02:41:58 +09:00
Takeshi KOMIYA
e31189d970 test: do not use "object" for the type annotation
Usually we use "Any" type for the type annotation which takes any kinds
of types, instead of "object" class.  So this replaces "object" to "Any"
in our example.
2020-11-08 12:57:54 +09:00
Takeshi KOMIYA
cc97a07640 Fix #7785: autodoc_typehints=none does not effect to overloads 2020-10-24 20:54:56 +09:00
Takeshi KOMIYA
f2c0dfe7c4 Close #6518: autodoc: Add autodoc_type_aliases
autodoc_type_aliases allows to keep user defined type alises not
evaluated in the generated document.
2020-10-03 16:03:35 +09:00
Takeshi KOMIYA
c0157cf074 refactor: test: Rename target.enum to target.enums
Using "enum" for module name bothers me on debugging errors because
it sometimes raises ImportError.
2020-08-03 02:30:30 +09:00
Takeshi KOMIYA
4e739b85ee Fix #7850: autodoc: KeyError is raised for invalid mark up 2020-06-26 20:49:22 +09:00
Takeshi KOMIYA
800dcf0f0a Close #2106: autodoc: Support multiple signatures on docstring 2020-05-30 15:40:21 +09:00
Eric Wieser
d229b120ad Fix autoclass signature parsing
This fixes:
* Signatures defined by __new__
* Signatures defined by metaclasses
* Signatures defined by builtin base classes

All of these changes bring the sphinx docs inline with the behavior of `inspect.signature`.

Note that this changes autodoc to output `.. py:class: MyClass()` with parentheses even if no user-defined __init__ is present.
This is quite deliberate, as if no user-defined `__init__` is present the default is `object.__init__`, which indeed does not take arguments.
2020-05-28 08:36:56 +01:00
Kjell Braden
db72c18cf9 add testcase for complex typehintsext.autodoc.typehints 2020-05-10 20:46:29 +09:00
Takeshi KOMIYA
eef7e4cdd5 test: Rename test_autodoc.py to test_ext_autodoc.py 2020-05-06 13:55:45 +09:00
Takeshi KOMIYA
91a22a3ecc
Merge pull request #7358 from tk0miya/refactor_autodoc
refactor: autodoc: Remove needless spaces from blank line
2020-03-22 17:55:32 +09:00
Takeshi KOMIYA
9ebad705b8 refactor: autodoc: Remove needless spaces from blank line 2020-03-22 17:47:18 +09:00
Takeshi KOMIYA
d517aa6c16 Close #7079: Make autodoc_typehints=description formal 2020-03-07 13:19:37 +09:00
Takeshi KOMIYA
954db2bd27 Merge branch '2.0' 2020-02-16 21:42:20 +09:00
Takeshi KOMIYA
98d24464f1 refactor: Support suppressed type_comment (refs: #7152) 2020-02-16 17:32:21 +09:00
gpotter2
51b80ab121 Fix #7146 2020-02-14 16:12:12 +00:00
Takeshi KOMIYA
4dd8b1022f test: Use read_text() and read_bytes() 2020-02-01 11:58:51 +09:00
Takeshi KOMIYA
e7a0af807a Merge branch '2.0' 2020-01-30 23:29:32 +09:00
Takeshi KOMIYA
5397664d42 Add a new extension: sphinx.ext.autodoc.typehints 2020-01-25 17:56:39 +09:00
Takeshi KOMIYA
347e301727 Merge branch '2.0' 2020-01-19 22:47:02 +09:00
Takeshi KOMIYA
ffdfb6cb87 Close #2755: autodoc: Support type_comment style annotation
Note: python3.8+ or typed_ast is required
2020-01-13 13:23:45 +09:00
Takeshi KOMIYA
0319faf8f1 Merge branch '2.0' 2020-01-01 14:40:39 +09:00
Takeshi KOMIYA
eaf495c3c4 A happy new year! 2020-01-01 14:27:43 +09:00
Takeshi KOMIYA
01f8dad160 Merge branch '2.0' 2019-08-19 00:37:30 +09:00
Takeshi KOMIYA
ace7b4ded7 Fix #6589: autodoc: Formatting issues with autodoc_typehints='none' 2019-08-02 01:55:53 +09:00
jfbu
685e3fdb49 Merge branch '2.0' 2019-08-01 17:49:24 +02:00
Takeshi KOMIYA
1c088ec163 Fix #6567: autodoc: autodoc_inherit_docstrings does not effect to __init__() 2019-07-11 01:39:17 +09:00
Takeshi KOMIYA
9f470cec6c Merge branch '2.0' 2019-06-09 01:27:34 +09:00
Takeshi KOMIYA
81e2e1d971 test: Update testcase for autoclass_content and autodoc_docstring_signature 2019-06-03 23:20:33 +09:00
Takeshi KOMIYA
f7851b62e0 test: Update testcase for autoclass_content 2019-06-03 23:20:33 +09:00
Takeshi KOMIYA
f4114bb794 test: Update testcase for autodoc_inherit_docstrings 2019-06-03 22:34:35 +09:00
Takeshi KOMIYA
7de8c63407 test: Move testcases for autodoc configurations to test_ext_autodoc_configs 2019-06-03 01:28:56 +09:00