aboutsummaryrefslogtreecommitdiff
path: root/paramiko/sftp_file.py
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2016-02-07 21:19:28 +0000
committerChristopher Baines <mail@cbaines.net>2016-02-07 21:19:28 +0000
commit8a563e44d42731143f4356edcad0d7469a56ea24 (patch)
tree4641e9608e76b130ea6afe467a30202494ef0eeb /paramiko/sftp_file.py
parentbbf74c0dbf66c463bd68bd30abcd338796152354 (diff)
parent31b2fd0709f259961253b9cdc875ce7827abaa68 (diff)
downloadpython-paramiko-8a563e44d42731143f4356edcad0d7469a56ea24.tar
python-paramiko-8a563e44d42731143f4356edcad0d7469a56ea24.tar.gz
Merge tag 'upstream/1.16.0'
Upstream version 1.16.0
Diffstat (limited to 'paramiko/sftp_file.py')
-rw-r--r--paramiko/sftp_file.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py
index d0a37da..c5b6548 100644
--- a/paramiko/sftp_file.py
+++ b/paramiko/sftp_file.py
@@ -379,7 +379,7 @@ class SFTPFile (BufferedFile):
"""
self.pipelined = pipelined
- def prefetch(self):
+ def prefetch(self, file_size):
"""
Pre-fetch the remaining contents of this file in anticipation of future
`.read` calls. If reading the entire file, pre-fetching can
@@ -393,12 +393,11 @@ class SFTPFile (BufferedFile):
.. versionadded:: 1.5.1
"""
- size = self.stat().st_size
# queue up async reads for the rest of the file
chunks = []
n = self._realpos
- while n < size:
- chunk = min(self.MAX_REQUEST_SIZE, size - n)
+ while n < file_size:
+ chunk = min(self.MAX_REQUEST_SIZE, file_size - n)
chunks.append((n, chunk))
n += chunk
if len(chunks) > 0: