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
15cc678d
Kaydet (Commit)
15cc678d
authored
Ock 08, 2015
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: Truncate to 80 columns
üst
8d9c145f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
33 deletions
+60
-33
base_events.py
Lib/asyncio/base_events.py
+2
-2
coroutines.py
Lib/asyncio/coroutines.py
+8
-4
selector_events.py
Lib/asyncio/selector_events.py
+4
-3
tasks.py
Lib/asyncio/tasks.py
+1
-1
unix_events.py
Lib/asyncio/unix_events.py
+2
-1
windows_events.py
Lib/asyncio/windows_events.py
+2
-1
windows_utils.py
Lib/asyncio/windows_utils.py
+4
-3
test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+6
-3
test_futures.py
Lib/test/test_asyncio/test_futures.py
+16
-8
test_streams.py
Lib/test/test_asyncio/test_streams.py
+4
-2
test_subprocess.py
Lib/test/test_asyncio/test_subprocess.py
+3
-1
test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+8
-4
No files found.
Lib/asyncio/base_events.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -201,8 +201,8 @@ class BaseEventLoop(events.AbstractEventLoop):
"""Create socket transport."""
raise
NotImplementedError
def
_make_ssl_transport
(
self
,
rawsock
,
protocol
,
sslcontext
,
waiter
=
None
,
*
,
server_side
=
False
,
server_hostname
=
None
,
def
_make_ssl_transport
(
self
,
rawsock
,
protocol
,
sslcontext
,
waiter
=
None
,
*
,
server_side
=
False
,
server_hostname
=
None
,
extra
=
None
,
server
=
None
):
"""Create SSL transport."""
raise
NotImplementedError
...
...
Lib/asyncio/coroutines.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -182,14 +182,18 @@ def _format_coroutine(coro):
and
not
inspect
.
isgeneratorfunction
(
coro
.
func
)):
filename
,
lineno
=
events
.
_get_function_source
(
coro
.
func
)
if
coro
.
gi_frame
is
None
:
coro_repr
=
'
%
s() done, defined at
%
s:
%
s'
%
(
coro_name
,
filename
,
lineno
)
coro_repr
=
(
'
%
s() done, defined at
%
s:
%
s'
%
(
coro_name
,
filename
,
lineno
))
else
:
coro_repr
=
'
%
s() running, defined at
%
s:
%
s'
%
(
coro_name
,
filename
,
lineno
)
coro_repr
=
(
'
%
s() running, defined at
%
s:
%
s'
%
(
coro_name
,
filename
,
lineno
))
elif
coro
.
gi_frame
is
not
None
:
lineno
=
coro
.
gi_frame
.
f_lineno
coro_repr
=
'
%
s() running at
%
s:
%
s'
%
(
coro_name
,
filename
,
lineno
)
coro_repr
=
(
'
%
s() running at
%
s:
%
s'
%
(
coro_name
,
filename
,
lineno
))
else
:
lineno
=
coro
.
gi_code
.
co_firstlineno
coro_repr
=
'
%
s() done, defined at
%
s:
%
s'
%
(
coro_name
,
filename
,
lineno
)
coro_repr
=
(
'
%
s() done, defined at
%
s:
%
s'
%
(
coro_name
,
filename
,
lineno
))
return
coro_repr
Lib/asyncio/selector_events.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -55,8 +55,8 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
return
_SelectorSocketTransport
(
self
,
sock
,
protocol
,
waiter
,
extra
,
server
)
def
_make_ssl_transport
(
self
,
rawsock
,
protocol
,
sslcontext
,
waiter
=
None
,
*
,
server_side
=
False
,
server_hostname
=
None
,
def
_make_ssl_transport
(
self
,
rawsock
,
protocol
,
sslcontext
,
waiter
=
None
,
*
,
server_side
=
False
,
server_hostname
=
None
,
extra
=
None
,
server
=
None
):
return
_SelectorSslTransport
(
self
,
rawsock
,
protocol
,
sslcontext
,
waiter
,
...
...
@@ -484,7 +484,8 @@ class _SelectorTransport(transports._FlowControlMixin,
info
.
append
(
'read=idle'
)
polling
=
_test_selector_event
(
self
.
_loop
.
_selector
,
self
.
_sock_fd
,
selectors
.
EVENT_WRITE
)
self
.
_sock_fd
,
selectors
.
EVENT_WRITE
)
if
polling
:
state
=
'polling'
else
:
...
...
Lib/asyncio/tasks.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -68,7 +68,7 @@ class Task(futures.Future):
return
{
t
for
t
in
cls
.
_all_tasks
if
t
.
_loop
is
loop
}
def
__init__
(
self
,
coro
,
*
,
loop
=
None
):
assert
coroutines
.
iscoroutine
(
coro
),
repr
(
coro
)
# Not a coroutine function!
assert
coroutines
.
iscoroutine
(
coro
),
repr
(
coro
)
super
()
.
__init__
(
loop
=
loop
)
if
self
.
_source_traceback
:
del
self
.
_source_traceback
[
-
1
]
...
...
Lib/asyncio/unix_events.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -69,7 +69,8 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
"""
if
(
coroutines
.
iscoroutine
(
callback
)
or
coroutines
.
iscoroutinefunction
(
callback
)):
raise
TypeError
(
"coroutines cannot be used with add_signal_handler()"
)
raise
TypeError
(
"coroutines cannot be used "
"with add_signal_handler()"
)
self
.
_check_signal
(
sig
)
self
.
_check_closed
()
try
:
...
...
Lib/asyncio/windows_events.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -424,7 +424,8 @@ class IocpProactor:
else
:
return
windows_utils
.
PipeHandle
(
handle
)
return
self
.
_register
(
ov
,
None
,
finish_connect_pipe
,
wait_for_post
=
True
)
return
self
.
_register
(
ov
,
None
,
finish_connect_pipe
,
wait_for_post
=
True
)
def
wait_for_handle
(
self
,
handle
,
timeout
=
None
):
"""Wait for a handle.
...
...
Lib/asyncio/windows_utils.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -36,15 +36,16 @@ else:
def
socketpair
(
family
=
socket
.
AF_INET
,
type
=
socket
.
SOCK_STREAM
,
proto
=
0
):
"""A socket pair usable as a self-pipe, for Windows.
Origin: https://gist.github.com/4325783, by Geert Jansen. Public domain.
Origin: https://gist.github.com/4325783, by Geert Jansen.
Public domain.
"""
if
family
==
socket
.
AF_INET
:
host
=
'127.0.0.1'
elif
family
==
socket
.
AF_INET6
:
host
=
'::1'
else
:
raise
ValueError
(
"Only AF_INET and AF_INET6 socket address
families
"
"are supported"
)
raise
ValueError
(
"Only AF_INET and AF_INET6 socket address "
"
families
are supported"
)
if
type
!=
socket
.
SOCK_STREAM
:
raise
ValueError
(
"Only SOCK_STREAM socket type is supported"
)
if
proto
!=
0
:
...
...
Lib/test/test_asyncio/test_base_events.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -285,7 +285,8 @@ class BaseEventLoopTests(test_utils.TestCase):
@mock.patch
(
'asyncio.base_events.logger'
)
def
test__run_once_logging
(
self
,
m_logger
):
def
slow_select
(
timeout
):
# Sleep a bit longer than a second to avoid timer resolution issues.
# Sleep a bit longer than a second to avoid timer resolution
# issues.
time
.
sleep
(
1.1
)
return
[]
...
...
@@ -1217,14 +1218,16 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
self
.
loop
.
run_forever
()
fmt
,
*
args
=
m_logger
.
warning
.
call_args
[
0
]
self
.
assertRegex
(
fmt
%
tuple
(
args
),
"^Executing <Handle.*stop_loop_cb.*> took .* seconds$"
)
"^Executing <Handle.*stop_loop_cb.*> "
"took .* seconds$"
)
# slow task
asyncio
.
async
(
stop_loop_coro
(
self
.
loop
),
loop
=
self
.
loop
)
self
.
loop
.
run_forever
()
fmt
,
*
args
=
m_logger
.
warning
.
call_args
[
0
]
self
.
assertRegex
(
fmt
%
tuple
(
args
),
"^Executing <Task.*stop_loop_coro.*> took .* seconds$"
)
"^Executing <Task.*stop_loop_coro.*> "
"took .* seconds$"
)
if
__name__
==
'__main__'
:
...
...
Lib/test/test_asyncio/test_futures.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -133,7 +133,8 @@ class FutureTests(test_utils.TestCase):
exc
=
RuntimeError
()
f_exception
=
asyncio
.
Future
(
loop
=
self
.
loop
)
f_exception
.
set_exception
(
exc
)
self
.
assertEqual
(
repr
(
f_exception
),
'<Future finished exception=RuntimeError()>'
)
self
.
assertEqual
(
repr
(
f_exception
),
'<Future finished exception=RuntimeError()>'
)
self
.
assertIs
(
f_exception
.
exception
(),
exc
)
def
func_repr
(
func
):
...
...
@@ -332,16 +333,21 @@ class FutureTests(test_utils.TestCase):
if
debug
:
frame
=
source_traceback
[
-
1
]
regex
=
(
r'^Future exception was never retrieved\n'
r'future: <Future finished exception=MemoryError\(\) created at {filename}:{lineno}>\n'
r'source_traceback: Object created at \(most recent call last\):\n'
r'future: <Future finished exception=MemoryError\(\) '
r'created at {filename}:{lineno}>\n'
r'source_traceback: Object '
r'created at \(most recent call last\):\n'
r' File'
r'.*\n'
r' File "{filename}", line {lineno}, in check_future_exception_never_retrieved\n'
r' File "{filename}", line {lineno}, '
r'in check_future_exception_never_retrieved\n'
r' future = asyncio\.Future\(loop=self\.loop\)$'
)
.
format
(
filename
=
re
.
escape
(
frame
[
0
]),
lineno
=
frame
[
1
])
)
.
format
(
filename
=
re
.
escape
(
frame
[
0
]),
lineno
=
frame
[
1
])
else
:
regex
=
(
r'^Future exception was never retrieved\n'
r'future: <Future finished exception=MemoryError\(\)>$'
r'future: '
r'<Future finished exception=MemoryError\(\)>$'
)
exc_info
=
(
type
(
exc
),
exc
,
exc
.
__traceback__
)
m_log
.
error
.
assert_called_once_with
(
mock
.
ANY
,
exc_info
=
exc_info
)
...
...
@@ -352,12 +358,14 @@ class FutureTests(test_utils.TestCase):
r'Future/Task created at \(most recent call last\):\n'
r' File'
r'.*\n'
r' File "{filename}", line {lineno}, in check_future_exception_never_retrieved\n'
r' File "{filename}", line {lineno}, '
r'in check_future_exception_never_retrieved\n'
r' future = asyncio\.Future\(loop=self\.loop\)\n'
r'Traceback \(most recent call last\):\n'
r'.*\n'
r'MemoryError$'
)
.
format
(
filename
=
re
.
escape
(
frame
[
0
]),
lineno
=
frame
[
1
])
)
.
format
(
filename
=
re
.
escape
(
frame
[
0
]),
lineno
=
frame
[
1
])
else
:
regex
=
(
r'^Future/Task exception was never retrieved\n'
r'Traceback \(most recent call last\):\n'
...
...
Lib/test/test_asyncio/test_streams.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -613,8 +613,10 @@ os.close(fd)
watcher
.
attach_loop
(
self
.
loop
)
try
:
asyncio
.
set_child_watcher
(
watcher
)
proc
=
self
.
loop
.
run_until_complete
(
asyncio
.
create_subprocess_exec
(
*
args
,
pass_fds
=
{
wfd
},
loop
=
self
.
loop
))
create
=
asyncio
.
create_subprocess_exec
(
*
args
,
pass_fds
=
{
wfd
},
loop
=
self
.
loop
)
proc
=
self
.
loop
.
run_until_complete
(
create
)
self
.
loop
.
run_until_complete
(
proc
.
wait
())
finally
:
asyncio
.
set_child_watcher
(
None
)
...
...
Lib/test/test_asyncio/test_subprocess.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -115,7 +115,9 @@ class SubprocessMixin:
def
test_send_signal
(
self
):
code
=
'import time; print("sleeping", flush=True); time.sleep(3600)'
args
=
[
sys
.
executable
,
'-c'
,
code
]
create
=
asyncio
.
create_subprocess_exec
(
*
args
,
loop
=
self
.
loop
,
stdout
=
subprocess
.
PIPE
)
create
=
asyncio
.
create_subprocess_exec
(
*
args
,
stdout
=
subprocess
.
PIPE
,
loop
=
self
.
loop
)
proc
=
self
.
loop
.
run_until_complete
(
create
)
@asyncio.coroutine
...
...
Lib/test/test_asyncio/test_tasks.py
Dosyayı görüntüle @
15cc678d
...
...
@@ -208,7 +208,8 @@ class TaskTests(test_utils.TestCase):
self
.
assertEqual
(
notmuch
.
__name__
,
'notmuch'
)
if
PY35
:
self
.
assertEqual
(
notmuch
.
__qualname__
,
'TaskTests.test_task_repr_coro_decorator.<locals>.notmuch'
)
'TaskTests.test_task_repr_coro_decorator'
'.<locals>.notmuch'
)
self
.
assertEqual
(
notmuch
.
__module__
,
__name__
)
# test coroutine object
...
...
@@ -218,7 +219,8 @@ class TaskTests(test_utils.TestCase):
# function, as expected, and have a qualified name (__qualname__
# attribute).
coro_name
=
'notmuch'
coro_qualname
=
'TaskTests.test_task_repr_coro_decorator.<locals>.notmuch'
coro_qualname
=
(
'TaskTests.test_task_repr_coro_decorator'
'.<locals>.notmuch'
)
else
:
# On Python < 3.5, generators inherit the name of the code, not of
# the function. See: http://bugs.python.org/issue21205
...
...
@@ -239,7 +241,8 @@ class TaskTests(test_utils.TestCase):
else
:
code
=
gen
.
gi_code
coro
=
(
'
%
s() running at
%
s:
%
s'
%
(
coro_qualname
,
code
.
co_filename
,
code
.
co_firstlineno
))
%
(
coro_qualname
,
code
.
co_filename
,
code
.
co_firstlineno
))
self
.
assertEqual
(
repr
(
gen
),
'<CoroWrapper
%
s>'
%
coro
)
...
...
@@ -1678,7 +1681,8 @@ class TaskTests(test_utils.TestCase):
self
.
assertTrue
(
m_log
.
error
.
called
)
message
=
m_log
.
error
.
call_args
[
0
][
0
]
func_filename
,
func_lineno
=
test_utils
.
get_function_source
(
coro_noop
)
regex
=
(
r'^<CoroWrapper
%
s\(\) .* at
%
s:
%
s, .*> was never yielded from\n'
regex
=
(
r'^<CoroWrapper
%
s\(\) .* at
%
s:
%
s, .*> '
r'was never yielded from\n'
r'Coroutine object created at \(most recent call last\):\n'
r'.*\n'
r' File "
%
s", line
%
s, in test_coroutine_never_yielded\n'
...
...
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