Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changed how we are importing the test_utils submodule as suggested
  • Loading branch information
denisra committed Nov 17, 2016
commit a40fe768eaa8fddebe85e01a387c3e3e90894cb5
3 changes: 2 additions & 1 deletion examples/cacheclt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging

import asyncio
import asyncio.test_utils

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imports should be sorted alphabetically (that's what we try to do in asyncio and CPython code bases).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1st1 I wasn't aware of that, sorry. I was going by the PEP8 guidelines, where it tells us to import the standard library modules first. But I'll have that fix following your recommendations.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denisra Asyncio is technically a stdlib module. ;)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SethMichaelLarson I can't say that it isn't :) will send send in another commit in just a few min with that fixed


ARGS = argparse.ArgumentParser(description='Cache client example.')
Expand Down Expand Up @@ -173,7 +174,7 @@ def main():
loop = asyncio.new_event_loop()
sslctx = None
if args.tls:
sslctx = asyncio.test_utils.dummy_ssl_context()
sslctx = test_utils.dummy_ssl_context()
cache = CacheClient(args.host, args.port, sslctx=sslctx, loop=loop)
try:
loop.run_until_complete(
Expand Down
3 changes: 2 additions & 1 deletion examples/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys

import asyncio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also import asyncio.test_utils.

import asyncio.test_utils


ARGS = argparse.ArgumentParser(description="TCP data sink example.")
Expand Down Expand Up @@ -72,7 +73,7 @@ def connection_lost(self, exc):
def start(loop, host, port):
sslctx = None
if args.tls:
sslctx = asyncio.test_utils.dummy_ssl_context()
sslctx = test_utils.dummy_ssl_context()
tr, pr = yield from loop.create_connection(Client, host, port,
ssl=sslctx)
dprint('tr =', tr)
Expand Down
3 changes: 2 additions & 1 deletion examples/source1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys

import asyncio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asyncio.test_utils

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we use test_utils anyways. It should be removed from examples.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brettcannon Thanks for pointing that out. I made the changes as suggested. Please let me know if I need to change anything else.

import asyncio.test_utils


ARGS = argparse.ArgumentParser(description="TCP data sink example.")
Expand Down Expand Up @@ -56,7 +57,7 @@ def start(loop, args):
sslctx = None
if args.tls:
d.print('using dummy SSLContext')
sslctx = asyncio.test_utils.dummy_ssl_context()
sslctx = test_utils.dummy_ssl_context()
r, w = yield from asyncio.open_connection(args.host, args.port, ssl=sslctx)
d.print('r =', r)
d.print('w =', w)
Expand Down
3 changes: 2 additions & 1 deletion examples/subprocess_attach_write_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys

import asyncio
from asyncio.subprocess import PIPE

code = """
import os, sys
Expand All @@ -23,7 +24,7 @@ def task():
proc = yield from asyncio.create_subprocess_exec(
*args,
pass_fds={rfd},
stdout=asyncio.subprocess.PIPE)
stdout=PIPE)

pipe = open(wfd, 'wb', 0)
transport, _ = yield from loop.connect_write_pipe(asyncio.Protocol,
Expand Down