bpo-33649: Clarify protocol_factory as a method parameter (GH-9330) · python/cpython@5cc583d

@@ -535,6 +535,9 @@ Creating network servers

535535536536

Arguments:

537537538+

* *protocol_factory* must be a callable returning a

539+

:ref:`protocol <asyncio-protocol>` implementation.

540+538541

* The *host* parameter can be set to several types which determine behavior:

539542

- If *host* is a string, the TCP server is bound to *host* and *port*.

540543

- if *host* is a sequence of strings, the TCP server is bound to all

@@ -617,6 +620,9 @@ Creating network servers

617620

:class:`str`, :class:`bytes`, and :class:`~pathlib.Path` paths

618621

are supported.

619622623+

See the documentation of the :meth:`loop.create_server` method

624+

for information about arguments to this method.

625+620626

Availability: UNIX.

621627622628

.. versionadded:: 3.7

@@ -637,6 +643,9 @@ Creating network servers

637643638644

Parameters:

639645646+

* *protocol_factory* must be a callable returning a

647+

:ref:`protocol <asyncio-protocol>` implementation.

648+640649

* *sock* is a preexisting socket object returned from

641650

:meth:`socket.accept <socket.socket.accept>`.

642651

@@ -909,7 +918,8 @@ Working with pipes

909918

*pipe* is a :term:`file-like object <file object>`.

910919911920

Return pair ``(transport, protocol)``, where *transport* supports

912-

the :class:`ReadTransport` interface.

921+

the :class:`ReadTransport` interface and *protocol* is an object

922+

instantiated by the *protocol_factory*.

913923914924

With :class:`SelectorEventLoop` event loop, the *pipe* is set to

915925

non-blocking mode.

@@ -924,7 +934,8 @@ Working with pipes

924934

*pipe* is :term:`file-like object <file object>`.

925935926936

Return pair ``(transport, protocol)``, where *transport* supports

927-

:class:`WriteTransport` interface.

937+

:class:`WriteTransport` interface and *protocol* is an object

938+

instantiated by the *protocol_factory*.

928939929940

With :class:`SelectorEventLoop` event loop, the *pipe* is set to

930941

non-blocking mode.

@@ -1159,7 +1170,8 @@ async/await code consider using high-level convenient

11591170

for documentation on other arguments.

1160117111611172

Returns a pair of ``(transport, protocol)``, where *transport*

1162-

conforms to the :class:`asyncio.SubprocessTransport` base class.

1173+

conforms to the :class:`asyncio.SubprocessTransport` base class and

1174+

*protocol* is an object instantiated by the *protocol_factory*.

1163117511641176

.. coroutinemethod:: loop.subprocess_shell(protocol_factory, cmd, \*, \

11651177

stdin=subprocess.PIPE, stdout=subprocess.PIPE, \

@@ -1180,7 +1192,8 @@ async/await code consider using high-level convenient

11801192

the remaining arguments.

1181119311821194

Returns a pair of ``(transport, protocol)``, where *transport*

1183-

conforms to the :class:`SubprocessTransport` base class.

1195+

conforms to the :class:`SubprocessTransport` base class and

1196+

*protocol* is an object instantiated by the *protocol_factory*.

1184119711851198

.. note::

11861199

It is the application's responsibility to ensure that all whitespace