Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.

Commit 3be7659

Browse files
author
Vincent Michel
committed
Remove all occurrences of "loop=loop"
1 parent db0a20f commit 3be7659

6 files changed

+6
-8
lines changed

examples/aiohttp_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_multiple_pages(host, waits, port=8000, show_time=True):
2525
pages = []
2626
start = time.perf_counter()
2727
with closing(asyncio.get_event_loop()) as loop:
28-
with aiohttp.ClientSession(loop=loop) as session:
28+
with aiohttp.ClientSession() as session:
2929
for wait in waits:
3030
tasks.append(fetch_page(session, host, port, wait))
3131
pages = loop.run_until_complete(asyncio.gather(*tasks))

examples/http_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ async def fetch_page(session, url):
88
return await response.read()
99

1010
loop = asyncio.get_event_loop()
11-
with aiohttp.ClientSession(loop=loop) as session:
11+
with aiohttp.ClientSession() as session:
1212
content = loop.run_until_complete(
1313
fetch_page(session, 'http://python.org'))
1414
print(content)

examples/producer_consumer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def consume(queue):
3131

3232

3333
loop = asyncio.get_event_loop()
34-
queue = asyncio.Queue(loop=loop)
34+
queue = asyncio.Queue()
3535
producer_coro = produce(queue, 10)
3636
consumer_coro = consume(queue)
3737
loop.run_until_complete(asyncio.gather(producer_coro, consumer_coro))

examples/tcp_echo_client.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

44
async def tcp_echo_client(message, loop):
5-
reader, writer = await asyncio.open_connection('127.0.0.1', 8888,
6-
loop=loop)
5+
reader, writer = await asyncio.open_connection('127.0.0.1', 8888)
76

87
print('Send: %r' % message)
98
writer.write(message.encode())

examples/tcp_echo_server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async def handle_echo(reader, writer):
1414
writer.close()
1515

1616
loop = asyncio.get_event_loop()
17-
coro = asyncio.start_server(handle_echo, '127.0.0.1', 8888, loop=loop)
17+
coro = asyncio.start_server(handle_echo, '127.0.0.1', 8888)
1818
server = loop.run_until_complete(coro)
1919

2020
# Serve requests until Ctrl+C is pressed

webscraper.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ This is the interesting part of ``get_multiple_pages()``:
397397
.. code-block:: python
398398
399399
with closing(asyncio.get_event_loop()) as loop:
400-
with aiohttp.ClientSession(loop=loop) as session:
400+
with aiohttp.ClientSession() as session:
401401
for wait in waits:
402402
tasks.append(fetch_page(session, host, port, wait))
403403
pages = loop.run_until_complete(asyncio.gather(*tasks))
@@ -427,4 +427,3 @@ It also takes about five seconds and gives the same output as our version
427427
before.
428428
But the implementation for getting a single page is much simpler and takes
429429
care of the encoding and other aspects not mentioned here.
430-

0 commit comments

Comments
 (0)