bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)

This commit is contained in:
Dong-hee Na 2017-11-16 03:30:59 +09:00 committed by Yury Selivanov
parent f8a4c03ede
commit 762b9571c9
4 changed files with 10 additions and 5 deletions

View file

@ -2521,11 +2521,14 @@ class Parameter:
# Add annotation and default value
if self._annotation is not _empty:
formatted = '{}:{}'.format(formatted,
formatted = '{}: {}'.format(formatted,
formatannotation(self._annotation))
if self._default is not _empty:
formatted = '{}={}'.format(formatted, repr(self._default))
if self._annotation is not _empty:
formatted = '{} = {}'.format(formatted, repr(self._default))
else:
formatted = '{}={}'.format(formatted, repr(self._default))
if kind == _VAR_POSITIONAL:
formatted = '*' + formatted