Commit Graph

297 Commits

Author SHA1 Message Date
Jakob Lykke Andersen
4534d2d1a5 fields, call roles instead of making a pending_xref
Except for py which has mixins that assumes a single pending_xref
2021-06-03 16:36:37 +02: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
2ddc1d0681
Merge pull request #9258 from tk0miya/1874_piped_types_in_info-field-list
Close #1874: py domain: Support union types using `|` in info-field-list
2021-05-23 00:42:56 +09:00
Takeshi KOMIYA
5a8dec457a refactor: reduce calls of find_pending_xref_conditions (refs: #9240)
After #9246, `find_pending_xref_conditions()` should be only called from
intended modules.  At present, the Python Domain is the only module to
call it intendedly.  Therefore, this removes the needless calls of the
utility function from "unintended" modules.
2021-05-22 15:34:30 +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
71e732014f Merge branch '4.0.x' into 4.x 2021-05-11 02:35:15 +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
2ee634bfda refactor: Add Optional to type annotations 2021-05-10 02:01:24 +09:00
Takeshi KOMIYA
e21e18441f
Merge pull request #9118 from chrisjsewell/fix-typing
🐛 FIX: `Config.__getitem__` typing
2021-04-24 17:37:40 +09:00
Chris Sewell
9019144590 remove type: ignore 2021-04-23 22:40:07 +02: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
035019629a refactor: Use PEP-526 based variable annotation (sphinx.domains) 2021-03-23 01:33:32 +09:00
Takeshi KOMIYA
e03d0aeba0
Merge pull request #8991 from tk0miya/typing_OptionSpec
refactor: Add a type alias for the option_spec of directives; OptionSpec
2021-03-15 13:03:15 +09:00
Takeshi KOMIYA
4915ea6f71
Merge pull request #8996 from tk0miya/7119_pending_xref_conditions
Fix #7119: autodoc: Broken doctree was generated by builtin_resolver
2021-03-15 01:10:52 +09:00
Takeshi KOMIYA
5b5730ef4e Avoid a mypy warning 2021-03-15 00:46:19 +09:00
Takeshi KOMIYA
6c7480b3f6 Fix #7119: autodoc: Broken doctree was generated by builtin_resolver
The builtin_resolver() generates broken doctree unexpectedly if it
contains pending_xref_condition nodes.
2021-03-14 00:10:00 +09:00
Takeshi KOMIYA
a523a89663 refactor: Add a type alias for the option_spec of directives; OptionSpec 2021-03-13 17:15:12 +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
Takeshi KOMIYA
8b1bf6dfc9 refactor: py domain: Put if-block for ast.Constant to the root level 2021-02-03 21:29:53 +09:00
jfbu
e7b05111bc Re-insert if isinstance(node, ast.Constant): into py _parse_annotation
As master drop python 3.5 support, conditional

    if sys.version_info >= (3, 6):

not needed anymore.  This hunk had got lost in merge.

	modified:   sphinx/domains/python.py
2021-02-03 10:09:06 +01: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
5460ea103b Merge branch '3.x' 2021-01-08 01:23:17 +09:00
Takeshi KOMIYA
bad2444ed5 refactor: Update typehints for ObjectDescription using Generic 2021-01-03 22:50:38 +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
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
a7a77d154b Merge branch '3.x' 2020-12-20 21:33:57 +09:00
Takeshi KOMIYA
30c594fbc5 Fix #8365: py domain: :type: and :rtype: gives false ambiguous warnings
The searching context like py:module and py:class are missing in the
pending_xref nodes generated from info-field-lists.  This sets these
searching context info to them.
2020-12-19 18:42:01 +09:00
Takeshi KOMIYA
b718aef7d8 Do isort 2020-11-12 02:52:50 +09:00
Takeshi KOMIYA
279e547860 Merge branch '3.x' 2020-11-12 02:50:43 +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
6d5e43a0ff Drop code for supporting py35 2020-11-06 01:36:04 +09:00
Takeshi KOMIYA
49018ec68d Fix a mypy violation 2020-08-01 18:01:56 +09:00
Takeshi KOMIYA
c14c00397e Merge branch '3.x' 2020-08-01 16:59:00 +09:00
Takeshi KOMIYA
a99675bf78 Fix #8008: py domain: failed to parse a type annotation containing ellipsis
Fix _parse_annotation() does not support a type annotation having ellipsis.
2020-07-30 01:48:25 +09:00
Takeshi KOMIYA
327c187284 Merge branch '3.x' 2020-07-24 23:49:45 +09:00
Tetsuo Koyama
ae7c4cc3b8 fix typo 2020-07-19 00:43:11 +00:00
Takeshi KOMIYA
68327ba2e6 refactor: namedtuples with PEP 526
Apply PEP 526 based variable annotation style to namedtuples.  It
is available since python 3.6.
2020-07-16 23:17:50 +09:00
Takeshi KOMIYA
4410668776 Fix #7928: py domain: failed to resolve a type annotation for the attribute 2020-07-09 01:49:34 +09:00
Takeshi KOMIYA
1a223209f2 Merge branch '3.x' 2020-07-05 19:56:21 +09:00
Jakob Lykke Andersen
c668500a4b Add :noindexentry: option
Fixes sphinx-doc/sphinx#7052
2020-07-04 19:34:00 +02:00
Takeshi KOMIYA
fa9dc7c698 Merge tag 'v3.1.1' 2020-07-05 00:13:23 +09:00
Takeshi KOMIYA
cd7d3c0ddd Fix #7808: autodoc: Warnings raised on variable and attribute type annotations 2020-06-10 22:58:39 +09:00
Takeshi KOMIYA
3c7d35d2a2 Merge branch '3.x' 2020-05-17 19:12:56 +09:00
Takeshi KOMIYA
e5dad73cf2 py domain: Add :canonical: option 2020-05-04 14:49:50 +09:00
Takeshi KOMIYA
88e8ebbe19 Close #7596: py domain: Change a type annotation for variables to a hyperlink 2020-05-04 14:30:20 +09:00