Commit Graph

3404 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
François Freitag
0178437f3c Rewrite test_inspect_main_url to avoid mocking
Makes the test more realistic by issuing an HTTP request.
Reduces coupling between test and the code under test.

The `http_server` helper was factored out into a new tests.utils module.
2020-11-08 22:30:49 +01:00
Takeshi KOMIYA
e2bf9166da Fix #8219: autodoc: Parameters for generic base class are not shown 2020-11-09 02:34:49 +09:00
Takeshi KOMIYA
896ecc34d7 Merge branch '3.x' into 8119_control_appearance_of_member_not_in_module.__all__ 2020-11-08 17:40:13 +09:00
Takeshi KOMIYA
a163bbe870 Merge pull request #8385 from tk0miya/dont_use_object_to_annotation
test: do not use "object" for the type annotation
2020-11-08 13:15:40 +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
6d05b1aeb3 Fix #8105: autodoc: the signature of decorated class is incorrect
In #7651, autodoc stops to undecorate the functions on getting the
signature from the callables.  But some kinds of decorators conceals
the correct signature because they pass through their arguments via
`(*args, **kwargs)`.

This restarts to undecorate the functions again as before #7651.
2020-11-05 01:57:40 +09:00
Takeshi KOMIYA
f46c14bbca Merge pull request #8355 from sphinx-doc/7613_class__signature__
Fix #7613: autodoc: autodoc does not respect __signature__ of the class
2020-11-05 01:51:17 +09:00
Takeshi KOMIYA
2be6aaa7a4 Merge branch '3.3.x' into 3.x 2020-11-05 01:20:33 +09:00
Takeshi KOMIYA
218de39462 Fix testcases for singledispatch are sometimes failed
They are sometimes failed with python3.5 because the order of singledispatch
functions is not stable on python 3.5.  This uses comparision via "in"
keyword to check the signature of singledispatch functions stably.
2020-11-04 23:19:27 +09:00
Takeshi KOMIYA
7065dc0157 Merge branch '3.x' into 7613_class__signature__ 2020-11-03 11:39:23 +09:00
Takeshi KOMIYA
9f0f34cbda Close #8119: autodoc: Control visibility of module member not in __all__
This allows `autodoc-skip-member` handlers to determine whether a member
not included in `__all__` attribute of the module should be documented or
not.
2020-11-03 02:28:32 +09:00
Takeshi KOMIYA
0e98e9b1a8 Fix #6914: Emit a detailed warning when failed to resolve :ref:
To be clear the ambiguous warning for missing-reference :ref:,
this separates the warning to missing-label and missing-caption.

To emit a warning dynamically, this also adds a new event:
`warn-missing-reference` to customize warning messages via event
handlers.
2020-11-03 02:27:43 +09:00
Takeshi KOMIYA
b415b25c09 Merge branch '3.2.x' into 3.x 2020-11-01 20:31:49 +09:00
Takeshi KOMIYA
9a44e45277 Fix #7613: autodoc: autodoc does not respect __signature__ of the class 2020-11-01 18:27:16 +09:00
Takeshi KOMIYA
68c89f471c Merge pull request #8050 from keewis/preprocess-other-sections
Preprocess other sections
2020-10-30 01:54:34 +09:00
Takeshi KOMIYA
921f097906 Merge pull request #8051 from keewis/fix-see_also
use the obj role for all See Also items
2020-10-30 00:49:59 +09:00
Takeshi KOMIYA
871f43f778 Merge branch '3.x' into 7785_autodoc_typehints_none_for_overloads 2020-10-28 02:13:49 +09:00
Matthias Geier
82c83ed478 autodoc: Add test for single-string __slots__ 2020-10-25 10:27:43 +01:00
Takeshi KOMIYA
cc97a07640 Fix #7785: autodoc_typehints=none does not effect to overloads 2020-10-24 20:54:56 +09:00
Takeshi KOMIYA
6e1c78f3b4 Merge pull request #8295 from tk0miya/refactor_root
refactor: Remove rst_epilog from test-root/conf.py
2020-10-24 20:27:30 +09:00
Jakob Lykke Andersen
37f1454ec1 C, C++, improve warnings on duplicates 2020-10-24 12:22:02 +02:00
Takeshi KOMIYA
071b14884c Merge pull request #8303 from larsoner/tuple
TST: Add test
2020-10-24 17:52:22 +09:00
Takeshi KOMIYA
2a77eb07d0 Merge branch '3.x' into 3.2.x_to_3.x 2020-10-24 17:18:12 +09:00
Jakob Lykke Andersen
15251574a9 C, fix links to function parameters 2020-10-13 12:42:19 +02:00
Eric Larson
d10802fa6a TST: Add test 2020-10-07 14:25:24 -04:00
Takeshi KOMIYA
4f19f400bf refactor: Remove rst_epilog from test-root/conf.py
I found test-root defines rst_epilog in its conf.py.  It causes
side-effects to many test cases in Sphinx's testing because test-root
is widely used.  This removes the configuration from test-root not to
cause side-effects to our testings.

