Commit Graph

115 Commits

Author SHA1 Message Date
Takeshi KOMIYA
0565da6512 Fix testcases that failed in python3.10.0b4 2021-07-20 00:25:32 +09:00
Takeshi KOMIYA
31ec519d38 Close #9272: autodoc: Render enum values for the default argument value better 2021-05-30 02:15:28 +09:00
Takeshi KOMIYA
0fb8e33f32 Fix #9250: autodoc: The inherited method not having docstring is wrongly parsed
`sphinx.util.inspect.getdoc()` clean the docstring up if the method is
inherited and not having docstring.  That causes indentations are
removed on processing it.
2021-05-23 00:39:05 +09:00
Takeshi KOMIYA
1513d50774 Merge branch '4.0.x' into 4.x 2021-05-13 01:51:57 +09:00
Takeshi KOMIYA
d18840b38d Fix test: the result of stringify_signature() has been changed randomly in py36 2021-05-13 01:40:45 +09:00
Takeshi KOMIYA
77da494173
Merge pull request #9153 from tk0miya/9082_python3.10.0a7
Revert "test: Disable testing with python3.10"
2021-05-05 22:22:30 +09:00
Takeshi KOMIYA
531a5ae9ef test: Adjust type annotataions in python 3.10.0b1 2021-05-05 22:11:41 +09: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
7d3cc382fa autodoc: an imported TypeVar is not resolved (refs: #8415)
So far, a TypeVar is rendered without module name. As a result, it
could not be resolved if it is imported from other modules.  This
prepends its module name and make it resolvable.  This is available
only in Python 3.7 or above.

As a side effect, all of TypeVars are displayed with module name. It
should be fixed in latter step (refs: #7119)
2021-02-28 15:58:06 +09:00
Takeshi KOMIYA
4b452338f9 Merge branch '3.x' 2021-01-01 13:57:19 +09:00
Takeshi KOMIYA
f996859420 A happy new year!
.. note::

   $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \;
   $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
2021-01-01 13:40:48 +09:00
Takeshi KOMIYA
a00d62c445 Merge branch '3.x' 2020-11-22 16:04:07 +09:00
François Freitag
419e145e36
Make tests/ a Python package
Allows relative imports.
2020-11-20 19:43:02 +01:00
Takeshi KOMIYA
3a4ae2092a Merge branch '3.x' 2020-11-21 01:01:36 +09:00
Takeshi KOMIYA
5d8d6275a5
Merge pull request #8423 from tk0miya/getslots
Add sphinx.util.inspect:getslots() to get __slots__ attribute
2020-11-16 02:04:42 +09:00
Takeshi KOMIYA
21a3bd4127 refactor: Fix flake8 violations under tests/ directory 2020-11-15 17:15:40 +09:00
Takeshi KOMIYA
bbb0ea5f12 Add sphinx.util.inspect:getslots() to get __slots__ attribute 2020-11-15 02:30:25 +09:00
Takeshi KOMIYA
279e547860 Merge branch '3.x' 2020-11-12 02:50:43 +09:00
Takeshi KOMIYA
68cc0f7e94
Merge pull request #8408 from francoisfreitag/isort
Sort imports with isort
2020-11-12 02:05:13 +09:00
François Freitag
0949735210
Sort imports with isort
Keep imports alphabetically sorted and their order homogeneous across
Python source files.

The isort project has more feature and is more active than the
flake8-import-order plugin.

Most issues caught were simply import ordering from the same module.
Where imports were purposefully placed out of order, tag with
isort:skip.
2020-11-11 13:19:05 +01:00
Takeshi KOMIYA
1254b80113 Merge branch '3.x' 2020-11-10 23:21:51 +09:00
Takeshi KOMIYA
1b9099f339 test: Adjust type annotataions in python 3.10 2020-11-10 22:33:03 +09:00
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
bbcd471557 Merge branch '3.x' 2020-11-09 02:50:08 +09:00
Takeshi KOMIYA
6d5e43a0ff Drop code for supporting py35 2020-11-06 01:36:04 +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
17a5a29f1e Fix #7935: autodoc: A default value inspect._empty conseals signatures
A function signature is not shown when the function has a parameter
having ``inspect._empty`` as its default value because Signature class
validates function signatures on instantiation.
2020-07-12 14:03:28 +09:00
Takeshi KOMIYA
a59f83b6bd Add sphinx.util.inspect:signature_from_ast() 2020-05-31 23:22:20 +09:00
Takeshi KOMIYA
c063c9c0fe
Merge pull request #7757 from tk0miya/7756_posonlyargs
Fix #7756: py domain: The default value for posonlyarg is not shown
2020-05-31 23:21:21 +09:00
Takeshi KOMIYA
bb0b69544b Fix #7756: py domain: The default value for posonlyarg is not shown 2020-05-31 12:21:55 +09:00
Takeshi KOMIYA
e20f29e325 Add sphinx.util.inspect:isgenericalias() 2020-05-30 21:06:54 +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
Takeshi KOMIYA
0526e0a56c
Merge branch '3.x' into 7650_undecorated_signature 2020-05-16 14:56:54 +09:00
John R. Lenton
61378fe048 Make sphinx.util.typing.stringify render optional unions better
Without this change, stringify(Optional[Union[int, str]]) returns
'Union[int, str, None]' rather than the expected 'Optional[...]'.

This change fixes that.

fixes: #7654
2020-05-11 17:20:45 +01:00
Takeshi KOMIYA
3a81ffa79a Fix #7650: autodoc: undecorated signature is shown for decorated functions 2020-05-11 01:11:12 +09:00
Takeshi KOMIYA
6c65327be7
Merge pull request #7624 from tk0miya/refactor_autodoc2
refactor: autodoc: class processors on autofunction is no longer needed
2020-05-09 18:10:55 +09:00
Eric Wieser
c8a4c79daf Do not crash if is_builtin_class_method is passed a non-type 2020-05-08 08:54:53 +01:00
Takeshi KOMIYA
24fe05f14f refactor: autodoc: class processors on autofunction is no longer needed 2020-05-07 01:55:33 +09:00
Takeshi KOMIYA
13113fc0b6 Fix #6588: autodoc: Decorated inherited method has no documentation 2020-04-28 22:33:40 +09:00
Takeshi KOMIYA
b2140c8623 Fix #7510: py domain: keyword-only arguments are wrongly rendered 2020-04-19 22:57:38 +09:00
Takeshi KOMIYA
754d04f80d Merge branch '2.4.x' into 3.x 2020-02-22 19:22:31 +09:00
Takeshi KOMIYA
56eca39cbb Fix a testcase: lambda function renderer has been changed in 3.x 2020-02-22 17:04:05 +09:00
Takeshi KOMIYA
6a439c0bd6
Merge pull request #7155 from tk0miya/function_signature2
py domain: Use AST parser to convert signature to doctree
2020-02-22 16:35:59 +09:00
Takeshi KOMIYA
2fec37219f Fix #7189: autodoc: classmethod coroutines are not detected 2020-02-22 00:49:45 +09:00
Takeshi KOMIYA
63ece93473
Merge pull request #7163 from tk0miya/fix_DeprecationWarning
Fix DeprecationWarnings on testing
2020-02-16 21:45:29 +09:00
Takeshi KOMIYA
7e79822355 Remove testscases for getargspec() (deprecated) 2020-02-16 21:22:23 +09:00
Takeshi KOMIYA
822625d14c Add sphinx.util.inspect:signature_from_str() 2020-02-16 01:43:13 +09:00
Takeshi KOMIYA
cd8f3a78d9 Fix #7156: autodoc: separator for keyword only arguments is not shown 2020-02-16 01:37:23 +09:00
Takeshi KOMIYA
e908e43f67 Fix #7023: autodoc: nested partial functions are not listed 2020-01-17 09:15:45 +09:00
Takeshi KOMIYA
9ed162921e autodoc: Support Positional-Only Argument separator (PEP-570 compliant) 2020-01-11 02:32:33 +09:00