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
3d4dbd8f
Unverified
Kaydet (Commit)
3d4dbd8f
authored
Şub 01, 2018
tarafından
Andrew Svetlov
Kaydeden (comit)
GitHub
Şub 01, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Implement TimerHandle.when() (#5473)
üst
83ab9958
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
4 deletions
+34
-4
asyncio-eventloop.rst
Doc/library/asyncio-eventloop.rst
+19
-4
events.py
Lib/asyncio/events.py
+8
-0
test_events.py
Lib/test/test_asyncio/test_events.py
+6
-0
2018-02-01-17-54-08.bpo-32741.KUvOPL.rst
...S.d/next/Library/2018-02-01-17-54-08.bpo-32741.KUvOPL.rst
+1
-0
No files found.
Doc/library/asyncio-eventloop.rst
Dosyayı görüntüle @
3d4dbd8f
...
...
@@ -171,7 +171,7 @@ a different clock than :func:`time.time`.
Arrange for the *callback* to be called after the given *delay*
seconds (either an int or float).
An instance of :class:`asyncio.Handle` is returned, which can be
An instance of :class:`asyncio.
Timer
Handle` is returned, which can be
used to cancel the callback.
*callback* will be called exactly once per call to :meth:`call_later`.
...
...
@@ -193,7 +193,7 @@ a different clock than :func:`time.time`.
This method's behavior is the same as :meth:`call_later`.
An instance of :class:`asyncio.Handle` is returned, which can be
An instance of :class:`asyncio.
Timer
Handle` is returned, which can be
used to cancel the callback.
:ref:`Use functools.partial to pass keywords to the callback
...
...
@@ -1076,8 +1076,7 @@ Handle
.. class:: Handle
A callback wrapper object returned by :func:`AbstractEventLoop.call_soon`,
:func:`AbstractEventLoop.call_soon_threadsafe`, :func:`AbstractEventLoop.call_later`,
and :func:`AbstractEventLoop.call_at`.
:func:`AbstractEventLoop.call_soon_threadsafe`.
.. method:: cancel()
...
...
@@ -1090,6 +1089,22 @@ Handle
.. versionadded:: 3.7
.. class:: TimerHandle
A callback wrapper object returned by :func:`AbstractEventLoop.call_later`,
and :func:`AbstractEventLoop.call_at`.
The class is inherited from :class:`Handle`.
.. method:: when()
Return a scheduled callback time as :class:`float` seconds.
The time is an absolute timestamp, using the same time
reference as :meth:`AbstractEventLoop.time`.
.. versionadded:: 3.7
SendfileNotAvailableError
-------------------------
...
...
Lib/asyncio/events.py
Dosyayı görüntüle @
3d4dbd8f
...
...
@@ -156,6 +156,14 @@ class TimerHandle(Handle):
self
.
_loop
.
_timer_handle_cancelled
(
self
)
super
()
.
cancel
()
def
when
(
self
):
"""Return a scheduled callback time.
The time is an absolute timestamp, using the same time
reference as loop.time().
"""
return
self
.
_when
class
AbstractServer
:
"""Abstract server returned by create_server()."""
...
...
Lib/test/test_asyncio/test_events.py
Dosyayı görüntüle @
3d4dbd8f
...
...
@@ -2679,6 +2679,12 @@ class TimerTests(unittest.TestCase):
mock
.
Mock
())
self
.
assertEqual
(
hash
(
h
),
hash
(
when
))
def
test_when
(
self
):
when
=
time
.
monotonic
()
h
=
asyncio
.
TimerHandle
(
when
,
lambda
:
False
,
(),
mock
.
Mock
())
self
.
assertEqual
(
when
,
h
.
when
())
def
test_timer
(
self
):
def
callback
(
*
args
):
return
args
...
...
Misc/NEWS.d/next/Library/2018-02-01-17-54-08.bpo-32741.KUvOPL.rst
0 → 100644
Dosyayı görüntüle @
3d4dbd8f
Implement ``asyncio.TimerHandle.when()`` method.
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