[Python-checkins] bpo-34335: Use async/await syntax in documentation examples (GH-8674)
Miss Islington (bot)
webhook-mailer at python.org
Tue Aug 7 16:33:35 EDT 2018
https://github.com/python/cpython/commit/fac49762c53822c40f24dcb5ca4945cffdf40cd9
commit: fac49762c53822c40f24dcb5ca4945cffdf40cd9
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-08-07T13:33:31-07:00
summary:
bpo-34335: Use async/await syntax in documentation examples (GH-8674)
(cherry picked from commit d2ac400267940f35d731d66c2dafafe099d770d9)
Co-authored-by: Mikhail Terekhov <termim at gmail.com>
files:
M Doc/library/asyncio-stream.rst
M Doc/library/asyncio-subprocess.rst
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst
index 8f94ba76aef2..f662e7223337 100644
--- a/Doc/library/asyncio-stream.rst
+++ b/Doc/library/asyncio-stream.rst
@@ -431,8 +431,7 @@ Simple example querying HTTP headers of the URL passed on the command line::
import urllib.parse
import sys
- @asyncio.coroutine
- def print_http_headers(url):
+ async def print_http_headers(url):
url = urllib.parse.urlsplit(url)
if url.scheme == 'https':
connect = asyncio.open_connection(url.hostname, 443, ssl=True)
diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst
index 280b76400374..60e174574b04 100644
--- a/Doc/library/asyncio-subprocess.rst
+++ b/Doc/library/asyncio-subprocess.rst
@@ -392,8 +392,7 @@ function::
import asyncio.subprocess
import sys
- @asyncio.coroutine
- def get_date():
+ async def get_date():
code = 'import datetime; print(datetime.datetime.now())'
# Create the subprocess, redirect the standard output into a pipe
More information about the Python-checkins
mailing list