Skip to content

Commit e18ceb7

Browse files
miss-islingtonerlend-aaslandezio-melotti
authored
[3.12] Docs: mark up FTP.retrbinary and FTP.storbinary with param lists (GH-114399) (#114483)
(cherry picked from commit 5277d4c) Co-authored-by: Erlend E. Aasland <[email protected]> Co-authored-by: Ezio Melotti <[email protected]>
1 parent 1b9abe4 commit e18ceb7

File tree

2 files changed

+46
-17
lines changed

2 files changed

+46
-17
lines changed

Doc/library/ftplib.rst

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,27 @@ FTP objects
201201

202202
.. method:: FTP.retrbinary(cmd, callback, blocksize=8192, rest=None)
203203

204-
Retrieve a file in binary transfer mode. *cmd* should be an appropriate
205-
``RETR`` command: ``'RETR filename'``. The *callback* function is called for
206-
each block of data received, with a single bytes argument giving the data
207-
block. The optional *blocksize* argument specifies the maximum chunk size to
208-
read on the low-level socket object created to do the actual transfer (which
209-
will also be the largest size of the data blocks passed to *callback*). A
210-
reasonable default is chosen. *rest* means the same thing as in the
211-
:meth:`transfercmd` method.
204+
Retrieve a file in binary transfer mode.
205+
206+
:param str cmd:
207+
An appropriate ``STOR`` command: :samp:`"STOR {filename}"`.
208+
209+
:param callback:
210+
A single parameter callable that is called
211+
for each block of data received,
212+
with its single argument being the data as :class:`bytes`.
213+
:type callback: :term:`callable`
214+
215+
:param int blocksize:
216+
The maximum chunk size to read on the low-level
217+
:class:`~socket.socket` object created to do the actual transfer.
218+
This also corresponds to the largest size of data
219+
that will be passed to *callback*.
220+
Defaults to ``8192``.
221+
222+
:param int rest:
223+
A ``REST`` command to be sent to the server.
224+
See the documentation for the *rest* parameter of the :meth:`transfercmd` method.
212225

213226

214227
.. method:: FTP.retrlines(cmd, callback=None)
@@ -232,16 +245,33 @@ FTP objects
232245

233246
.. method:: FTP.storbinary(cmd, fp, blocksize=8192, callback=None, rest=None)
234247

235-
Store a file in binary transfer mode. *cmd* should be an appropriate
236-
``STOR`` command: ``"STOR filename"``. *fp* is a :term:`file object`
237-
(opened in binary mode) which is read until EOF using its :meth:`~io.IOBase.read`
238-
method in blocks of size *blocksize* to provide the data to be stored.
239-
The *blocksize* argument defaults to 8192. *callback* is an optional single
240-
parameter callable that is called on each block of data after it is sent.
241-
*rest* means the same thing as in the :meth:`transfercmd` method.
248+
Store a file in binary transfer mode.
249+
250+
:param str cmd:
251+
An appropriate ``STOR`` command: :samp:`"STOR {filename}"`.
252+
253+
:param fp:
254+
A file object (opened in binary mode) which is read until EOF,
255+
using its :meth:`~io.RawIOBase.read` method in blocks of size *blocksize*
256+
to provide the data to be stored.
257+
:type fp: :term:`file object`
258+
259+
:param int blocksize:
260+
The read block size.
261+
Defaults to ``8192``.
262+
263+
:param callback:
264+
A single parameter callable that is called
265+
for each block of data sent,
266+
with its single argument being the data as :class:`bytes`.
267+
:type callback: :term:`callable`
268+
269+
:param int rest:
270+
A ``REST`` command to be sent to the server.
271+
See the documentation for the *rest* parameter of the :meth:`transfercmd` method.
242272

243273
.. versionchanged:: 3.2
244-
*rest* parameter added.
274+
The *rest* parameter was added.
245275

246276

247277
.. method:: FTP.storlines(cmd, fp, callback=None)

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Doc/library/enum.rst
5252
Doc/library/exceptions.rst
5353
Doc/library/faulthandler.rst
5454
Doc/library/fcntl.rst
55-
Doc/library/ftplib.rst
5655
Doc/library/functools.rst
5756
Doc/library/getopt.rst
5857
Doc/library/http.cookiejar.rst

0 commit comments

Comments
 (0)