Skip to content

Commit 1c211e7

Browse files
authored
Add buffer_size transport param to ssh.py
1 parent 749aa72 commit 1c211e7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

smart_open/ssh.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def open(
226226
port=None,
227227
connect_kwargs=None,
228228
prefetch_kwargs=None,
229+
buffer_size=-1,
229230
):
230231
"""Open a file on a remote machine over SSH.
231232
@@ -238,7 +239,7 @@ def open(
238239
mode: str, optional
239240
The mode to use for opening the file.
240241
host: str, optional
241-
The hostname of the remote machine. May not be None.
242+
The hostname of the remote machine. May not be None.
242243
user: str, optional
243244
The username to use to login to the remote machine.
244245
If None, defaults to the name of the current user.
@@ -251,6 +252,8 @@ def open(
251252
prefetch_kwargs: dict, optional
252253
Any additional settings to be passed to paramiko.SFTPFile.prefetch.
253254
The presence of this dict (even if empty) triggers prefetching.
255+
buffer_size: int, optional
256+
Passed as bufsize argument to paramiko.SFTPClient.open.
254257
255258
Returns
256259
-------
@@ -297,7 +300,7 @@ def open(
297300
#
298301
del _SSH[key]
299302

300-
fobj = sftp_client.open(path, mode)
303+
fobj = sftp_client.open(path, mode=mode, bufsize=buffer_size)
301304
fobj.name = path
302305
if prefetch_kwargs is not None:
303306
fobj.prefetch(**prefetch_kwargs)

0 commit comments

Comments
 (0)