]> granicus.if.org Git - python/commitdiff
bpo-34335: Use async/await syntax in documentation examples (GH-8674)
authorMikhail Terekhov <termim@gmail.com>
Tue, 7 Aug 2018 20:29:06 +0000 (16:29 -0400)
committerMariatta <Mariatta@users.noreply.github.com>
Tue, 7 Aug 2018 20:29:06 +0000 (13:29 -0700)
Doc/library/asyncio-stream.rst
Doc/library/asyncio-subprocess.rst

index 8f94ba76aef2e23becaddb2588b992e1e0589518..f662e72233372550d0da39849e62bc392654d87c 100644 (file)
@@ -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)
index 280b76400374cbd5c13b6aea677ef06a84f2b339..60e174574b04e9032fbe05e66ade62fde5420854 100644 (file)
@@ -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