Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9e49dd

Browse files
committed
Tulip issue 83, Python issue #21252: Fill some XXX docstrings in asyncio
1 parent 1a170a7 commit f9e49dd

3 files changed

Lines changed: 29 additions & 18 deletions

File tree

Doc/library/asyncio-eventloop.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ An event loop policy must implement the following interface:
6464

6565
.. method:: get_event_loop()
6666

67-
Get the event loop for current context. Returns an event loop object
68-
implementing :class:`BaseEventLoop` interface, or raises an exception in case
67+
Get the event loop for the current context. Returns an event loop object
68+
implementing the :class:`BaseEventLoop` interface, or raises an exception in case
6969
no event loop has been set for the current context and the current policy
7070
does not specify to create one. It should never return ``None``.
7171

7272
.. method:: set_event_loop(loop)
7373

74-
Set the event loop of the current context to *loop*.
74+
Set the event loop for the current context to *loop*.
7575

7676
.. method:: new_event_loop()
7777

7878
Create and return a new event loop object according to this policy's rules.
79-
If there's need to set this loop as the event loop of the current context,
79+
If there's need to set this loop as the event loop for the current context,
8080
:meth:`set_event_loop` must be called explicitly.
8181

8282
Access to the global loop policy

Lib/asyncio/events.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,25 +355,33 @@ class AbstractEventLoopPolicy:
355355
"""Abstract policy for accessing the event loop."""
356356

357357
def get_event_loop(self):
358-
"""XXX"""
358+
"""Get the event loop for the current context.
359+
360+
Returns an event loop object implementing the BaseEventLoop interface,
361+
or raises an exception in case no event loop has been set for the
362+
current context and the current policy does not specify to create one.
363+
364+
It should never return None."""
359365
raise NotImplementedError
360366

361367
def set_event_loop(self, loop):
362-
"""XXX"""
368+
"""Set the event loop for the current context to loop."""
363369
raise NotImplementedError
364370

365371
def new_event_loop(self):
366-
"""XXX"""
372+
"""Create and return a new event loop object according to this
373+
policy's rules. If there's need to set this loop as the event loop for
374+
the current context, set_event_loop must be called explicitly."""
367375
raise NotImplementedError
368376

369377
# Child processes handling (Unix only).
370378

371379
def get_child_watcher(self):
372-
"""XXX"""
380+
"Get the watcher for child processes."
373381
raise NotImplementedError
374382

375383
def set_child_watcher(self, watcher):
376-
"""XXX"""
384+
"""Set the watcher for child processes."""
377385
raise NotImplementedError
378386

379387

@@ -447,39 +455,42 @@ def _init_event_loop_policy():
447455

448456

449457
def get_event_loop_policy():
450-
"""XXX"""
458+
"""Get the current event loop policy."""
451459
if _event_loop_policy is None:
452460
_init_event_loop_policy()
453461
return _event_loop_policy
454462

455463

456464
def set_event_loop_policy(policy):
457-
"""XXX"""
465+
"""Set the current event loop policy.
466+
467+
If policy is None, the default policy is restored."""
458468
global _event_loop_policy
459469
assert policy is None or isinstance(policy, AbstractEventLoopPolicy)
460470
_event_loop_policy = policy
461471

462472

463473
def get_event_loop():
464-
"""XXX"""
474+
"""Equivalent to calling get_event_loop_policy().get_event_loop()."""
465475
return get_event_loop_policy().get_event_loop()
466476

467477

468478
def set_event_loop(loop):
469-
"""XXX"""
479+
"""Equivalent to calling get_event_loop_policy().set_event_loop(loop)."""
470480
get_event_loop_policy().set_event_loop(loop)
471481

472482

473483
def new_event_loop():
474-
"""XXX"""
484+
"""Equivalent to calling get_event_loop_policy().new_event_loop()."""
475485
return get_event_loop_policy().new_event_loop()
476486

477487

478488
def get_child_watcher():
479-
"""XXX"""
489+
"""Equivalent to calling get_event_loop_policy().get_child_watcher()."""
480490
return get_event_loop_policy().get_child_watcher()
481491

482492

483493
def set_child_watcher(watcher):
484-
"""XXX"""
494+
"""Equivalent to calling
495+
get_event_loop_policy().set_child_watcher(watcher)."""
485496
return get_event_loop_policy().set_child_watcher(watcher)

Lib/asyncio/unix_events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def set_event_loop(self, loop):
822822
self._watcher.attach_loop(loop)
823823

824824
def get_child_watcher(self):
825-
"""Get the child watcher
825+
"""Get the watcher for child processes.
826826
827827
If not yet set, a SafeChildWatcher object is automatically created.
828828
"""
@@ -832,7 +832,7 @@ def get_child_watcher(self):
832832
return self._watcher
833833

834834
def set_child_watcher(self, watcher):
835-
"""Set the child watcher"""
835+
"""Set the watcher for child processes."""
836836

837837
assert watcher is None or isinstance(watcher, AbstractChildWatcher)
838838

0 commit comments

Comments
 (0)