Merge branch '3.x' into 7785_autodoc_typehints_none_for_overloads

This commit is contained in:
Takeshi KOMIYA
2020-10-28 02:13:49 +09:00
committed by GitHub
17 changed files with 80 additions and 20 deletions

12
CHANGES
View File

@@ -28,6 +28,8 @@ Features added
directory on build man page directory on build man page
* #8289: epub: Allow to suppress "duplicated ToC entry found" warnings from epub * #8289: epub: Allow to suppress "duplicated ToC entry found" warnings from epub
builder using :confval:`suppress_warnings`. builder using :confval:`suppress_warnings`.
* #8298: sphinx-quickstart: Add :option:`sphinx-quickstart --no-sep` option
* #8304: sphinx.testing: Register public markers in sphinx.testing.fixtures
Bugs fixed Bugs fixed
---------- ----------
@@ -45,22 +47,32 @@ Bugs fixed
* #7964: autodoc: Tuple in default value is wrongly rendered * #7964: autodoc: Tuple in default value is wrongly rendered
* #8200: autodoc: type aliases break type formatting of autoattribute * #8200: autodoc: type aliases break type formatting of autoattribute
* #7786: autodoc: can't detect overloaded methods defined in other file * #7786: autodoc: can't detect overloaded methods defined in other file
* #8294: autodoc: single-string __slots__ is not handled correctly
* #7785: autodoc: autodoc_typehints='none' does not effect to overloaded functions * #7785: autodoc: autodoc_typehints='none' does not effect to overloaded functions
* #8192: napoleon: description is disappeared when it contains inline literals * #8192: napoleon: description is disappeared when it contains inline literals
* #8142: napoleon: Potential of regex denial of service in google style docs * #8142: napoleon: Potential of regex denial of service in google style docs
* #8169: LaTeX: pxjahyper loaded even when latex_engine is not platex * #8169: LaTeX: pxjahyper loaded even when latex_engine is not platex
* #8215: LaTeX: 'oneside' classoption causes build warning
* #8175: intersphinx: Potential of regex denial of service by broken inventory * #8175: intersphinx: Potential of regex denial of service by broken inventory
* #8277: sphinx-build: missing and redundant spacing (and etc) for console * #8277: sphinx-build: missing and redundant spacing (and etc) for console
output on building output on building
* #7973: imgconverter: Check availability of imagemagick many times * #7973: imgconverter: Check availability of imagemagick many times
* #8255: py domain: number in default argument value is changed from hexadecimal * #8255: py domain: number in default argument value is changed from hexadecimal
to decimal to decimal
* #8316: html: Prevent arrow keys changing page when button elements are focused
* #8343: html search: Fix unnecessary load of images when parsing the document
* #8254: html theme: Line numbers misalign with code lines
* #8093: The highlight warning has wrong location in some builders (LaTeX, * #8093: The highlight warning has wrong location in some builders (LaTeX,
singlehtml and so on) singlehtml and so on)
* #8215: Eliminate Fancyhdr build warnings for oneside documents
* #8239: Failed to refer a token in productionlist if it is indented * #8239: Failed to refer a token in productionlist if it is indented
* #8268: linkcheck: Report HTTP errors when ``linkcheck_anchors`` is ``True`` * #8268: linkcheck: Report HTTP errors when ``linkcheck_anchors`` is ``True``
* #8245: linkcheck: take source directory into account for local files * #8245: linkcheck: take source directory into account for local files
* #8321: linkcheck: ``tel:`` schema hyperlinks are detected as errors
* #8323: linkcheck: An exit status is incorrect when links having unsupported
schema found
* #6914: figure numbers are unexpectedly assigned to uncaptioned items * #6914: figure numbers are unexpectedly assigned to uncaptioned items
* #8320: make "inline" line numbers un-selectable
Testing Testing
-------- --------

8
doc/_static/favicon.svg vendored Normal file
View File

