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
3f6538fe
Kaydet (Commit)
3f6538fe
authored
May 14, 2015
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 22547: Implement informative __repr__ for inspect.BoundArguments
üst
6b4046f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
inspect.py
Lib/inspect.py
+7
-0
test_inspect.py
Lib/test/test_inspect.py
+7
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/inspect.py
Dosyayı görüntüle @
3f6538fe
...
@@ -2460,6 +2460,13 @@ class BoundArguments:
...
@@ -2460,6 +2460,13 @@ class BoundArguments:
def
__getstate__
(
self
):
def
__getstate__
(
self
):
return
{
'_signature'
:
self
.
_signature
,
'arguments'
:
self
.
arguments
}
return
{
'_signature'
:
self
.
_signature
,
'arguments'
:
self
.
arguments
}
def
__repr__
(
self
):
args
=
[]
for
arg
,
value
in
self
.
arguments
.
items
():
args
.
append
(
'{}={!r}'
.
format
(
arg
,
value
))
return
'<{} at {:#x} ({})>'
.
format
(
self
.
__class__
.
__name__
,
id
(
self
),
', '
.
join
(
args
))
class
Signature
:
class
Signature
:
"""A Signature object represents the overall signature of a function.
"""A Signature object represents the overall signature of a function.
...
...
Lib/test/test_inspect.py
Dosyayı görüntüle @
3f6538fe
...
@@ -3149,6 +3149,13 @@ class TestBoundArguments(unittest.TestCase):
...
@@ -3149,6 +3149,13 @@ class TestBoundArguments(unittest.TestCase):
ba_pickled
=
pickle
.
loads
(
pickle
.
dumps
(
ba
,
ver
))
ba_pickled
=
pickle
.
loads
(
pickle
.
dumps
(
ba
,
ver
))
self
.
assertEqual
(
ba
,
ba_pickled
)
self
.
assertEqual
(
ba
,
ba_pickled
)
def
test_signature_bound_arguments_repr
(
self
):
def
foo
(
a
,
b
,
*
,
c
:
1
=
{},
**
kw
)
->
{
42
:
'ham'
}:
pass
sig
=
inspect
.
signature
(
foo
)
ba
=
sig
.
bind
(
20
,
30
,
z
=
{})
self
.
assertRegex
(
repr
(
ba
),
r'<BoundArguments at 0x[a-fA-F0-9]+ \(a=20,.*\}\}\)>'
)
class
TestSignaturePrivateHelpers
(
unittest
.
TestCase
):
class
TestSignaturePrivateHelpers
(
unittest
.
TestCase
):
def
test_signature_get_bound_param
(
self
):
def
test_signature_get_bound_param
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
3f6538fe
...
@@ -125,6 +125,9 @@ Library
...
@@ -125,6 +125,9 @@ Library
-
Issue
24184
:
Add
AsyncIterator
and
AsyncIterable
ABCs
to
-
Issue
24184
:
Add
AsyncIterator
and
AsyncIterable
ABCs
to
collections
.
abc
.
Contributed
by
Yury
Selivanov
.
collections
.
abc
.
Contributed
by
Yury
Selivanov
.
-
Issue
22547
:
Implement
informative
__repr__
for
inspect
.
BoundArguments
.
Contributed
by
Yury
Selivanov
.
Tests
Tests
-----
-----
...
...
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