Commit Graph

35 Commits

Author SHA1 Message Date
Takeshi KOMIYA
aa1bc83c2a Merge branch '4.x' 2022-03-19 22:58:15 +09:00
Adam Turner
6bb7b891a1 Remove copyright and licence fields 2022-02-20 03:06:23 +00:00
Adam Turner
b691ebcc3e Conform to PEP 257 summary line conventions 2022-02-20 02:57:02 +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
616f112e6a autodoc: The default of autodoc_typehints_format becomes to 'smart'
The default value of autodoc_typehints_format configuration is changed
to `'smart'`.  It will suppress the leading module names of typehints
(ex. `io.StringIO` -> `StringIO`).

refs: #9075
2022-01-02 17:35:19 +09:00
Takeshi KOMIYA
b84771dcd2 A happy new year! 2022-01-01 18:45:03 +09:00
Takeshi KOMIYA
fb92547b91 Fix #9866: autodoc: doccoment for the imported class was ignored
Autodoc tried to scan doccomment on the module where the class defined.
But it failed to get it if the class is imported from other module.

This analyzes the target module to obtain the doccomment.
2021-11-21 18:50:54 +09:00
Takeshi KOMIYA
b778ee806e Fix #9752: autodoc: Failed to detect type annotation for slots attribute 2021-10-23 14:59:36 +09:00
Takeshi KOMIYA
10b7f0e252 Fix #9607: autodoc: Incorrect base class detection
In case of the descendants of generic class, the value of
obj.__orig_bases__ is incorrect because it returns original base
arguments for the child of the generic class instead of the target
class itself.

This uses obj.__dict__ to get the correct __orig_bases__ information.
2021-09-20 13:20:26 +09:00
Takeshi KOMIYA
506590d4ba
Merge pull request #9640 from tk0miya/9639_support_asyncgenfunction
Close #9639: autodoc: Support asynchronous generator functions
2021-09-18 01:03:34 +09:00
Takeshi KOMIYA
ccfca458ea Close #9639: autodoc: Support asynchronous generator functions 2021-09-17 02:20:40 +09:00
Takeshi KOMIYA
ed227d7d3c Fix #9630: autodoc: Failed to build xrefs if primary_domain is not 'py'
Autodoc generates reST code that uses raw `:obj:` and `:class:` xrefs to
refer the classes and types.  But they're fragile because they assume
the primary_domain=='py'.

This adds `:py:` prefix to these xrefs to make them robust.
2021-09-14 23:59:47 +09:00
Takeshi KOMIYA
38d80c3d0f Close #9445: autodoc: Support class properties
Since python 3.9, `classmethod` starts to support creating a "class
property".  This supports to generate document for it.
2021-07-17 16:39:50 +09:00
Takeshi KOMIYA
bc7087a1a2
Merge branch '4.x' into 3014_autodoc-process-bases 2021-05-17 22:40:27 +09:00
Takeshi KOMIYA
67db20d705 Close #3014: autodoc: Add autodoc-process-bases
Add `autodoc-process-bases` to modify the base classes of the class
definitions.  This allows the extensions to insert or modify the list
of the base classes via event-handlers.
2021-05-16 00:46:06 +09:00
Takeshi KOMIYA
4ceedc102d Close #8061, #9218: autodoc: Support variable comment for alias classes 2021-05-15 16:31:40 +09:00
Takeshi KOMIYA
d8a9f243e2 Close #8107: autodoc: Add class-doc-from option to autoclass directive
Add `class-doc-from` option to the `autoclass` directive to control
the content of the specific class.  It takes `class`, `init`, and `both`
like `autoclass_content`.
2021-05-01 14:53:06 +09:00
Takeshi KOMIYA
c2c2b81f91 Fix #8818: autodoc: Super class having `Any` arguments causes nit-picky warning
On generating the base class information, unexpected nit-picky warning
for ``typing.Any`` was emitted.  This fixes it by using `~` prefix on
generating a cross-reference to make it valid.
2021-04-18 00:25:48 +09:00
Takeshi KOMIYA
75f5122996 Fix #7383: autodoc: Support typehints for properties
py:property directive now outputs py:property directive to describe
its type annotation.
2021-03-13 22:51:46 +09:00
Takeshi KOMIYA
284d9e703b refactor: Fix the right hand value of autodoc options should be None 2021-02-04 22:35:29 +09:00
Takeshi KOMIYA
0d50b97fa3
Merge pull request #8297 from pbudzyns/exclude-members-fix
Local autodoc options override or extend autodoc_default_options.
2021-02-04 22:24:52 +09:00
Takeshi KOMIYA
6d8c9183fa Fix #8800: autodoc: Uninitialized attributes in superclass are recognized as undocumented
Unintentionally, uninitialized attributes defined at superclasses are
recognized as undocumented in the filtering step.  Therefore, they are
filtered if `:undoc-members:` option given.
2021-02-01 21:06:07 +09:00
pbudzyns
fd6587d5e9 rebase and fix tests 2021-02-01 10:58:09 +01: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
6c645e41f8 refactor: Deprecate no_docstring argument for Documenter.add_content()
Deprecate `no_docstring` argument for `Documenter.add_content()` again.

At the first trial (#8533), it changes the behavior of
`autodoc-process-docstring` event; it is emitted unexpectedly for an
alias of class.  But it brings an incompatible change to extensions.
Hence it was partially reverted at #8581.

This keeps not calling the event for an alias of class.  To do that,
now `Documenter.get_doc()` can return None value.
2020-12-26 21:14:26 +09:00
Takeshi KOMIYA
c0678a4a50 Fix #741: autodoc: inherited-members doesn't support instance attributes on super class
To support instance attributes on super class, get_class_members() scans
the instance attributes defined at super classes using ModuleAnalyzer.
It allows to generate document for them when users gives :
inherited-members: option.
2020-12-18 23:24:59 +09:00
Takeshi KOMIYA
9721327989 Fix #8545: autodoc: a __slots__ attribute is not documented even having docstring
To avoid filtering __slots__ attributes having docstring at
filter_members(), this passes docstring captured at get_class_members()
to the filter_members() via ObjectMember.
2020-12-17 22:19:28 +09:00
François Freitag
419e145e36
Make tests/ a Python package
Allows relative imports.
2020-11-20 19:43:02 +01: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
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
9a44e45277 Fix #7613: autodoc: autodoc does not respect __signature__ of the class 2020-11-01 18:27:16 +09:00