Commit Graph

16 Commits

Author SHA1 Message Date
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
7318d1dfd4 autodoc: Support type union operator (PEP-604) (refs: #8775)
Upgrade autodoc to support type union operator introduced in
PEP-604. It's available only with python 3.10+.
2021-01-31 23:38:36 +09:00
Takeshi KOMIYA
7ecf6b88aa Merge branch '3.4.x' into 3.x 2021-01-01 13:56: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
f1a051fdfc Fix #8315: autodoc: Failed to resolve struct.Struct type annotation
The builtin module, ``struct.Struct`` does not have correct module
name since Python 3.8.  This allows to refer it automatically.
2020-12-31 14:25:05 +09:00
Takeshi KOMIYA
423e7ab2ca Fix #8559: AttributeError is raised when using ForwardRef
The restify() helper crashes when ForwardRef is passed.
2020-12-22 00:37:02 +09:00
Takeshi KOMIYA
46a7ea7ada Add NewType support to typing.stringify() and restify() 2020-11-21 23:04:42 +09:00
François Freitag
419e145e36
Make tests/ a Python package
Allows relative imports.
2020-11-20 19:43:02 +01:00
Takeshi KOMIYA
21a3bd4127 refactor: Fix flake8 violations under tests/ directory 2020-11-15 17:15:40 +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
e2bf9166da Fix #8219: autodoc: Parameters for generic base class are not shown 2020-11-09 02:34:49 +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
Takeshi KOMIYA
b3b7cbbd38 Fix #7983: autodoc: Generator type annotation is wrongly rendered in py36
This adds a special handler (if-branch) for Generator type to stringify
them correctly.  So far, they have been considered as a kind of Callable.
2020-07-19 15:48:07 +09:00
Eric Wieser
46372726de Do not emit type arguments twice
Fixes gh-7567
2020-04-27 15:22:44 +01:00
Takeshi KOMIYA
34057601f4 Close #7165: autodoc: Support Annotated type (PEP-593) 2020-03-03 00:14:24 +09:00
Takeshi KOMIYA
05daa3c7ce Add sphinx.util.typing:stringify() to represent annotations as string 2020-01-05 01:13:27 +09:00