Note: We already have test cases for rst_epilog in test_util_rst.
2020-10-06 01:53:29 +09:00
Takeshi KOMIYA
0476e1cea9 Merge pull request #8283 from tk0miya/7786_overloads_in_other_file
Fix #7786: autodoc: can't detect overloaded methods defined in other file
2020-10-06 01:33:22 +09:00
Takeshi KOMIYA
6dbe28a632 Fix #7786: autodoc: can't detect overloaded methods defined in other file 2020-10-05 22:49:05 +09:00
Takeshi KOMIYA
cc941db40b Fix #8255: py domain: number in defarg is changed to decimal
Number literals in default argument value is converted to decimal form
unexpectedly by AST module.  This fixes the signature parsing code to
recosntruct it correctly.

Note: This is only available in Python 3.8+.
2020-10-05 01:08:14 +09:00
Takeshi KOMIYA
0b32e72635 pycode: ast.unparse() construct number literals using source code
Developers can write number literals in several ways. For example,
decimal (1234), hexadecimal (0x1234), octal decimal (0o1234) and so on.
But, AST module don't mind how the numbers written in the code. As a
result, ast.unparse() could not reproduce the original form of number
literals.

This allows to construct number literals as possible using original
source code.

Note: This is only available in Python 3.8+.
2020-10-05 01:08:14 +09:00
Takeshi KOMIYA
38bb377464 Merge pull request #8273 from sphinx-doc/7996_man_make_section_directory
Close #7996: manpage: Add man_make_section_directory
2020-10-04 22:40:41 +09:00
Takeshi KOMIYA
d8cb7aa4f6 Merge pull request #8120 from tk0miya/6640_allow_to_override_system_message
Fix #6640: i18n: Failed to override system message translation
2020-10-04 13:48:04 +09:00
Takeshi KOMIYA
37235c71e0 Fix #6640: i18n: Failed to override system message translation
Our document describes that users can override system messages via
their own message catalog named `sphinx.mo` under the locale_dirs.
But it has not been used since its beginning of i18n mechanism because
the priority of users' message catalog is lower than system's.

This makes the priority of users' message catalog higher than system's.
2020-10-04 13:31:37 +09:00
Takeshi KOMIYA
3096b71c1c Merge branch '3.x' into 7964_tuple_in_signature 2020-10-04 11:53:41 +09:00
Takeshi KOMIYA
9a0a0f9ae1 Fix #8157: autodoc: TypeError is raised when annotation has invalid __args__
Typically, the __args__ attribute of type annotations is a tuple
containing arguments for the types (ex. The __args__ of `List[int]` is
`(int,)`).  But some kind of types has non tuple __args__ attribute.
For example, `nptyping.NDArray` is one of them.

This fixes the TypeError when the invalid __args__ attribute found.
2020-10-04 11:43:57 +09:00
Jakob Lykke Andersen
777bcb43fa C++, properly reject functions as duplicates
Fixes sphinx-doc/sphinx#8270
2020-10-03 16:00:28 +02:00
Takeshi KOMIYA
178c05b059 Close #7996: manpage: Add man_make_section_directory
Add a new config variable; man_make_section_directory to make a
section directory on build man page.  During 3.x, it defaults to
False and will be changed to True on 4.0 release.
2020-10-03 22:30:20 +09:00
Takeshi KOMIYA
88b81a06eb Merge pull request #8272 from francoisfreitag/strip_whitespaces
Strip trailing whitespaces and normalize line endings
2020-10-03 21:42:53 +09:00
Takeshi KOMIYA
1eaa06844e Merge pull request #8269 from francoisfreitag/raise-anchor
Fix #8268: make linkcheck report HTTP errors
2020-10-03 21:42:29 +09:00
François Freitag
5ea8ee133d Fix #8268: make linkcheck report HTTP errors 2020-10-03 14:33:29 +02:00
François Freitag
5166dd194c Strip trailing whitespaces and normalize line endings
Trailing whitespace do not have impact on the result, they are just
unused bytes. Most text editors are configured to strip trailing
whitespaces. Remove them all in one go.

Update a handful of files to use the UNIX line ending.
2020-10-03 13:47:01 +02: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
785f4d695c Fix #7964: autodoc: Tuple in default value is wrongly rendered
This implements tuple literal support to sphinx.pycode.ast.unparse().
2020-10-03 12:01:20 +09:00
Takeshi KOMIYA
ec06f5571e Merge pull request #8142 from jcarrano/typing-generic-signatures
autodoc: fix constructor signatures for classes derived from typing.Generic
2020-10-03 01:23:36 +09:00
Robert Cohn
3d81abef9c respond to review comments 2020-10-01 11:12:39 -04:00
Robert Cohn
c08214fe92 add parallel to SphinxTestApp 2020-09-30 20:47:56 -04:00
Takeshi KOMIYA
b454d4e4b0 Merge branch '3.x' into 8190_autodoc-process-docstring-without_ending_blankline 2020-09-21 00:49:23 +09:00
Jakob Lykke Andersen
49e7400123 C, fix names in get_objects()
Fixes sphinx-doc/sphinx#8160
2020-09-14 21:16:15 +02:00
Takeshi KOMIYA
dfbe687db6 Merge branch '3.x' into 8103_cached_property 2020-09-13 11:07:33 +09:00