@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<style>
@media (prefers-color-scheme: dark) {
svg { fill: white; }
}
</style>
<path d="m 67.780707,71.526216 c 0,-2.720856 0.735772,-7.633735 1.635035,-10.917507 2.076574,-7.582764 3.222746,-16.97568 2.071477,-16.97568 -0.485619,0 -3.994408,3.173002 -7.797313,7.051115 -14.448869,14.734603 -29.952812,23.068339 -42.915946,23.068339 -7.400211,0 -12.4298817,-1.871115 -17.2867007,-6.430912 -2.94436186,-2.764297 -3.47532146,-4.129685 -3.47532146,-8.936928 0,-4.94488 0.4862322,-6.108589 3.78321146,-9.054437 2.987989,-2.669773 4.875111,-3.380296 8.9779137,-3.380296 3.163221,0.711278 5.032659,0.664017 6.063532,1.917191 1.045041,1.231842 1.406892,5.262673 0.143323,7.623675 -0.674746,1.260763 -2.435471,2.043539 -4.5966,2.043539 -2.040303,0 -3.203991,-0.483702 -2.786976,-1.15844 1.31395,-2.126021 -0.560952,-3.566616 -2.9664067,-2.279256 -2.907025,1.555792 -2.957418,7.069066 -0.08839,9.665535 4.0345357,3.651203 15.1912207,5.023925 21.9019857,2.694828 7.250749,-2.516503 16.739014,-8.578986 24.30831,-15.531674 l 6.657407,-6.115083 -8.688303,-0.05007 C 43.622519,44.707714 37.702703,43.621524 18.54695,38.489741 12.175528,36.782852 6.0502733,35.306342 4.9352743,35.208608 3.6710803,35.097791 2.841723,34.067882 2.9080043,32.476074 3.0199286,29.788108 4.4800823,27.78768 6.2067673,27.033038 7.2437505,26.579828 14.43583,25.894406 22.0605,23.866486 c 29.699148,-7.899023 31.502043,-6.781254 51.28707,-1.772167 6.461504,1.635896 13.942408,3.414988 17.256961,3.474566 5.106245,0.09178 6.211825,0.514653 7.240255,2.76932 0.66758,1.46355 1.21378,2.858905 1.21378,3.10079 0,0.241884 -2.89333,1.764397 -6.429613,3.383363 -12.984983,5.944723 -17.083271,9.093943 -12.855172,15.130399 1.753219,2.503069 1.718037,2.768923 -0.57922,4.37799 -1.345193,0.942203 -2.457238,2.856456 -2.471232,4.253898 -0.03777,3.776976 -2.424786,11.884847 -5.893734,15.080164 l -3.048923,2.808424 z m 6.632814,-34.658372 c 5.169656,-1.440693 8.302047,-3.07045 14.72913,-6.500861 -5.292267,-1.548658 -18.570782,-3.724097 -18.570782,-3.724097 -9.796513,-1.964547 -8.76916,-1.865132 -9.21348,0.29669 -0.176673,0.859598 -0.702644,2.763948 -1.872329,4.596663 -2.251474,3.527711 -10.489307,4.271075 -15.214327,2.009703 -1.482367,-0.709454 -2.971272,-3.416276 -2.950606,-5.336922 0.02911,-2.705486 -1.505386,-3.336055 -2.486689,-2.975309 -0.796428,0.292781 -3.384665,0.330004 -9.071284,1.864262 -18.784765,5.068157 -21.3552119,4.487473 -9.110967,6.223299 1.472409,0.208739 9.252992,2.381926 13.052028,3.39412 9.318588,2.482796 11.064717,2.665087 23.125496,2.414247 8.385835,-0.174409 11.891174,-0.675356 17.58381,-2.261795 z M 3.0589449,14.916483 C 3.2921927,12.514245 3.424378,11.992797 10.100599,10.647894 13.924923,9.8774962 23.355266,7.3808108 31.056903,5.0997052 c 17.703937,-5.2436279 22.73392,-5.2565016 41.092202,-0.105175 7.923233,2.2232606 16.798382,4.047803 19.72254,4.054541 4.567242,0.01054 6.941892,2.0284768 6.941892,2.0284768 2.101843,4.825342 1.718463,5.158474 -6.484103,5.158474 -5.714193,0 -10.641875,-0.963081 -18.245438,-3.565943 C 68.300078,10.69012 60.060462,8.8316882 55.557963,8.4915615 47.342337,7.8709375 47.353713,7.8687835 21.963188,14.855617 17.503192,16.082896 11.34213,17.454164 8.2719268,17.902883 l -5.5821654,0.81585 z" />
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -28,6 +28,7 @@ html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']}
html_additional_pages = {'index': 'index.html'} html_additional_pages = {'index': 'index.html'}
html_use_opensearch = 'https://www.sphinx-doc.org/en/master' html_use_opensearch = 'https://www.sphinx-doc.org/en/master'
html_baseurl = 'https://www.sphinx-doc.org/en/master/' html_baseurl = 'https://www.sphinx-doc.org/en/master/'
html_favicon = '_static/favicon.svg'
htmlhelp_basename = 'Sphinxdoc' htmlhelp_basename = 'Sphinxdoc'

