8000 gh-121970: Replace `.. coroutine{method,function}` with `:async:` · python/cpython@081cc42 · GitHub
[go: up one dir, main page]

Skip to content

Commit 081cc42

Browse files
committed
gh-121970: Replace .. coroutine{method,function} with :async:
1 parent 30e8924 commit 081cc42

File tree

10 files changed

+135
-89
lines changed

10 files changed

+135
-89
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ Running and stopping the loop
172172
This method is idempotent and irreversible. No other methods
173173
should be called after the event loop is closed.
174174

175-
.. coroutinemethod:: loop.shutdown_asyncgens()
175+
.. method:: loop.shutdown_asyncgens()
176+
:async:
176177

177178
Schedule all currently open :term:`asynchronous generator` objects to
178179
close with an :meth:`~agen.aclose` call. After calling this method,
@@ -193,7 +194,8 @@ Running and stopping the loop
193194

194195
.. versionadded:: 3.6
195196

196-
.. coroutinemethod:: loop.shutdown_default_executor(timeout=None)
197+
.. method:: loop.shutdown_default_executor(timeout=None)
198+
:async:
197199

198200
Schedule the closure of the default executor and wait for it to join all of
199201
the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`.
@@ -404,14 +406,15 @@ Creating Futures and Tasks
404406
Opening network connections
405407
^^^^^^^^^^^^^^^^^^^^^^^^^^^
406408

407-
.. coroutinemethod:: loop.create_connection(protocol_factory, \
409+
.. method:: loop.create_connection(protocol_factory, \
408410
host=None, port=None, *, ssl=None, \
409411
family=0, proto=0, flags=0, sock=None, \
410412
local_addr=None, server_hostname=None, \
411413
ssl_handshake_timeout=None, \
412414
ssl_shutdown_timeout=None, \
413415
happy_eyeballs_delay=None, interleave=None, \
414416
all_errors=False)
417+
:async:
415418
416419
Open a streaming transport connection to a given
417420
address specified by *host* and *port*.
@@ -557,7 +560,7 @@ Opening network connections
557560
API. It returns a pair of (:class:`StreamReader`, :class:`StreamWriter`)
558561
that can be used directly in async/await code.
559562

560-
.. coroutinemethod:: loop.create_datagram_endpoint(protocol_factory, \
563+
.. method:: loop.create_datagram_endpoint(protocol_factory, \
561564
local_addr=None, remote_addr=None, *, \
562565
family=0, proto=0, flags=0, \
563566
reuse_port=None, \
@@ -642,10 +645,11 @@ Opening network connections
642645
The *reuse_address* parameter, disabled since Python 3.8.1,
643646
3.7.6 and 3.6.10, has been entirely removed.
644647

645-
.. coroutinemethod:: loop.create_unix_connection(protocol_factory, \
648+
.. method:: loop.create_unix_connection(protocol_factory, \
646649
path=None, *, ssl=None, sock=None, \
647650
server_hostname=None, ssl_handshake_timeout=None, \
648651
ssl_shutdown_timeout=None)
652+
:async:
649653
650654
Create a Unix connection.
651655

@@ -678,7 +682,7 @@ Creating network servers
678682

679683
.. _loop_create_server:
680684

681-
.. coroutinemethod:: loop.create_server(protocol_factory, \
685+
.. method:: loop.create_server(protocol_factory, \
682686
host=None, port=None, *, \
683687
family=socket.AF_UNSPEC, \
684688
flags=socket.AI_PASSIVE, \
@@ -688,6 +692,7 @@ Creating network servers
688692
ssl_handshake_timeout=None, \
689693
ssl_shutdown_timeout=None, \
690694
start_serving=True)
695+
:async:
691696
692697
Create a TCP server (socket type :const:`~socket.SOCK_STREAM`) listening
693698
on *port* of the *host* address.
@@ -795,11 +800,12 @@ Creating network servers
795800
that can be used in an async/await code.
796801

797802

798-
.. coroutinemethod:: loop.create_unix_server(protocol_factory, path=None, \
803+
.. method:: loop.create_unix_server(protocol_factory, path=None, \
799804
*, sock=None, backlog=100, ssl=None, \
800805
ssl_handshake_timeout=None, \
801806
ssl_shutdown_timeout=None, \
802807
start_serving=True, cleanup_socket=True)
808+
:async:
803809
804810
Similar to :meth:`loop.create_server` but works with the
805811
:py:const:`~socket.AF_UNIX` socket family.
@@ -832,9 +838,10 @@ Creating network servers
832838
Added the *cleanup_socket* parameter.
833839

834840

835-
.. coroutinemethod:: loop.connect_accepted_socket(protocol_factory, \
841+
.. method:: loop.connect_accepted_socket(protocol_factory, \
836842
sock, *, ssl=None, ssl_handshake_timeout=None, \
837843
ssl_shutdown_timeout=None)
844+
:async:
838845
839846
Wrap an already accepted connection into a transport/protocol pair.
840847

@@ -882,8 +889,9 @@ Creating network servers
882889
Transferring files
883890
^^^^^^^^^^^^^^^^^^
884891

885-
.. coroutinemethod:: loop.sendfile(transport, file, \
892+
.. method:: loop.sendfile(transport, file, \
886893
offset=0, count=None, *, fallback=True)
894+
:async:
887895
888896
Send a *file* over a *transport*. Return the total number of bytes
889897
sent.
@@ -912,10 +920,11 @@ Transferring files
912920
TLS Upgrade
913921
^^^^^^^^^^^
914922

915-
.. coroutinemethod:: loop.start_tls(transport, protocol, \
923+
.. method:: loop.start_tls(transport, protocol, \
916924
sslcontext, *, server_side=False, \
917925
server_hostname=None, ssl_handshake_timeout=None, \
918926
ssl_shutdown_timeout=None)
927+
:async:
919928
920929
Upgrade an existing transport-based connection to TLS.
921930

@@ -1009,7 +1018,8 @@ However, there are some use cases when performance is not critical, and
10091018
working with :class:`~socket.socket` objects directly is more
10101019
convenient.
10111020

1012-
.. coroutinemethod:: loop.sock_recv(sock, nbytes)
1021+
.. method:: loop.sock_recv(sock, nbytes)
1022+
:async:
10131023

10141024
Receive up to *nbytes* from *sock*. Asynchronous version of
10151025
:meth:`socket.recv() <socket.socket.recv>`.
@@ -1023,7 +1033,8 @@ convenient.
10231033
method, releases before Python 3.7 returned a :class:`Future`.
10241034
Since Python 3.7 this is an ``async def`` method.
10251035

1026-
.. coroutinemethod:: loop.sock_recv_into(sock, buf)
1036+
.. method:: loop.sock_recv_into(sock, buf)
1037+
:async:
10271038

10281039
Receive data from *sock* into the *buf* buffer. Modeled after the blocking
10291040
:meth:`socket.recv_into() <socket.socket.recv_into>` method.
@@ -1034,7 +1045,8 @@ convenient.
10341045

10351046
.. versionadded:: 3.7
10361047

1037-
.. coroutinemethod:: loop.sock_recvfrom(sock, bufsize)
1048+
.. method:: loop.sock_recvfrom(sock, bufsize)
1049+
:async:
10381050

10391051
Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of
10401052
:meth:`socket.recvfrom() <socket.socket.recvfrom>`.
@@ -1045,7 +1057,8 @@ convenient.
10451057

10461058
.. versionadded:: 3.11
10471059

1048-
.. coroutinemethod:: loop.sock_recvfrom_into(sock, buf, nbytes=0)
1060+
.. method:: loop.sock_recvfrom_into(sock, buf, nbytes=0)
1061+
:async:
10491062

10501063
Receive a datagram of up to *nbytes* from *sock* into *buf*.
10511064
Asynchronous version of
@@ -1057,7 +1070,8 @@ convenient.
10571070

10581071
.. versionadded:: 3.11
10591072

1060-
.. coroutinemethod:: loop.sock_sendall(sock, data)
1073+
.. method:: loop.sock_sendall(sock, data)
1074+
:async:
10611075

10621076
Send *data* to the *sock* socket. Asynchronous version of
10631077
:meth:`socket.sendall() <socket.socket.sendall>`.
@@ -1075,7 +1089,8 @@ convenient.
10751089
method, before Python 3.7 it returned a :class:`Future`.
10761090
Since Python 3.7, this is an ``async def`` method.
10771091

1078-
.. coroutinemethod:: loop.sock_sendto(sock, data, address)
1092+
.. method:: loop.sock_sendto(sock, data, address)
1093+
:async:
10791094

10801095
Send a datagram from *sock* to *address*.
10811096
Asynchronous version of
@@ -1087,7 +1102,8 @@ convenient.
10871102

10881103
.. versionadded:: 3.11
10891104

1090-
.. coroutinemethod:: loop.sock_connect(sock, address)
1105+
.. method:: loop.sock_connect(sock, address)
1106+
:async:
10911107

10921108
Connect *sock* to a remote socket at *address*.
10931109

@@ -1108,7 +1124,8 @@ convenient.
11081124
and :func:`asyncio.open_connection() <open_connection>`.
11091125

11101126

1111-
.. coroutinemethod:: loop.sock_accept(sock)
1127+
.. method:: loop.sock_accept(sock)
1128+
:async:
11121129

11131130
Accept a connection. Modeled after the blocking
11141131
:meth:`socket.accept() <socket.socket.accept>` method.
@@ -1130,8 +1147,9 @@ convenient.
11301147

11311148
:meth:`loop.create_server` and :func:`start_server`.
11321149

1133-
.. coroutinemethod:: loop.sock_sendfile(sock, file, offset=0, count=None, \
1150+
.. method:: loop.sock_sendfile(sock, file, offset=0, count=None, \
11341151
*, fallback=True)
1152+
:async:
11351153
11361154
Send a file using high-performance :mod:`os.sendfile` if possible.
11371155
Return the total number of bytes sent.
@@ -1165,12 +1183,14 @@ convenient.
11651183
DNS
11661184
^^^
11671185

1168-
.. coroutinemethod:: loop.getaddrinfo(host, port, *, family=0, \
1186+
.. method:: loop.getaddrinfo(host, port, *, family=0, \
11691187
type=0, proto=0, flags=0)
1188+
:async:
11701189

11711190
Asynchronous version of :meth:`socket.getaddrinfo`.
11721191

1173-
.. coroutinemethod:: loop.getnameinfo(sockaddr, flags=0)
1192+
.. method:: loop.getnameinfo(sockaddr, flags=0)
1193+
:async:
11741194

11751195
Asynchronous version of :meth:`socket.getnameinfo`.
11761196

@@ -1192,7 +1212,8 @@ DNS
11921212
Working with pipes
11931213
^^^^^^^^^^^^^^^^^^
11941214

1195-
.. coroutinemethod:: loop.connect_read_pipe(protocol_factory, pipe)
1215+
.. method:: loop.connect_read_pipe(protocol_factory, pipe)
1216+
:async:
11961217

11971218
Register the read end of *pipe* in the event loop.
11981219

@@ -1208,7 +1229,8 @@ Working with pipes
12081229
With :class:`SelectorEventLoop` event loop, the *pipe* is set to
12091230
non-blocking mode.
12101231

1211-
.. coroutinemethod:: loop.connect_write_pipe(protocol_factory, pipe)
1232+
.. method:: loop.connect_write_pipe(protocol_factory, pipe)
1233+
:async:
12121234

12131235
Register the write end of *pipe* in the event loop.
12141236

@@ -1480,9 +1502,10 @@ async/await code consider using the high-level
14801502

14811503
.. _loop_subprocess_exec:
14821504

1483-
.. coroutinemethod:: loop.subprocess_exec(protocol_factory, *args, \
1505+
.. method:: loop.subprocess_exec(protocol_factory, *args, \
14841506
stdin=subprocess.PIPE, stdout=subprocess.PIPE, \
14851507
stderr=subprocess.PIPE, **kwargs)
1508+
:async:
14861509
14871510
Create a subprocess from one or more string arguments specified by
14881511
*args*.
@@ -1562,9 +1585,10 @@ async/await code consider using the high-level
15621585
conforms to the :class:`asyncio.SubprocessTransport` base class and
15631586
*protocol* is an object instantiated by the *protocol_factory*.
15641587

1565-
.. coroutinemethod:: loop.subprocess_shell(protocol_factory, cmd, *, \
1588+
.. method:: loop.subprocess_shell(protocol_factory, cmd, *, \
15661589
stdin=subprocess.PIPE, stdout=subprocess.PIPE, \
15671590
stderr=subprocess.PIPE, **kwargs)
1591+
:async:
15681592
15691593
Create a subprocess from *cmd*, which can be a :class:`str` or a
15701594
:class:`bytes` string encoded to the
@@ -1709,7 +1733,8 @@ Do not instantiate the :class:`Server` class directly.
17091733

17101734
.. versionadded:: 3.7
17111735

1712-
.. coroutinemethod:: start_serving()
1736+
.. method:: start_serving()
1737+
:async:
17131738

17141739
Start accepting connections.
17151740

@@ -1725,7 +1750,8 @@ Do not instantiate the :class:`Server` class directly.
17251750

17261751
.. versionadded:: 3.7
17271752

1728-
.. coroutinemethod:: serve_forever()
1753+
.. method:: serve_forever()
1754+
:async:
17291755

17301756
Start accepting connections until the coroutine is cancelled.
17311757
Cancellation of ``serve_forever`` task causes the server
@@ -1757,7 +1783,8 @@ Do not instantiate the :class:`Server` class directly.
17571783

17581784
.. versionadded:: 3.7
17591785

1760-
.. coroutinemethod:: wait_closed()
1786+
.. method:: wait_closed()
1787+
:async:
17611788

17621789
Wait until the :meth:`close` method completes and all active
17631790
connections have finished.

Doc/library/asyncio-queue.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ Queue
5757
If the queue was initialized with ``maxsize=0`` (the default),
5858
then :meth:`full` never returns ``True``.
5959

60-
.. coroutinemethod:: get()
60+
.. method:: get()
61+
:async:
6162

6263
Remove and return an item from the queue. If queue is empty,
6364
wait until an item is available.
@@ -70,7 +71,8 @@ Queue
7071
Return an item if one is immediately available, else raise
7172
:exc:`QueueEmpty`.
7273

73-
.. coroutinemethod:: join()
74+
.. method:: join()
75+
:async:
7476

7577
Block until all items in the queue have been received and processed.
7678

@@ -80,7 +82,8 @@ Queue
8082
work on it is complete. When the count of unfinished tasks drops
8183
to zero, :meth:`join` unblocks.
8284

83-
.. coroutinemethod:: put(item)
85+
.. method:: put(item)
86+
:async:
8487

8588
Put an item into the queue. If the queue is full, wait until a
8689
free slot is available before adding the item.

0 commit comments

Comments
 (0)
0