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
b41a42e3
Kaydet (Commit)
b41a42e3
authored
Şub 19, 2014
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: pep8-ify the code.
üst
b0b0e628
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
12 deletions
+26
-12
base_events.py
Lib/asyncio/base_events.py
+6
-5
subprocess.py
Lib/asyncio/subprocess.py
+3
-2
test_subprocess.py
Lib/test/test_asyncio/test_subprocess.py
+10
-2
test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+3
-1
test_unix_events.py
Lib/test/test_asyncio/test_unix_events.py
+4
-2
No files found.
Lib/asyncio/base_events.py
Dosyayı görüntüle @
b41a42e3
...
@@ -605,10 +605,10 @@ class BaseEventLoop(events.AbstractEventLoop):
...
@@ -605,10 +605,10 @@ class BaseEventLoop(events.AbstractEventLoop):
return
transport
,
protocol
return
transport
,
protocol
@tasks.coroutine
@tasks.coroutine
def
subprocess_exec
(
self
,
protocol_factory
,
program
,
*
args
,
stdin
=
subprocess
.
PIPE
,
def
subprocess_exec
(
self
,
protocol_factory
,
program
,
*
args
,
std
out
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
std
in
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
False
,
shell
=
False
,
bufsize
=
0
,
stderr
=
subprocess
.
PIPE
,
universal_newlines
=
False
,
**
kwargs
):
shell
=
False
,
bufsize
=
0
,
**
kwargs
):
if
universal_newlines
:
if
universal_newlines
:
raise
ValueError
(
"universal_newlines must be False"
)
raise
ValueError
(
"universal_newlines must be False"
)
if
shell
:
if
shell
:
...
@@ -623,7 +623,8 @@ class BaseEventLoop(events.AbstractEventLoop):
...
@@ -623,7 +623,8 @@ class BaseEventLoop(events.AbstractEventLoop):
%
type
(
arg
)
.
__name__
)
%
type
(
arg
)
.
__name__
)
protocol
=
protocol_factory
()
protocol
=
protocol_factory
()
transport
=
yield
from
self
.
_make_subprocess_transport
(
transport
=
yield
from
self
.
_make_subprocess_transport
(
protocol
,
popen_args
,
False
,
stdin
,
stdout
,
stderr
,
bufsize
,
**
kwargs
)
protocol
,
popen_args
,
False
,
stdin
,
stdout
,
stderr
,
bufsize
,
**
kwargs
)
return
transport
,
protocol
return
transport
,
protocol
def
set_exception_handler
(
self
,
handler
):
def
set_exception_handler
(
self
,
handler
):
...
...
Lib/asyncio/subprocess.py
Dosyayı görüntüle @
b41a42e3
...
@@ -180,8 +180,9 @@ def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None,
...
@@ -180,8 +180,9 @@ def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None,
return
Process
(
transport
,
protocol
,
loop
)
return
Process
(
transport
,
protocol
,
loop
)
@tasks.coroutine
@tasks.coroutine
def
create_subprocess_exec
(
program
,
*
args
,
stdin
=
None
,
stdout
=
None
,
stderr
=
None
,
def
create_subprocess_exec
(
program
,
*
args
,
stdin
=
None
,
stdout
=
None
,
loop
=
None
,
limit
=
streams
.
_DEFAULT_LIMIT
,
**
kwds
):
stderr
=
None
,
loop
=
None
,
limit
=
streams
.
_DEFAULT_LIMIT
,
**
kwds
):
if
loop
is
None
:
if
loop
is
None
:
loop
=
events
.
get_event_loop
()
loop
=
events
.
get_event_loop
()
protocol_factory
=
lambda
:
SubprocessStreamProtocol
(
limit
=
limit
,
protocol_factory
=
lambda
:
SubprocessStreamProtocol
(
limit
=
limit
,
...
...
Lib/test/test_asyncio/test_subprocess.py
Dosyayı görüntüle @
b41a42e3
...
@@ -21,6 +21,7 @@ PROGRAM_CAT = [
...
@@ -21,6 +21,7 @@ PROGRAM_CAT = [
'sys.stdout.buffer.write(data)'
))]
'sys.stdout.buffer.write(data)'
))]
class
SubprocessMixin
:
class
SubprocessMixin
:
def
test_stdin_stdout
(
self
):
def
test_stdin_stdout
(
self
):
args
=
PROGRAM_CAT
args
=
PROGRAM_CAT
...
@@ -132,6 +133,7 @@ class SubprocessMixin:
...
@@ -132,6 +133,7 @@ class SubprocessMixin:
if
sys
.
platform
!=
'win32'
:
if
sys
.
platform
!=
'win32'
:
# Unix
# Unix
class
SubprocessWatcherMixin
(
SubprocessMixin
):
class
SubprocessWatcherMixin
(
SubprocessMixin
):
Watcher
=
None
Watcher
=
None
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -151,14 +153,20 @@ if sys.platform != 'win32':
...
@@ -151,14 +153,20 @@ if sys.platform != 'win32':
self
.
loop
.
close
()
self
.
loop
.
close
()
policy
.
set_event_loop
(
None
)
policy
.
set_event_loop
(
None
)
class
SubprocessSafeWatcherTests
(
SubprocessWatcherMixin
,
unittest
.
TestCase
):
class
SubprocessSafeWatcherTests
(
SubprocessWatcherMixin
,
unittest
.
TestCase
):
Watcher
=
unix_events
.
SafeChildWatcher
Watcher
=
unix_events
.
SafeChildWatcher
class
SubprocessFastWatcherTests
(
SubprocessWatcherMixin
,
unittest
.
TestCase
):
class
SubprocessFastWatcherTests
(
SubprocessWatcherMixin
,
unittest
.
TestCase
):
Watcher
=
unix_events
.
FastChildWatcher
Watcher
=
unix_events
.
FastChildWatcher
else
:
else
:
# Windows
# Windows
class
SubprocessProactorTests
(
SubprocessMixin
,
unittest
.
TestCase
):
class
SubprocessProactorTests
(
SubprocessMixin
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
policy
=
asyncio
.
get_event_loop_policy
()
policy
=
asyncio
.
get_event_loop_policy
()
self
.
loop
=
asyncio
.
ProactorEventLoop
()
self
.
loop
=
asyncio
.
ProactorEventLoop
()
...
...
Lib/test/test_asyncio/test_tasks.py
Dosyayı görüntüle @
b41a42e3
...
@@ -876,6 +876,7 @@ class TaskTests(unittest.TestCase):
...
@@ -876,6 +876,7 @@ class TaskTests(unittest.TestCase):
self
.
assertEqual
(
set
(
f
.
result
()
for
f
in
done
),
{
'a'
,
'b'
})
self
.
assertEqual
(
set
(
f
.
result
()
for
f
in
done
),
{
'a'
,
'b'
})
def
test_as_completed_duplicate_coroutines
(
self
):
def
test_as_completed_duplicate_coroutines
(
self
):
@asyncio.coroutine
@asyncio.coroutine
def
coro
(
s
):
def
coro
(
s
):
return
s
return
s
...
@@ -884,7 +885,8 @@ class TaskTests(unittest.TestCase):
...
@@ -884,7 +885,8 @@ class TaskTests(unittest.TestCase):
def
runner
():
def
runner
():
result
=
[]
result
=
[]
c
=
coro
(
'ham'
)
c
=
coro
(
'ham'
)
for
f
in
asyncio
.
as_completed
([
c
,
c
,
coro
(
'spam'
)],
loop
=
self
.
loop
):
for
f
in
asyncio
.
as_completed
([
c
,
c
,
coro
(
'spam'
)],
loop
=
self
.
loop
):
result
.
append
((
yield
from
f
))
result
.
append
((
yield
from
f
))
return
result
return
result
...
...
Lib/test/test_asyncio/test_unix_events.py
Dosyayı görüntüle @
b41a42e3
...
@@ -367,7 +367,8 @@ class UnixReadPipeTransportTests(unittest.TestCase):
...
@@ -367,7 +367,8 @@ class UnixReadPipeTransportTests(unittest.TestCase):
tr
.
_close
.
assert_called_with
(
err
)
tr
.
_close
.
assert_called_with
(
err
)
m_logexc
.
assert_called_with
(
m_logexc
.
assert_called_with
(
test_utils
.
MockPattern
(
test_utils
.
MockPattern
(
'Fatal read error on pipe transport
\n
protocol:.*
\n
transport:.*'
),
'Fatal read error on pipe transport'
'
\n
protocol:.*
\n
transport:.*'
),
exc_info
=
(
OSError
,
MOCK_ANY
,
MOCK_ANY
))
exc_info
=
(
OSError
,
MOCK_ANY
,
MOCK_ANY
))
@unittest.mock.patch
(
'os.read'
)
@unittest.mock.patch
(
'os.read'
)
...
@@ -664,7 +665,8 @@ class UnixWritePipeTransportTests(unittest.TestCase):
...
@@ -664,7 +665,8 @@ class UnixWritePipeTransportTests(unittest.TestCase):
self
.
assertTrue
(
tr
.
_closing
)
self
.
assertTrue
(
tr
.
_closing
)
m_logexc
.
assert_called_with
(
m_logexc
.
assert_called_with
(
test_utils
.
MockPattern
(
test_utils
.
MockPattern
(
'Fatal write error on pipe transport
\n
protocol:.*
\n
transport:.*'
),
'Fatal write error on pipe transport'
'
\n
protocol:.*
\n
transport:.*'
),
exc_info
=
(
OSError
,
MOCK_ANY
,
MOCK_ANY
))
exc_info
=
(
OSError
,
MOCK_ANY
,
MOCK_ANY
))
self
.
assertEqual
(
1
,
tr
.
_conn_lost
)
self
.
assertEqual
(
1
,
tr
.
_conn_lost
)
test_utils
.
run_briefly
(
self
.
loop
)
test_utils
.
run_briefly
(
self
.
loop
)
...
...
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