View File

@@ -9,8 +9,8 @@ Glossary
A class (inheriting from :class:`~sphinx.builders.Builder`) that takes A class (inheriting from :class:`~sphinx.builders.Builder`) that takes
parsed documents and performs an action on them. Normally, builders parsed documents and performs an action on them. Normally, builders
translate the documents to an output format, but it is also possible to translate the documents to an output format, but it is also possible to
use the builder builders that e.g. check for broken links in the use builders that e.g. check for broken links in the documentation, or
documentation, or build coverage information. build coverage information.
See :doc:`/usage/builders/index` for an overview over Sphinx's built-in See :doc:`/usage/builders/index` for an overview over Sphinx's built-in
builders. builders.

View File

@@ -33,6 +33,10 @@ Options
If specified, separate source and build directories. If specified, separate source and build directories.
.. option:: --no-sep
If specified, create build directroy under source directroy.
.. option:: --dot=DOT .. option:: --dot=DOT
Inside the root directory, two more directories will be created; Inside the root directory, two more directories will be created;

View File

@@ -57,10 +57,8 @@ filterwarnings =
ignore::DeprecationWarning:pyximport.pyximport ignore::DeprecationWarning:pyximport.pyximport
ignore::PendingDeprecationWarning:sphinx.util.pycompat ignore::PendingDeprecationWarning:sphinx.util.pycompat
markers = markers =
sphinx
apidoc apidoc
setup_command setup_command
test_params
testpaths = tests testpaths = tests
[coverage:run] [coverage:run]

View File

@@ -212,7 +212,7 @@ class CheckExternalLinksBuilder(Builder):
def check(docname: str) -> Tuple[str, str, int]: def check(docname: str) -> Tuple[str, str, int]:
# check for various conditions without bothering the network # check for various conditions without bothering the network
if len(uri) == 0 or uri.startswith(('#', 'mailto:')): if len(uri) == 0 or uri.startswith(('#', 'mailto:', 'tel:')):
return 'unchecked', '', 0 return 'unchecked', '', 0
elif not uri.startswith(('http:', 'https:')): elif not uri.startswith(('http:', 'https:')):
if uri_re.match(uri): if uri_re.match(uri):

View File

@@ -489,8 +489,10 @@ def get_parser() -> argparse.ArgumentParser:
help=__('project root')) help=__('project root'))
group = parser.add_argument_group(__('Structure options')) group = parser.add_argument_group(__('Structure options'))
group.add_argument('--sep', action='store_true', default=None, group.add_argument('--sep', action='store_true', dest='sep', default=None,
help=__('if specified, separate source and build dirs')) help=__('if specified, separate source and build dirs'))
group.add_argument('--no-sep', action='store_false', dest='sep',
help=__('if specified, create build dir under source dir'))
group.add_argument('--dot', metavar='DOT', default='_', group.add_argument('--dot', metavar='DOT', default='_',
help=__('replacement for dot in _templates etc.')) help=__('replacement for dot in _templates etc.'))

View File

