Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
762b9571
Kaydet (Commit)
762b9571
authored
7 years ago
tarafından
Dong-hee Na
Kaydeden (comit)
Yury Selivanov
7 years ago
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)
üst
f8a4c03e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
5 deletions
+10
-5
inspect.py
Lib/inspect.py
+5
-2
test_inspect.py
Lib/test/test_inspect.py
+2
-2
test_pydoc.py
Lib/test/test_pydoc.py
+1
-1
2017-11-16-02-32-41.bpo-32018.YMQ7Q2.rst
...S.d/next/Library/2017-11-16-02-32-41.bpo-32018.YMQ7Q2.rst
+2
-0
No files found.
Lib/inspect.py
Dosyayı görüntüle @
762b9571
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Lib/test/test_inspect.py
Dosyayı görüntüle @
762b9571
...
...
@@ -2875,12 +2875,12 @@ class TestSignatureObject(unittest.TestCase):
def
foo
(
a
:
int
=
1
,
*
,
b
,
c
=
None
,
**
kwargs
)
->
42
:
pass
self
.
assertEqual
(
str
(
inspect
.
signature
(
foo
)),
'(a:
int=
1, *, b, c=None, **kwargs) -> 42'
)
'(a:
int =
1, *, b, c=None, **kwargs) -> 42'
)
def
foo
(
a
:
int
=
1
,
*
args
,
b
,
c
=
None
,
**
kwargs
)
->
42
:
pass
self
.
assertEqual
(
str
(
inspect
.
signature
(
foo
)),
'(a:
int=
1, *args, b, c=None, **kwargs) -> 42'
)
'(a:
int =
1, *args, b, c=None, **kwargs) -> 42'
)
def
foo
():
pass
...
...
This diff is collapsed.
Click to expand it.
Lib/test/test_pydoc.py
Dosyayı görüntüle @
762b9571
...
...
@@ -824,7 +824,7 @@ class TestDescriptions(unittest.TestCase):
T
=
typing
.
TypeVar
(
'T'
)
class
C
(
typing
.
Generic
[
T
],
typing
.
Mapping
[
int
,
str
]):
...
self
.
assertEqual
(
pydoc
.
render_doc
(
foo
)
.
splitlines
()[
-
1
],
'f
\x08
fo
\x08
oo
\x08
o(data:
List[Any], x:
int)'
'f
\x08
fo
\x08
oo
\x08
o(data:
List[Any], x:
int)'
' -> Iterator[Tuple[int, Any]]'
)
self
.
assertEqual
(
pydoc
.
render_doc
(
C
)
.
splitlines
()[
2
],
'class C
\x08
C(typing.Mapping)'
)
...
...
This diff is collapsed.
Click to expand it.
Misc/NEWS.d/next/Library/2017-11-16-02-32-41.bpo-32018.YMQ7Q2.rst
0 → 100644
Dosyayı görüntüle @
762b9571
inspect.signature should follow PEP 8, if the parameter has an annotation and a
default value. Patch by Dong-hee Na.
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment