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
a849be9c
Kaydet (Commit)
a849be9c
authored
Ock 31, 2014
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: Fix misc whitespace issues.
üst
1c165373
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
streams.py
Lib/asyncio/streams.py
+1
-0
test_streams.py
Lib/test/test_asyncio/test_streams.py
+2
-2
test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+12
-11
No files found.
Lib/asyncio/streams.py
Dosyayı görüntüle @
a849be9c
...
@@ -14,6 +14,7 @@ from . import tasks
...
@@ -14,6 +14,7 @@ from . import tasks
_DEFAULT_LIMIT
=
2
**
16
_DEFAULT_LIMIT
=
2
**
16
class
IncompleteReadError
(
EOFError
):
class
IncompleteReadError
(
EOFError
):
"""
"""
Incomplete read error. Attributes:
Incomplete read error. Attributes:
...
...
Lib/test/test_asyncio/test_streams.py
Dosyayı görüntüle @
a849be9c
...
@@ -415,7 +415,7 @@ class StreamReaderTests(unittest.TestCase):
...
@@ -415,7 +415,7 @@ class StreamReaderTests(unittest.TestCase):
server
=
MyServer
(
self
.
loop
)
server
=
MyServer
(
self
.
loop
)
server
.
start
()
server
.
start
()
msg
=
self
.
loop
.
run_until_complete
(
asyncio
.
Task
(
client
(),
msg
=
self
.
loop
.
run_until_complete
(
asyncio
.
Task
(
client
(),
loop
=
self
.
loop
))
loop
=
self
.
loop
))
server
.
stop
()
server
.
stop
()
self
.
assertEqual
(
msg
,
b
"hello world!
\n
"
)
self
.
assertEqual
(
msg
,
b
"hello world!
\n
"
)
...
@@ -423,7 +423,7 @@ class StreamReaderTests(unittest.TestCase):
...
@@ -423,7 +423,7 @@ class StreamReaderTests(unittest.TestCase):
server
=
MyServer
(
self
.
loop
)
server
=
MyServer
(
self
.
loop
)
server
.
start_callback
()
server
.
start_callback
()
msg
=
self
.
loop
.
run_until_complete
(
asyncio
.
Task
(
client
(),
msg
=
self
.
loop
.
run_until_complete
(
asyncio
.
Task
(
client
(),
loop
=
self
.
loop
))
loop
=
self
.
loop
))
server
.
stop
()
server
.
stop
()
self
.
assertEqual
(
msg
,
b
"hello world!
\n
"
)
self
.
assertEqual
(
msg
,
b
"hello world!
\n
"
)
...
...
Lib/test/test_asyncio/test_tasks.py
Dosyayı görüntüle @
a849be9c
...
@@ -379,7 +379,6 @@ class TaskTests(unittest.TestCase):
...
@@ -379,7 +379,6 @@ class TaskTests(unittest.TestCase):
self
.
assertAlmostEqual
(
0.1
,
loop
.
time
())
self
.
assertAlmostEqual
(
0.1
,
loop
.
time
())
self
.
assertEqual
(
foo_running
,
False
)
self
.
assertEqual
(
foo_running
,
False
)
def
test_wait_for_blocking
(
self
):
def
test_wait_for_blocking
(
self
):
loop
=
test_utils
.
TestLoop
()
loop
=
test_utils
.
TestLoop
()
self
.
addCleanup
(
loop
.
close
)
self
.
addCleanup
(
loop
.
close
)
...
@@ -388,7 +387,9 @@ class TaskTests(unittest.TestCase):
...
@@ -388,7 +387,9 @@ class TaskTests(unittest.TestCase):
def
coro
():
def
coro
():
return
'done'
return
'done'
res
=
loop
.
run_until_complete
(
asyncio
.
wait_for
(
coro
(),
timeout
=
None
,
loop
=
loop
))
res
=
loop
.
run_until_complete
(
asyncio
.
wait_for
(
coro
(),
timeout
=
None
,
loop
=
loop
))
self
.
assertEqual
(
res
,
'done'
)
self
.
assertEqual
(
res
,
'done'
)
def
test_wait_for_with_global_loop
(
self
):
def
test_wait_for_with_global_loop
(
self
):
...
@@ -490,7 +491,7 @@ class TaskTests(unittest.TestCase):
...
@@ -490,7 +491,7 @@ class TaskTests(unittest.TestCase):
self
.
assertRaises
(
self
.
assertRaises
(
ValueError
,
self
.
loop
.
run_until_complete
,
ValueError
,
self
.
loop
.
run_until_complete
,
asyncio
.
wait
([
asyncio
.
sleep
(
10.0
,
loop
=
self
.
loop
)],
asyncio
.
wait
([
asyncio
.
sleep
(
10.0
,
loop
=
self
.
loop
)],
return_when
=-
1
,
loop
=
self
.
loop
))
return_when
=-
1
,
loop
=
self
.
loop
))
def
test_wait_first_completed
(
self
):
def
test_wait_first_completed
(
self
):
...
@@ -508,7 +509,7 @@ class TaskTests(unittest.TestCase):
...
@@ -508,7 +509,7 @@ class TaskTests(unittest.TestCase):
b
=
asyncio
.
Task
(
asyncio
.
sleep
(
0.1
,
loop
=
loop
),
loop
=
loop
)
b
=
asyncio
.
Task
(
asyncio
.
sleep
(
0.1
,
loop
=
loop
),
loop
=
loop
)
task
=
asyncio
.
Task
(
task
=
asyncio
.
Task
(
asyncio
.
wait
([
b
,
a
],
return_when
=
asyncio
.
FIRST_COMPLETED
,
asyncio
.
wait
([
b
,
a
],
return_when
=
asyncio
.
FIRST_COMPLETED
,
loop
=
loop
),
loop
=
loop
),
loop
=
loop
)
loop
=
loop
)
done
,
pending
=
loop
.
run_until_complete
(
task
)
done
,
pending
=
loop
.
run_until_complete
(
task
)
...
@@ -540,7 +541,7 @@ class TaskTests(unittest.TestCase):
...
@@ -540,7 +541,7 @@ class TaskTests(unittest.TestCase):
b
=
asyncio
.
Task
(
coro2
(),
loop
=
self
.
loop
)
b
=
asyncio
.
Task
(
coro2
(),
loop
=
self
.
loop
)
task
=
asyncio
.
Task
(
task
=
asyncio
.
Task
(
asyncio
.
wait
([
b
,
a
],
return_when
=
asyncio
.
FIRST_COMPLETED
,
asyncio
.
wait
([
b
,
a
],
return_when
=
asyncio
.
FIRST_COMPLETED
,
loop
=
self
.
loop
),
loop
=
self
.
loop
),
loop
=
self
.
loop
)
loop
=
self
.
loop
)
done
,
pending
=
self
.
loop
.
run_until_complete
(
task
)
done
,
pending
=
self
.
loop
.
run_until_complete
(
task
)
...
@@ -570,7 +571,7 @@ class TaskTests(unittest.TestCase):
...
@@ -570,7 +571,7 @@ class TaskTests(unittest.TestCase):
b
=
asyncio
.
Task
(
exc
(),
loop
=
loop
)
b
=
asyncio
.
Task
(
exc
(),
loop
=
loop
)
task
=
asyncio
.
Task
(
task
=
asyncio
.
Task
(
asyncio
.
wait
([
b
,
a
],
return_when
=
asyncio
.
FIRST_EXCEPTION
,
asyncio
.
wait
([
b
,
a
],
return_when
=
asyncio
.
FIRST_EXCEPTION
,
loop
=
loop
),
loop
=
loop
),
loop
=
loop
)
loop
=
loop
)
done
,
pending
=
loop
.
run_until_complete
(
task
)
done
,
pending
=
loop
.
run_until_complete
(
task
)
...
@@ -604,7 +605,7 @@ class TaskTests(unittest.TestCase):
...
@@ -604,7 +605,7 @@ class TaskTests(unittest.TestCase):
b
=
asyncio
.
Task
(
exc
(),
loop
=
loop
)
b
=
asyncio
.
Task
(
exc
(),
loop
=
loop
)
task
=
asyncio
.
wait
([
b
,
a
],
return_when
=
asyncio
.
FIRST_EXCEPTION
,
task
=
asyncio
.
wait
([
b
,
a
],
return_when
=
asyncio
.
FIRST_EXCEPTION
,
loop
=
loop
)
loop
=
loop
)
done
,
pending
=
loop
.
run_until_complete
(
task
)
done
,
pending
=
loop
.
run_until_complete
(
task
)
self
.
assertEqual
({
b
},
done
)
self
.
assertEqual
({
b
},
done
)
...
@@ -670,7 +671,7 @@ class TaskTests(unittest.TestCase):
...
@@ -670,7 +671,7 @@ class TaskTests(unittest.TestCase):
@asyncio.coroutine
@asyncio.coroutine
def
foo
():
def
foo
():
done
,
pending
=
yield
from
asyncio
.
wait
([
b
,
a
],
timeout
=
0.11
,
done
,
pending
=
yield
from
asyncio
.
wait
([
b
,
a
],
timeout
=
0.11
,
loop
=
loop
)
loop
=
loop
)
self
.
assertEqual
(
done
,
set
([
a
]))
self
.
assertEqual
(
done
,
set
([
a
]))
self
.
assertEqual
(
pending
,
set
([
b
]))
self
.
assertEqual
(
pending
,
set
([
b
]))
...
@@ -874,7 +875,7 @@ class TaskTests(unittest.TestCase):
...
@@ -874,7 +875,7 @@ class TaskTests(unittest.TestCase):
self
.
addCleanup
(
loop
.
close
)
self
.
addCleanup
(
loop
.
close
)
t
=
asyncio
.
Task
(
asyncio
.
sleep
(
10.0
,
'yeah'
,
loop
=
loop
),
t
=
asyncio
.
Task
(
asyncio
.
sleep
(
10.0
,
'yeah'
,
loop
=
loop
),
loop
=
loop
)
loop
=
loop
)
handle
=
None
handle
=
None
orig_call_later
=
loop
.
call_later
orig_call_later
=
loop
.
call_later
...
@@ -1156,7 +1157,7 @@ class TaskTests(unittest.TestCase):
...
@@ -1156,7 +1157,7 @@ class TaskTests(unittest.TestCase):
task2
=
asyncio
.
Task
(
coro2
(
self
.
loop
),
loop
=
self
.
loop
)
task2
=
asyncio
.
Task
(
coro2
(
self
.
loop
),
loop
=
self
.
loop
)
self
.
loop
.
run_until_complete
(
asyncio
.
wait
((
task1
,
task2
),
self
.
loop
.
run_until_complete
(
asyncio
.
wait
((
task1
,
task2
),
loop
=
self
.
loop
))
loop
=
self
.
loop
))
self
.
assertIsNone
(
asyncio
.
Task
.
current_task
(
loop
=
self
.
loop
))
self
.
assertIsNone
(
asyncio
.
Task
.
current_task
(
loop
=
self
.
loop
))
# Some thorough tests for cancellation propagation through
# Some thorough tests for cancellation propagation through
...
@@ -1367,7 +1368,7 @@ class GatherTestsBase:
...
@@ -1367,7 +1368,7 @@ class GatherTestsBase:
def
test_return_exceptions
(
self
):
def
test_return_exceptions
(
self
):
a
,
b
,
c
,
d
=
[
asyncio
.
Future
(
loop
=
self
.
one_loop
)
for
i
in
range
(
4
)]
a
,
b
,
c
,
d
=
[
asyncio
.
Future
(
loop
=
self
.
one_loop
)
for
i
in
range
(
4
)]
fut
=
asyncio
.
gather
(
*
self
.
wrap_futures
(
a
,
b
,
c
,
d
),
fut
=
asyncio
.
gather
(
*
self
.
wrap_futures
(
a
,
b
,
c
,
d
),
return_exceptions
=
True
)
return_exceptions
=
True
)
cb
=
Mock
()
cb
=
Mock
()
fut
.
add_done_callback
(
cb
)
fut
.
add_done_callback
(
cb
)
exc
=
ZeroDivisionError
()
exc
=
ZeroDivisionError
()
...
...
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