Merge branch '2.0' into 6574_annotation_for_varidic_params

This commit is contained in:
Takeshi KOMIYA 2019-08-03 02:19:29 +09:00 committed by GitHub
commit b43676011e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 867 additions and 518 deletions

View File

@ -19,7 +19,7 @@ matrix:
- TOXENV=du13
- python: '3.7'
env:
- TOXENV=py37
- TOXENV=du14
- PYTEST_ADDOPTS="--cov ./ --cov-append --cov-config setup.cfg"
- python: 'nightly'
env: TOXENV=py38

View File

@ -51,6 +51,7 @@ Bugs fixed
* #6574: autodoc: :confval:`autodoc_member_order` does not refer order of
imports when ``'bysource'`` order
* #6574: autodoc: missing type annotation for variadic and keyword parameters
* #6589: autodoc: Formatting issues with autodoc_typehints='none'
* #6498: autosummary: crashed with wrong autosummary_generate setting
* #6507: autosummary: crashes without no autosummary_generate setting
* #6511: LaTeX: autonumbered list can not be customized in LaTeX

View File

@ -104,7 +104,7 @@ def read_svg_depth(filename: str) -> int:
return None
def write_svg_depth(filename: str, depth:int) -> None:
def write_svg_depth(filename: str, depth: int) -> None:
"""Write the depth to SVG file as a comment at end of file
"""
with open(filename, 'a') as f:

File diff suppressed because one or more lines are too long

View File

@ -430,7 +430,7 @@ class Signature:
arg.write(': ')
arg.write(format_param_annotation(param))
if param.default is not param.empty:
if param.annotation is param.empty:
if param.annotation is param.empty or show_annotation is False:
arg.write('=')
arg.write(object_description(param.default))
else:
@ -452,7 +452,7 @@ class Signature:
args.append(arg.getvalue())
last_kind = param.kind
if self.return_annotation is inspect.Parameter.empty:
if self.return_annotation is inspect.Parameter.empty or show_annotation is False:
return '(%s)' % ', '.join(args)
else:
if 'return' in self.annotations:

View File

@ -501,15 +501,15 @@ def test_autodoc_typehints_none(app):
'.. py:module:: target.typehints',
'',
'',
'.. py:class:: Math(s, o = None)',
'.. py:class:: Math(s, o=None)',
' :module: target.typehints',
'',
' ',
' .. py:method:: Math.incr(a, b = 1) -> int',
' .. py:method:: Math.incr(a, b=1)',
' :module: target.typehints',
' ',
'',
'.. py:function:: incr(a, b = 1) -> int',
'.. py:function:: incr(a, b=1)',
' :module: target.typehints',
''
]

View File

@ -74,7 +74,7 @@ def test_js_source(app, status, warning):
app.builder.build(['contents'])
v = '3.2.1'
v = '3.4.1'
msg = 'jquery.js version does not match to {v}'.format(v=v)
jquery_min = (app.outdir / '_static' / 'jquery.js').text()
assert 'jQuery v{v}'.format(v=v) in jquery_min, msg

View File

@ -289,6 +289,10 @@ def test_Signature_annotations():
sig = inspect.Signature(Node.__init__).format_args()
assert sig == '(self, parent: Optional[Node]) -> None'
# show_annotation is False
sig = inspect.Signature(f7).format_args(show_annotation=False)
assert sig == '(x=None, y={})'
def test_safe_getattr_with_default():
class Foo:

View File

@ -1,6 +1,6 @@
[tox]
minversion = 2.4.0
envlist = docs,flake8,mypy,coverage,py{35,36,37,38},du{12,13,14}
envlist = docs,flake8,mypy,coverage,py{35,36,37,38},du{12,13,14,15}
[testenv]
usedevelop = True
@ -13,6 +13,7 @@ deps =
du12: docutils==0.12
du13: docutils==0.13.1
du14: docutils==0.14
du15: docutils==0.15
extras =
test
setenv =