Commit Graph

97 Commits

Author SHA1 Message Date
Adam Turner
f4c8a0a68e Insert `from __future__ import annotations` 2023-01-01 20:48:37 +00:00
Adam Turner
b91f6617ed Enable Ruff's pylint 'PLC2201' check
Address all cases where the comparison order check is violated
2022-12-30 00:06:11 +00:00
Adam Turner
7649eb1505 Clean up after dropping Python 3.6 2022-09-27 18:31:47 +01:00
Takeshi KOMIYA
7e68154e49
Drop python 3.6 support (#10468) 2022-06-16 19:33:55 +01:00
Takeshi KOMIYA
29edce9243 test: Add testcase for autodoc_inherit_docstring and attributes (refs: #10539) 2022-06-14 02:49:07 +09:00
Takeshi KOMIYA
d3af85c809
Merge branch '5.0.x' into 9648_autodoc_typehints_description_and_stared_args 2022-05-22 13:37:57 +09:00
Takeshi KOMIYA
d8a540e922 Fix #9575: autodoc: Return annotation should not be shown 2022-05-15 20:51:42 +09:00
Takeshi KOMIYA
92fcac321b test: Add *args and **kwargs to testcase of target.typehints 2022-05-15 19:05:17 +09:00
Takeshi KOMIYA
d5e76d69e8 test: Prepend "~typing" to the result of autodata
The default setting has been changed since 5.0.
2022-05-08 00:44:28 +09:00
Takeshi KOMIYA
7134317e49 Merge remote-tracking branch 'origin/5.x' into HEAD 2022-05-07 22:37:58 +09:00
Takeshi KOMIYA
96b15e9e66
Merge pull request #10353 from tk0miya/10305_optional_forwardref_annotations
Fix #10305: autodoc: Failed to extract optional forwardrefs
2022-05-03 02:03:28 +09:00
Adam Turner
4674cc11c8 .write_text(...) -> .write_text(..., encoding='utf8') 2022-04-27 03:11:08 +01:00
Adam Turner
24e3b7c8c8 .read_text() -> .read_text(encoding='utf8') 2022-04-27 03:04:19 +01:00
Takeshi KOMIYA
a66adb1c32 Fix #10305: autodoc: Failed to extract optional forwardrefs
Autodoc fails to extract optional forwardrefs (ex. `Optional[MyClass]`)
even if `MyClass` is declared in `autodoc_type_aliases`.
2022-04-17 03:09:11 +09:00
zuqq
a450518bb1 Apply autodoc_typehints_format to all type hints
Specifically: attributes, data, properties, and type variable bounds.
2022-04-08 20:27:24 +01:00
Takeshi KOMIYA
e38c1bda01 Fix a testcase 2022-04-03 22:44:12 +09:00
Takeshi KOMIYA
fd42063725 autodoc_typehints_description_target: Rename returnvalue_and_documented_params to documented_params 2022-04-03 22:42:44 +09:00
Takeshi KOMIYA
f731bf1999 Merge branch '5.x' into autodoc_force_undocumented_rtype 2022-04-03 22:29:22 +09:00
Takeshi KOMIYA
a78c07ca07 Fix #10280: autodoc_docstring_signature generates needless return typehint
Basically, autodoc suppresses return value typehint for class
constructors.  But it was unexpectedly shown if
`autodoc_docstring_signature` is enabled and docstring has multiple
signatures.
2022-04-03 16:32:35 +09:00
Takeshi KOMIYA
aa1bc83c2a Merge branch '4.x' 2022-03-19 22:58:15 +09:00
Takeshi KOMIYA
b12b39db05
Merge pull request #10212 from AA-Turner/remove-module-docstring-titles
Remove module docstring titles
2022-03-14 02:14:17 +09:00
Takeshi KOMIYA
f7a0107ddb Merge branch '4.x' 2022-03-03 02:28:07 +09:00
Takeshi KOMIYA
12104fe5de test: Follow the new behavior of typing.get_type_hints() since py311
Since python-3.11, `typing.get_type_hints()` will not add Optional[t] to
type annotations even if a default value for function argument is None.

refs: https://github.com/python/cpython/pull/30304 (bpo-46195)
2022-03-03 01:34:21 +09:00
Adam Turner
5775912455 Collapse single line docstrings 2022-02-20 03:13:45 +00:00
Adam Turner
6bb7b891a1 Remove copyright and licence fields 2022-02-20 03:06:23 +00:00
Adam Turner
5694e0ce60 Fix module docstring indentation 2022-02-20 00:35:13 +00:00
Adam Turner
4f5a3269a6 Fix module docstring first line 2022-02-20 00:11:08 +00:00
Adam Turner
6b8bccec59 Remove module titles in docstrings 2022-02-19 23:17:29 +00:00
Takeshi KOMIYA
616f112e6a autodoc: The default of autodoc_typehints_format becomes to 'smart'
The default value of autodoc_typehints_format configuration is changed
to `'smart'`.  It will suppress the leading module names of typehints
(ex. `io.StringIO` -> `StringIO`).

refs: #9075
2022-01-02 17:35:19 +09:00
Takeshi KOMIYA
e1c090d9f7
Merge pull request #10034 from tk0miya/10027_autodoc_typehints_format_for_bases
Fix #10027: autodoc_typehints_format does not work with :show-inheritance:
2022-01-02 11:39:22 +09:00
Takeshi KOMIYA
f38bd8e952 Merge branch '4.3.x' into 4.x 2022-01-01 20:02:10 +09:00
Takeshi KOMIYA
b84771dcd2 A happy new year! 2022-01-01 18:45:03 +09:00
Takeshi KOMIYA
3fc98a2b3d Fix #10027: autodoc_typehints_format does not work with :show-inheritance: 2022-01-01 18:06:57 +09:00
Takeshi KOMIYA
1f71f85fd6 Fix #10015: autodoc: autodoc_typehints_format='short' does not work when autodoc_typehints='description' 2021-12-27 02:23:02 +09:00
Takeshi KOMIYA
f3a098d4e9
Merge branch '4.x' into 9194_Literal_type_not_hyperlinked 2021-12-26 20:34:38 +09:00
Takeshi KOMIYA
7da429924e Fix testcase in py36 case 2021-12-26 20:34:05 +09:00
Takeshi KOMIYA
bdbad40f57 Fix #9194: autodoc: Prepend the "typing" module name on the signature
To create hyperlinks to container types automatically, this prepends the
module names for the types under "typing" module.
2021-12-26 01:04:40 +09:00
Takeshi KOMIYA
a87153c018 autodoc: Rename autodoc_unqualified_typehints to autodoc_typehints_format (refs: #9931) 2021-12-24 10:14:19 +09:00
Takeshi KOMIYA
c71ff1cd21 Close #9075: autodoc: Add a config variable autodoc_unqualified_typehints
If autodoc_unqualified_typehints feature enabled, autodoc suppresses the
leading module names of typehints of function signatures (ex.
`io.StringIO` -> `StringIO`)
2021-12-03 18:05:49 +09:00
gschwaer
1caf4823f2 feat: add tests and fix None rtype 2021-11-29 20:06:37 +01:00
Takeshi KOMIYA
f88ac53e51 Fix #9883: autodoc: doccomment for the alias to mocked object was ignored 2021-11-29 02:06:16 +09:00
Takeshi KOMIYA
5fb6fb6039 Fix #9651: autodoc_typehints_description_target was confused by :returns:
It only checks the existence of `:return:` field.  And it does not check
`:returns:` field.  It causes the absence of return types.
2021-09-26 02:10:13 +09:00
Christian Clauss
86583c578c Fix typos discovered by codespell 2021-09-08 02:15:25 +02:00
Jeremy Maitin-Shepard
6c969ac87e Fix autodoc_docstring_signature support for __init__ and __new__
The `MethodDocumenter.get_doc` method added by
51ae283a38 prevents
DocstringSignatureMixin from working correctly for __init__ and
__new__ methods.  Additionally, the __new__ docstring was not obtained
correctly.

This commit checks for `self._new_docstrings` being set, and also
corrects the logic for obtaining the __new__ docstring.

There still remains the issue that when the class signature is
obtained from the signature of __init__ or __new__, only the real
signature is used, due to the use of `sphinx.util.inspect.signature`;
the autodoc_docstring_signature option does not have any effect.
2021-07-31 09:32:40 -07:00
Takeshi KOMIYA
2aef00d7bd Fix #9384: autodoc_typehints='none' supports typehints for attributes 2021-06-29 21:57:26 +09:00
Takeshi KOMIYA
51ae283a38 Close #4257: autodoc: Add autodoc_class_signature
Add `autodoc_class_signature` to separate the class entry and the
definition of `__init__()` method.
2021-05-16 01:53:48 +09:00
Ashley Whetter
28d3f8136e autodoc.typehints can accurately represent overloads 2021-05-08 21:34:25 -07:00
Takeshi KOMIYA
28ab5f233c Close #8588: autodoc: autodoc_type_aliases supports dotted name
It allows users to define an alias for a class with module name
like `foo.bar.BazClass`.
2021-05-03 18:47:47 +09:00
Takeshi KOMIYA
70ea4381ca
Merge pull request #8841 from AWhetter/autodoc_signatures_without_backslash
Overloaded function signatures do not require a separating backslash
2021-04-04 18:02:01 +09:00
Matt Wozniski
4c72848b85 Test autodoc_typehint_undoc
Add new tests to exercise the new autodoc_typehint_undoc option. Where
an existing test would have a meaningful behavior change with the new
option set to False, that test is copied, the new option is set to False
in the copy, and the assertions reflect the new expected behavior.

The new test test_autodoc_typehints_description_with_documented_init
illustrates the problem reported in #7329, and the new test
test_autodoc_typehints_description_with_documented_init_no_undoc
illustrates that this issue no longer occurs when the new
autodoc_typehint_undoc option is set to False.
2021-03-27 14:54:38 -04:00