Commit Graph
28 Commits
Author SHA1 Message Date
Eric Wieser d5584172ab Refactor to simplify format_args, catch TypeError 2020-05-28 18:28:40 +01:00
Eric Wieser d229b120ad Fix autoclass signature parsing
This fixes:
* Signatures defined by __new__
* Signatures defined by metaclasses
* Signatures defined by builtin base classes

All of these changes bring the sphinx docs inline with the behavior of `inspect.signature`.

Note that this changes autodoc to output `.. py:class: MyClass()` with parentheses even if no user-defined __init__ is present.
This is quite deliberate, as if no user-defined `__init__` is present the default is `object.__init__`, which indeed does not take arguments.
2020-05-28 08:36:56 +01:00
Eric Wieser ebd48b9081 Respect member-order="bysource" even when no analyzer is present
This takes advantage of the fact that in Python 3.6 and up, the __dict__ attribute of classes and modules is insertion-ordered, which is usually a good approximation of "source order".

Notably, this means that `..automodule:: some_c_extension_module` will document members in the order they were added to the module dict, which is likely what the user wants.
2020-05-21 12:23:19 +01:00
Eric Wieser c8a4c79daf Do not crash if is_builtin_class_method is passed a non-type 2020-05-08 08:54:53 +01:00
Eric Wieser 5ed31be51f Preserve exception info in raised SphinxWarning objects 2020-05-03 14:58:19 +01:00
Eric Wieser 8268d38d51 Apply suggestions from code review 2020-05-03 14:18:22 +01:00
Eric Wieser b787e4ab8d Update sphinx/ext/autodoc/__init__.py 2020-05-03 14:02:11 +01:00
Eric Wieser f3dd6c0bfa autodoc: Show full traceback and exception type in warnings 2020-05-03 12:50:28 +01:00
Eric Wieser ae57962b98 Report junit pytest results to CircleCI 2020-05-03 12:38:07 +01:00
Eric Wieser 453fe55dc9 ext.napoleon: Do not consume colons within inline code
Fixes gh-7581
2020-04-30 08:57:24 +01:00
Eric Wieser 9d7171899a ext.napoleon: Emit type annotations at the start of .. attribute:: 2020-04-29 19:03:24 +01:00
Eric Wieser 46372726de Do not emit type arguments twice
Fixes gh-7567
2020-04-27 15:22:44 +01:00
Eric Wieser b7ce4a4c13 Fix a logic error that causes annotations not to be shown for descriptors
This `if not self._datadescriptor` was originally here before type annotations were supported, to prevent showing `descr4 = <_Descriptor ...>` in the docs.

When type annotations were added, the support for appending `:type:` was put in the wrong place.
It should have been outside this if, not within it.
2020-04-27 12:57:39 +01:00
Eric Wieser 11ff9207e6 Group together methods that relate to a python 3.8 deprecation
This will make it easier to remove them all at once in future
2020-04-17 16:49:25 +01:00
Eric Wieser 48a10179ef Rewrite unparse to use ast.NodeVisitor
This should make it possible to reuse the same visitor to generate RST code.
2020-04-17 16:49:17 +01:00
Eric Wieser 18a84d29fd Deduplicate some code in pycode.ast 2020-04-16 18:17:24 +01:00
Eric Wieser 0d7451c23d Add support for :meta public:
A common use case for this is a class like `namedtuple`, which has a public `_replace` method that is so-named in order not to conflict with arbitrary user-provided attributes.

Rejected spellings include:
* `:meta not-private:`
* `:meta private: False`
2020-04-14 08:41:45 +01:00
Eric Wieser 1bfc59036a Make SVG inheritance diagrams transparent
Previously they would be emitted with a white background
2019-12-09 23:30:17 +01:00
Eric Wieser 58beeed235 fixup
Warning and missing typing function
2017-10-20 23:53:33 -07:00
Eric Wieser a4b7927a29 quickstart: fix return type of term_decode
term_decode is documented as `(unicode) -> unicode`, but actually:

* Accepts `bytes` arguments, despite not being documented to
* Returns `bytes` when it shouldn't

This is extracted from the more controversial #3584
2017-10-20 23:18:46 -07:00
Eric Wieser 804891c4a1 BUG: Fix autosummary of members with a trailing underscore 2017-03-26 12:54:03 +01:00
Eric Wieser a7397a21fe Test whether the escaping is correct by looking at the plaintext
Otherwise we're just testing that the headers are produced with format_header
2017-03-24 09:53:01 +00:00
Eric Wieser 18d2e2e48b Move apidoc tests to subfolder, rather than polluting main test 2017-03-24 09:51:50 +00:00
Eric Wieser 3e7bee5836 Fix issues with trailing underscores in heading names
Fixes #1451, using the approach in 8d96c90fc6
2017-03-23 12:40:14 +00:00
Eric Wieser 09e3f8adfd Remove backwards-compatible typos
Decreed in #3297 not to be a public API
2016-12-31 10:52:16 +00:00
Eric Wieser 7e8545a642 PEP8 compliance 2016-12-31 10:47:09 +00:00
Eric Wieser 07f2823618 Fix name of _parse_declerator [sic] 2016-12-31 10:10:10 +00:00
Eric Wieser 528de30ed3 Fix typos in sphinx.domains.cpp.AST class names
Assuming this is a public API, the old names need to stick around
2016-12-31 10:08:36 +00:00