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
62b81c33
Kaydet (Commit)
62b81c33
authored
Eyl 15, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.5 (issue #26654)
üst
1b984ffd
45dccdad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
15 deletions
+26
-15
coroutines.py
Lib/asyncio/coroutines.py
+1
-1
events.py
Lib/asyncio/events.py
+14
-13
test_events.py
Lib/test/test_asyncio/test_events.py
+8
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/asyncio/coroutines.py
Dosyayı görüntüle @
62b81c33
...
...
@@ -271,7 +271,7 @@ def _format_coroutine(coro):
func
=
coro
if
coro_name
is
None
:
coro_name
=
events
.
_format_callback
(
func
,
())
coro_name
=
events
.
_format_callback
(
func
,
()
,
{}
)
try
:
coro_code
=
coro
.
gi_code
...
...
Lib/asyncio/events.py
Dosyayı görüntüle @
62b81c33
...
...
@@ -35,23 +35,25 @@ def _get_function_source(func):
return
None
def
_format_args
(
args
):
"""Format function arguments.
def
_format_args
_and_kwargs
(
args
,
kw
args
):
"""Format function arguments
and keyword arguments
.
Special case for a single parameter: ('hello',) is formatted as ('hello').
"""
# use reprlib to limit the length of the output
args_repr
=
reprlib
.
repr
(
args
)
if
len
(
args
)
==
1
and
args_repr
.
endswith
(
',)'
):
args_repr
=
args_repr
[:
-
2
]
+
')'
return
args_repr
items
=
[]
if
args
:
items
.
extend
(
reprlib
.
repr
(
arg
)
for
arg
in
args
)
if
kwargs
:
items
.
extend
(
'{}={}'
.
format
(
k
,
reprlib
.
repr
(
v
))
for
k
,
v
in
kwargs
.
items
())
return
'('
+
', '
.
join
(
items
)
+
')'
def
_format_callback
(
func
,
args
,
suffix
=
''
):
def
_format_callback
(
func
,
args
,
kwargs
,
suffix
=
''
):
if
isinstance
(
func
,
functools
.
partial
):
if
args
is
not
None
:
suffix
=
_format_args
(
args
)
+
suffix
return
_format_callback
(
func
.
func
,
func
.
args
,
suffix
)
suffix
=
_format_args_and_kwargs
(
args
,
kwargs
)
+
suffix
return
_format_callback
(
func
.
func
,
func
.
args
,
func
.
keywords
,
suffix
)
if
hasattr
(
func
,
'__qualname__'
):
func_repr
=
getattr
(
func
,
'__qualname__'
)
...
...
@@ -60,14 +62,13 @@ def _format_callback(func, args, suffix=''):
else
:
func_repr
=
repr
(
func
)
if
args
is
not
None
:
func_repr
+=
_format_args
(
args
)
func_repr
+=
_format_args_and_kwargs
(
args
,
kwargs
)
if
suffix
:
func_repr
+=
suffix
return
func_repr
def
_format_callback_source
(
func
,
args
):
func_repr
=
_format_callback
(
func
,
args
)
func_repr
=
_format_callback
(
func
,
args
,
None
)
source
=
_get_function_source
(
func
)
if
source
:
func_repr
+=
' at
%
s:
%
s'
%
source
...
...
Lib/test/test_asyncio/test_events.py
Dosyayı görüntüle @
62b81c33
...
...
@@ -2224,7 +2224,7 @@ else:
return
asyncio
.
SelectorEventLoop
(
selectors
.
SelectSelector
())
def
noop
(
*
args
):
def
noop
(
*
args
,
**
kwargs
):
pass
...
...
@@ -2305,6 +2305,13 @@ class HandleTests(test_utils.TestCase):
%
(
re
.
escape
(
filename
),
lineno
))
self
.
assertRegex
(
repr
(
h
),
regex
)
# partial function with keyword args
cb
=
functools
.
partial
(
noop
,
x
=
1
)
h
=
asyncio
.
Handle
(
cb
,
(
2
,
3
),
self
.
loop
)
regex
=
(
r'^<Handle noop\(x=1\)\(2, 3\) at
%
s:
%
s>$'
%
(
re
.
escape
(
filename
),
lineno
))
self
.
assertRegex
(
repr
(
h
),
regex
)
# partial method
if
sys
.
version_info
>=
(
3
,
4
):
method
=
HandleTests
.
test_handle_repr
...
...
Misc/NEWS
Dosyayı görüntüle @
62b81c33
...
...
@@ -424,6 +424,9 @@ Library
-
Issue
#
28174
:
Handle
when
SO_REUSEPORT
isn
't properly supported.
Patch by Seth Michael Larson.
- Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__.
Patch by iceboy.
IDLE
----
...
...
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