Commit Graph

131 Commits

Author SHA1 Message Date
Takeshi KOMIYA
a0e44a7300 test: Migrate to Node.findall() from Node.traverse() 2022-01-03 01:06:20 +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
5da68c3de3 Fix py domain: "typing" types are not hyperlinked in info-field-list 2021-12-27 02:23:02 +09:00
Takeshi KOMIYA
0a5783f75b py domain: Suppress the leading "typing." module from typehints
To support creating hyperlinks to container types naturally, py domain
should take fully-qualified typehints for them.  But nobody wants to
show "typing." module name on the signature. So this suppresses them
automatically.
2021-12-25 02:50:31 +09:00
Takeshi KOMIYA
94cbce69da Fix #9194: autodoc: types in typing module are not hyperlinked
This converts types in typing module to valid references when
`autodoc_unqualified_typehints` option enabled.
2021-12-25 02:50:31 +09:00
Takeshi KOMIYA
49f576569c Fix autodoc: Failed to parse Literal type in py36 and py37 2021-12-25 02:41:38 +09:00
Takeshi KOMIYA
627d73a683 test: Remove debug print 2021-12-19 18:15:56 +09:00
Takeshi KOMIYA
5eaed2bed7 py domain: Allow "~" prefix as a prefix of typehints in signature
Now python domain supports the "~" prefix at the beginning of the
typehints of the function signatures:

  .. py:function:: func(x: ~typing.Dict)

