Commit Graph

147 Commits

Author SHA1 Message Date
Adam Turner
b91d763db8 Fix PT011 (`pytest.raises(ValueError)` is too broad) 2023-08-10 13:11:25 +01:00
Adam Turner
7cce00aa7d
Refactor `sphinx.util.inspect` and tests (#11527) 2023-07-28 02:05:40 +01:00
James Addison
467e94dc62
object inspection: produce deterministic descriptions for nested collection datastructures (#11312)
``util.inspect.object_description`` already attempts to sort collections, but this can fail.
This commit handles the failure case by using string-based object descriptions
as a fallback deterministic sort ordering, and protects against recursive collections.

Co-authored-by: Chris Lamb <lamby@debian.org>
Co-authored-by: Faidon Liambotis <paravoid@debian.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-07-27 22:45:51 +01:00
Adam Turner
ad61e41157
Drop support for Python 3.8 (#11511) 2023-07-25 02:07:23 +01:00
Martin Liška
77483f2824
Add missing test decorator for `test_util_inspect` (#11321) 2023-04-21 02:22:10 +01:00
Adam Turner
13442f6901 Fix pytest style issues 2023-02-18 02:16:50 +00:00
Adam Turner
a13cf2c24d Adopt `profile = "black" for isort`
This allows using Ruff's import sorting fixers
2023-01-07 18:31:15 +00:00
Adam Turner
77a02cf696
Use PEP 604 display for `typing.Optional and typing.Union` (#11072) 2023-01-02 17:49:18 +00:00
Adam Turner
f4c8a0a68e Insert `from __future__ import annotations` 2023-01-01 20:48:37 +00:00
Adam Turner
920828fe35 Run the `pyupgrade` tool 2022-10-17 22:39:09 +01:00
Adam Turner
4660b62de0 Drop Python 3.7 2022-09-27 18:31:47 +01:00
Adam Turner
7649eb1505 Clean up after dropping Python 3.6 2022-09-27 18:31:47 +01:00
Adam Turner
14c9b40f15 Merge branch '5.x'
# Conflicts:
#	setup.py
#	sphinx/application.py
#	sphinx/environment/__init__.py
#	sphinx/ext/autodoc/directive.py
#	tests/test_build_html.py
2022-09-09 09:58:24 +01:00
danieleades
12bff8a273
Remove unneeded noqa lint suppression comments (#10772) 2022-08-28 20:03:17 +01:00
Adam Turner
a4d41aa889 Merge branch '5.x' 2022-07-17 21:53:12 +01:00
danieleades
25d379fb53
Lint with flake8-bugbear (#10602)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2022-07-12 22:55:57 +01:00
Takeshi KOMIYA
7e68154e49
Drop python 3.6 support (#10468) 2022-06-16 19:33:55 +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
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
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
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
2ea9118181 refactor: Merge arguments of sphinx.util.typing:stringify() 2021-12-26 03:11:39 +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
5aa6cbbca8 Add unqualified_typehints parameter to stringify_signature()
To make the generated function signatures simple, this adds a new
parameter `unqualified_typehints` to sphinx.util.inspect:
stringify_signature() to suppress the leading module name of
typehints.
2021-12-03 18:05:49 +09:00
Takeshi KOMIYA
c8f019ab50 Fix #9868: ImportError on testing sphinx.util.inspect
In some Linux distribution, ImportError is raised on testing
sphinx.util.inspect because _testcapi is not installed.
2021-11-23 18:22:08 +09:00
Takeshi KOMIYA
3c5b31b50d Fix #9757: autodoc_inherit_docstrings does not effect to overriden classmethods 2021-10-30 02:01:38 +09:00
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