@@ -206,7 +206,10 @@ def get_object_members(subject: Any, objpath: List[str], attrgetter: Callable,
if isclass(subject) and getattr(subject, '__slots__', None) is not None: if isclass(subject) and getattr(subject, '__slots__', None) is not None:
from sphinx.ext.autodoc import SLOTSATTR from sphinx.ext.autodoc import SLOTSATTR
for name in subject.__slots__: slots = subject.__slots__
if isinstance(slots, str):
slots = [slots]
for name in slots:
members[name] = Attribute(name, True, SLOTSATTR) members[name] = Attribute(name, True, SLOTSATTR)
# other members # other members

View File

@@ -22,6 +22,21 @@ from sphinx.testing import util
from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding
DEFAULT_ENABLED_MARKERS = [
(
'sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None,'
' docutilsconf=None, parallel=0): arguments to initialize the sphinx test application.'
),
'test_params(shared_result=...): test parameters.',
]
def pytest_configure(config):
# register custom markers
for marker in DEFAULT_ENABLED_MARKERS:
config.addinivalue_line('markers', marker)
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def rootdir() -> str: def rootdir() -> str:
return None return None

View File

@@ -588,12 +588,14 @@
{% classes with \chapter command {% classes with \chapter command
\fancypagestyle{normal}{ \fancypagestyle{normal}{
\fancyhf{} \fancyhf{}
% FIXME: this presupposes "twoside". \fancyfoot[RO]{{\py@HeaderFamily\thepage}}
% If "oneside" class option, there are warnings in LaTeX log.
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}} \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}} \fancyhead[RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
\fancyhead[LE,RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}} \if@twoside
\fancyfoot[LE]{{\py@HeaderFamily\thepage}}
\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
\fancyhead[LE]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
\fi
\renewcommand{\headrulewidth}{0.4pt} \renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
% define chaptermark with \@chappos when \@chappos is available for Japanese % define chaptermark with \@chappos when \@chappos is available for Japanese
@@ -605,7 +607,8 @@
% page of a chapter `clean.' % page of a chapter `clean.'
\fancypagestyle{plain}{ \fancypagestyle{plain}{
\fancyhf{} \fancyhf{}
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}} \fancyfoot[RO]{{\py@HeaderFamily\thepage}}
\if@twoside\fancyfoot[LE]{{\py@HeaderFamily\thepage}}\fi
\renewcommand{\headrulewidth}{0pt} \renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
} }

View File

@@ -95,8 +95,8 @@
{%- endmacro %} {%- endmacro %}
{%- macro css() %} {%- macro css() %}
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1)|e }}" type="text/css" />
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1)|e }}" type="text/css" />
{%- for css in css_files %} {%- for css in css_files %}
{%- if css|attr("filename") %} {%- if css|attr("filename") %}
{{ css_tag(css) }} {{ css_tag(css) }}

View File

@@ -764,6 +764,7 @@ div.code-block-caption code {
} }
table.highlighttable td.linenos, table.highlighttable td.linenos,
span.linenos,
div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */ div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none; user-select: none;
} }

View File

@@ -285,9 +285,10 @@ var Documentation = {
initOnKeyListeners: function() { initOnKeyListeners: function() {
$(document).keydown(function(event) { $(document).keydown(function(event) {
var activeElementType = document.activeElement.tagName; var activeElementType = document.activeElement.tagName;
// don't navigate when in search box or textarea // don't navigate when in search box, textarea, dropdown or button
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT' if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT'
&& !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) { && activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey
&& !event.shiftKey) {
switch (event.keyCode) { switch (event.keyCode) {
case 37: // left case 37: // left
var prevHref = $('link[rel="prev"]').prop('href'); var prevHref = $('link[rel="prev"]').prop('href');

View File

@@ -59,10 +59,10 @@ var Search = {
_pulse_status : -1, _pulse_status : -1,
htmlToText : function(htmlString) { htmlToText : function(htmlString) {
var htmlElement = document.createElement('span'); var virtualDocument = document.implementation.createHTMLDocument('virtual');
htmlElement.innerHTML = htmlString; var htmlElement = $(htmlString, virtualDocument);
$(htmlElement).find('.headerlink').remove(); htmlElement.find('.headerlink').remove();
docContent = $(htmlElement).find('[role=main]')[0]; docContent = htmlElement.find('[role=main]')[0];
if(docContent === undefined) { if(docContent === undefined) {
console.warn("Content block not found. Sphinx search tries to obtain it " + console.warn("Content block not found. Sphinx search tries to obtain it " +
"via '[role=main]'. Could you check your theme or template."); "via '[role=main]'. Could you check your theme or template.");

View File

@@ -2,6 +2,10 @@ class Foo:
__slots__ = ['attr'] __slots__ = ['attr']
class FooSingleString:
__slots__ = 'attr'
class Bar: class Bar:
__slots__ = {'attr1': 'docstring of attr1', __slots__ = {'attr1': 'docstring of attr1',
'attr2': 'docstring of attr2', 'attr2': 'docstring of attr2',

View File

@@ -1205,6 +1205,14 @@ def test_slots(app):
' .. py:attribute:: Foo.attr', ' .. py:attribute:: Foo.attr',
' :module: target.slots', ' :module: target.slots',
'', '',
'',
'.. py:class:: FooSingleString()',
' :module: target.slots',
'',
'',
' .. py:attribute:: FooSingleString.attr',
' :module: target.slots',
'',
] ]