Skip to content

Commit 53e302e

Browse files
committed
Docstrings.
1 parent 67f748f commit 53e302e

7 files changed

Lines changed: 16 additions & 14 deletions

File tree

asyncio_tutorial/part_II_aiohttp_aiofiles/loops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
"""Interact with a running event loop."""
12
import asyncio
23

34
from asyncio_tutorial.logger import LOGGER
45

56

67
def inspect_event_loop():
7-
"""Get event loop info."""
8+
"""Inspect metadata for the current running event loop."""
89
loop = asyncio.get_event_loop()
910
thread_id = loop.__dict__.get("_thread_id")
1011
if loop.is_running():

asyncio_tutorial/part_II_aiohttp_aiofiles/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async def create_tasks(
1212
session: ClientSession, urls: List[str], directory
1313
) -> List[Task]:
1414
"""
15-
Create asyncio tasks to be executed.
15+
Create asyncio tasks to be execute the `fetch_and_save_url` coroutinne.
1616
1717
:param ClientSession session: Async HTTP requests session.
1818
:param List[str] urls: Resource URLs to fetch.

asyncio_tutorial/part_I_asyncio_intro/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Simple script to create and execute tasks in a loop"""
1+
"""Create and execute asynchronous tasks in a loop."""
22
import asyncio
33

44
from asyncio_tutorial.logger import LOGGER
@@ -10,7 +10,7 @@
1010

1111

1212
async def asyncio_intro_tutorial():
13-
"""Simple demonstration of a async script lifecycle"""
13+
"""Demo of an asynchronous script's lifecycle."""
1414
LOGGER.info(f"Asyncio tutorial Part I: Intro to Asyncio.")
1515
tasks = []
1616
future = register_future()
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
"""Create a coroutine containing the business logic of our task."""
1+
"""Create a coroutine function to be executed as asyncio task."""
22
import asyncio
33

44
from asyncio_tutorial.logger import LOGGER
55

66

77
async def simple_coroutine(number: int, delay=1):
88
"""
9-
Wait for a time delay, log number associated with the coroutine.
9+
Wait for a time delay & display number associated with coroutine.
1010
1111
:param int number: Number to identify the current coroutine.
12-
:param int delay: Time delay to simulate a function which takes time to complete.
12+
:param int delay: Time delay to simulate function delay.
1313
"""
1414
await asyncio.sleep(delay)
1515
LOGGER.info(f"This is Coroutine {number} being executed.")
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Create a Future (callback): an action to be taken when loop is completed."""
1+
"""Future which executes an action when loop is completed."""
22
import asyncio
33
from asyncio import Future
44

@@ -7,7 +7,7 @@
77

88
def register_future() -> Future:
99
"""
10-
Create a Future to log when loop is completed.
10+
Create a Future which triggers a callback when loop is completed.
1111
1212
:returns: Future
1313
"""
@@ -19,11 +19,11 @@ def register_future() -> Future:
1919

2020
def loop_completed(result: str):
2121
"""
22-
Callback to be called when loop is complete.
22+
Callback function fired when loop is complete.
2323
24-
:param str result: Simple string describing the state of the loop
24+
:param str result: String describing the state of the loop
2525
"""
2626
LOGGER.success(
2727
f"Loop completed with result: {result} \
28-
\n-------------------------------------------------"
28+
\n--------------------------------------"
2929
)

asyncio_tutorial/part_I_asyncio_intro/loops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
"""Interact with a running event loop."""
12
import asyncio
23

34
from asyncio_tutorial.logger import LOGGER
45

56

67
def inspect_event_loop():
7-
"""Get event loop info."""
8+
"""Inspect metadata for the current running event loop."""
89
loop = asyncio.get_event_loop()
910
thread_id = loop.__dict__.get("_thread_id")
1011
if loop.is_running():

asyncio_tutorial/part_I_asyncio_intro/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Create task from provided coroutine."""
1+
"""Create task from coroutine which displays a value after a delay."""
22
import asyncio
33
from asyncio import Task
44

0 commit comments

Comments
 (0)