It's rescognized as the same as python reference roles do
(ex. :py:class:`~typing.Dict`).
2021-11-30 01:54:23 +09:00
Takeshi KOMIYA
acaf70596e Fix #9899: py domain: Allows cross-reference specifier to :type: option 2021-11-29 00:32:56 +09:00
Takeshi KOMIYA
52787deb32 Fix #9775: py domain: Literal typehint was converted to a cross reference 2021-10-30 16:57:33 +09:00
Takeshi KOMIYA
34f957f131
Merge branch '4.x' into 9697_property_with_parens 2021-10-09 14:00:39 +09:00
Jakob Lykke Andersen
a64196f048 js/py nodes, update arglist rendering 2021-10-03 10:17:31 +02:00
Takeshi KOMIYA
b9204186f0 Fix #9697: An index entry with parens was registered for py:method 2021-10-03 13:03:23 +09:00
Jakob Lykke Andersen
fb45dba61e py nodes, isort fix 2021-10-02 12:42:17 +02:00
Jakob Lykke Andersen
01ef6a437f py nodes, PyObject anno 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
ae7865aaf8 py nodes, PyProperty get_signature_prefix 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
5a3b7f130d py nodes, PyMethod get_signature_prefix 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
51e7b6d2aa py nodes, PyClassLike, get_signature_prefix 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
83fcc98dbc py nodes, PyFunction get_signature_prefix 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
8cd0847590 py nodes, PyProperty 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
73ade60654 py nodes, PyAttribute value 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
2e37c5719d py nodes, PyAttribute type 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
e008b43683 py nodes, PyVariable value 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
3979bbad7f py nodes, PyVariable type 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
3a1bd32665 py nodes, arglist 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
92a9df7451 py nodes, Tuple 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
c00e608783 py nodes, List 2021-10-02 12:41:40 +02:00
Jakob Lykke Andersen
1cb8c56720 py nodes, BitOr 2021-10-02 12:41:40 +02:00
Takeshi KOMIYA
34664ce4ce Fix #9576: py domain: Literal typehint was converted to a cross reference
The content of Literal typehint should not be converted to cross
references.
2021-09-03 22:09:30 +09:00
Takeshi KOMIYA
3e24190564 Fix #9585: py:property directive does not create a hyperlink for types 2021-08-31 23:55:12 +09:00
Takeshi KOMIYA
120525563c Cloase #9445: :py:property: directive now supports :classmethod: option
Since python 3.9, `classmethod` starts to support creating a "class
property".  This allows to describe it.
2021-07-17 14:24:31 +09:00
Takeshi KOMIYA
866719f48f Merge branch '4.x' into 9427 2021-07-11 02:12:32 +09:00
Takeshi KOMIYA
dd89c3689e py domain: Add testcase for empty callable (refs: #9427) 2021-07-11 02:12:23 +09:00
Takeshi KOMIYA
90470b094e Close #9268: python_use_unqualified_type_names supports type field 2021-06-03 00:09:16 +09:00
Takeshi KOMIYA
201f61f722 Fix #9280: py domain: "exceptions" module is not displayed
Since v0.2, python domain gives a special treatment for the exceptions
module to suppress its name on documenting exception classes.  It had
been worthy on python2 era.  But the module has been removed since
python3.  Therefore, the special treatment becomes harmful for user
libraries.  This removes it to render module names correctly.

Note: Now we've only supported python3.  So this is not incompatible.
2021-05-30 03:46:55 +09:00
Takeshi KOMIYA
a1b0e55548 Close #1874: py domain: Support union types using | in info-field-list 2021-05-22 01:55:43 +09:00
Takeshi KOMIYA
d9be8f6d4e Fix #9224: info-field-list does not support a type containing space
So far, DocFieldTransformer has split the field name for `:type:`
and `:param:` at the first whitespace.  Therefore, it does not allow
to use a type containing whitespace (ex. `Dict[str, str]`).

This changes the splitting logic to divide the field name at the last
whitespace (a.k.a `rstrip()`).  It allows to use whitespaces on types.
2021-05-15 20:31:09 +09:00
Takeshi KOMIYA
4ab0dba755 Fix #9205: py domain: canonical option causes xref resolution error
The :canonical: option causes "more than one target for
cross-reference" warning because the class having the same name is
registered.
2021-05-11 01:15:14 +09:00
Takeshi KOMIYA
d02a466cb5 Fix #9121: py domain: duplicated warning for canonical and alias
A duplicated warning is emitted when both canonical and its alias
objects are defined on the same document. But it should not be emitted
because they're the same object, not conflicted.
2021-04-23 01:19:18 +09:00
Takeshi KOMIYA
c7b169c5a9 Fix #8127: py domain: Ellipsis in info-field-list causes nit-picky warning
On parsing the types, the leading dot of the ellipsis (...) is considered
as a reference name.  And its first dot is considered as a notation for
relative type reference (ex. ".ClassName"). As a result, it was converted
double dots unexpectedly.

This changes the parsing rule to treat the ellipsis as a symbol, not a
name.
2021-04-17 02:06:57 +09:00
Takeshi KOMIYA
204f86f736 py domain: Add py:property directive to describe a property (refs: #7068) 2021-03-11 01:56:39 +09:00
Takeshi KOMIYA
930a880294 Fix #7199: py domain: Add a new confval: python_use_unqualified_type_names
Add a new config variable: python_use_unqualified_type_names.  If enabled,
it goes to suppress the module name of the python reference if it can be
resolved.
2021-03-06 14:00:00 +09:00
jfbu
fbafb308b8 Merge branch '3.x' into master_with_merged_3.x 2021-02-02 18:01:55 +01:00
Takeshi KOMIYA
2c2b8c1154 py domain: Support type union operator (PEP-604) (refs: #8775)
Upgrade annotation parser for python domain to support type union
operator introduced in PEP-604.  It's available on all python
interpreters.
2021-02-01 21:12:29 +09:00
Takeshi KOMIYA
30f8640bab Merge branch '3.x' 2021-01-16 21:51:46 +09:00
Takeshi KOMIYA
a3df1d00c7 test: Add testcase for relative/short xref for py domain 2021-01-11 03:12:39 +09:00
Takeshi KOMIYA
918086b559 Close #5977: :var: field do not create a cross-reference
Since its beginning, `:var:` field has created a cross-reference to the
attribute having the same name.  It is meaningful only if the attribute
is documented by `py:attribute` directive.  It means the `:var:` field
and `:attr:` role are almost the same and conflicted.  Additionally,
the cross-reference points incorrect variable if the target is not
documented.

Thus, the cross-reference feature of `:var:` field is disabled.
2021-01-01 22:53:23 +09:00
Takeshi KOMIYA
9cac2001f7 test: py domain: Add a testcase for :var: field 2021-01-01 18:15:42 +09:00
Takeshi KOMIYA
4b452338f9 Merge branch '3.x' 2021-01-01 13:57:19 +09:00