diff options
Diffstat (limited to 'docs/paramiko.sftp_file-pysrc.html')
-rw-r--r-- | docs/paramiko.sftp_file-pysrc.html | 874 |
1 files changed, 874 insertions, 0 deletions
diff --git a/docs/paramiko.sftp_file-pysrc.html b/docs/paramiko.sftp_file-pysrc.html new file mode 100644 index 0000000..5e9b4c7 --- /dev/null +++ b/docs/paramiko.sftp_file-pysrc.html @@ -0,0 +1,874 @@ +<?xml version="1.0" encoding="ascii"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>paramiko.sftp_file</title> + <link rel="stylesheet" href="epydoc.css" type="text/css" /> + <script type="text/javascript" src="epydoc.js"></script> +</head> + +<body bgcolor="white" text="black" link="blue" vlink="#204080" + alink="#204080"> +<!-- ==================== NAVIGATION BAR ==================== --> +<table class="navbar" border="0" width="100%" cellpadding="0" + bgcolor="#a0c0ff" cellspacing="0"> + <tr valign="middle"> + <!-- Home link --> + <th> <a + href="paramiko-module.html">Home</a> </th> + + <!-- Tree link --> + <th> <a + href="module-tree.html">Trees</a> </th> + + <!-- Index link --> + <th> <a + href="identifier-index.html">Indices</a> </th> + + <!-- Help link --> + <th> <a + href="help.html">Help</a> </th> + + <th class="navbar" width="100%"></th> + </tr> +</table> +<table width="100%" cellpadding="0" cellspacing="0"> + <tr valign="top"> + <td width="100%"> + <span class="breadcrumbs"> + <a href="paramiko-module.html">Package paramiko</a> :: + Module sftp_file + </span> + </td> + <td> + <table cellpadding="0" cellspacing="0"> + <!-- hide/show private --> + <tr><td align="right"><span class="options" + >[<a href="frames.html" target="_top">frames</a + >] | <a href="paramiko.sftp_file-pysrc.html" + target="_top">no frames</a>]</span></td></tr> + </table> + </td> + </tr> +</table> +<h1 class="epydoc">Source Code for <a href="paramiko.sftp_file-module.html" onclick="show_private();">Module paramiko.sftp_file</a></h1> +<pre class="py-src"> +<a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-comment"># Copyright (C) 2003-2007 Robey Pointer <robey@lag.net></tt> </tt> +<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt> +<a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># This file is part of paramiko.</tt> </tt> +<a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt> +<a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Paramiko is free software; you can redistribute it and/or modify it under the</tt> </tt> +<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># terms of the GNU Lesser General Public License as published by the Free</tt> </tt> +<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Software Foundation; either version 2.1 of the License, or (at your option)</tt> </tt> +<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># any later version.</tt> </tt> +<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt> +<a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY</tt> </tt> +<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR</tt> </tt> +<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more</tt> </tt> +<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># details.</tt> </tt> +<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt> +<a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># You should have received a copy of the GNU Lesser General Public License</tt> </tt> +<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># along with Paramiko; if not, write to the Free Software Foundation, Inc.,</tt> </tt> +<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.</tt> </tt> +<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-comment"></tt> </tt> +<a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt> +<a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"><tt class="py-docstring">L{SFTPFile}</tt> </tt> +<a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt> +<a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"> </tt> +<a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">binascii</tt> <tt class="py-keyword">import</tt> <tt class="py-name">hexlify</tt> </tt> +<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">socket</tt> </tt> +<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">threading</tt> </tt> +<a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">time</tt> </tt> +<a name="L27"></a><tt class="py-lineno"> 27</tt> <tt class="py-line"> </tt> +<a name="L28"></a><tt class="py-lineno"> 28</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package paramiko=paramiko-module.html"><a title="paramiko" class="py-name" href="#" onclick="return doclink('link-0', 'paramiko', 'link-0');">paramiko</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module paramiko.common=paramiko.common-module.html"><a title="paramiko.common" class="py-name" href="#" onclick="return doclink('link-1', 'common', 'link-1');">common</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt> +<a name="L29"></a><tt class="py-lineno"> 29</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-2" class="py-name"><a title="paramiko" class="py-name" href="#" onclick="return doclink('link-2', 'paramiko', 'link-0');">paramiko</a></tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Module paramiko.sftp=paramiko.sftp-module.html"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-3', 'sftp', 'link-3');">sftp</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt> +<a name="L30"></a><tt class="py-lineno"> 30</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-4" class="py-name"><a title="paramiko" class="py-name" href="#" onclick="return doclink('link-4', 'paramiko', 'link-0');">paramiko</a></tt><tt class="py-op">.</tt><tt id="link-5" class="py-name" targets="Method paramiko.SFTPClient.file()=paramiko.SFTPClient-class.html#file,Module paramiko.file=paramiko.file-module.html"><a title="paramiko.SFTPClient.file +paramiko.file" class="py-name" href="#" onclick="return doclink('link-5', 'file', 'link-5');">file</a></tt> <tt class="py-keyword">import</tt> <tt id="link-6" class="py-name" targets="Class paramiko.BufferedFile=paramiko.BufferedFile-class.html"><a title="paramiko.BufferedFile" class="py-name" href="#" onclick="return doclink('link-6', 'BufferedFile', 'link-6');">BufferedFile</a></tt> </tt> +<a name="L31"></a><tt class="py-lineno"> 31</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-7" class="py-name"><a title="paramiko" class="py-name" href="#" onclick="return doclink('link-7', 'paramiko', 'link-0');">paramiko</a></tt><tt class="py-op">.</tt><tt id="link-8" class="py-name" targets="Module paramiko.sftp_attr=paramiko.sftp_attr-module.html"><a title="paramiko.sftp_attr" class="py-name" href="#" onclick="return doclink('link-8', 'sftp_attr', 'link-8');">sftp_attr</a></tt> <tt class="py-keyword">import</tt> <tt id="link-9" class="py-name" targets="Class paramiko.SFTPAttributes=paramiko.SFTPAttributes-class.html"><a title="paramiko.SFTPAttributes" class="py-name" href="#" onclick="return doclink('link-9', 'SFTPAttributes', 'link-9');">SFTPAttributes</a></tt> </tt> +<a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"> </tt> +<a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"> </tt> +<a name="SFTPFile"></a><div id="SFTPFile-def"><a name="L34"></a><tt class="py-lineno"> 34</tt> <a class="py-toggle" href="#" id="SFTPFile-toggle" onclick="return toggle('SFTPFile');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html">SFTPFile</a> <tt class="py-op">(</tt><tt class="py-base-class">BufferedFile</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="SFTPFile-expanded"><a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"><tt class="py-docstring"> Proxy object for a file on the remote server, in client mode SFTP.</tt> </tt> +<a name="L37"></a><tt class="py-lineno"> 37</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"> </tt> +<a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"> <tt class="py-comment"># Some sftp servers will choke if you send read/write requests larger than</tt> </tt> +<a name="L40"></a><tt class="py-lineno"> 40</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># this size.</tt> </tt> +<a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt id="link-10" class="py-name" targets="Variable paramiko.SFTPFile.MAX_REQUEST_SIZE=paramiko.SFTPFile-class.html#MAX_REQUEST_SIZE"><a title="paramiko.SFTPFile.MAX_REQUEST_SIZE" class="py-name" href="#" onclick="return doclink('link-10', 'MAX_REQUEST_SIZE', 'link-10');">MAX_REQUEST_SIZE</a></tt> <tt class="py-op">=</tt> <tt class="py-number">32768</tt> </tt> +<a name="L42"></a><tt class="py-lineno"> 42</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.__init__"></a><div id="SFTPFile.__init__-def"><a name="L43"></a><tt class="py-lineno"> 43</tt> <a class="py-toggle" href="#" id="SFTPFile.__init__-toggle" onclick="return toggle('SFTPFile.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">sftp</tt><tt class="py-op">,</tt> <tt class="py-param">handle</tt><tt class="py-op">,</tt> <tt class="py-param">mode</tt><tt class="py-op">=</tt><tt class="py-string">'r'</tt><tt class="py-op">,</tt> <tt class="py-param">bufsize</tt><tt class="py-op">=</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.__init__-expanded"><a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"> <tt id="link-11" class="py-name"><a title="paramiko.BufferedFile" class="py-name" href="#" onclick="return doclink('link-11', 'BufferedFile', 'link-6');">BufferedFile</a></tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Method paramiko.Agent.__init__()=paramiko.Agent-class.html#__init__,Method paramiko.AgentKey.__init__()=paramiko.AgentKey-class.html#__init__,Method paramiko.BadAuthenticationType.__init__()=paramiko.BadAuthenticationType-class.html#__init__,Method paramiko.BadHostKeyException.__init__()=paramiko.BadHostKeyException-class.html#__init__,Method paramiko.BufferedFile.__init__()=paramiko.BufferedFile-class.html#__init__,Method paramiko.Channel.__init__()=paramiko.Channel-class.html#__init__,Method paramiko.ChannelException.__init__()=paramiko.ChannelException-class.html#__init__,Method paramiko.DSSKey.__init__()=paramiko.DSSKey-class.html#__init__,Method paramiko.HostKeys.__init__()=paramiko.HostKeys-class.html#__init__,Method paramiko.Message.__init__()=paramiko.Message-class.html#__init__,Method paramiko.PKey.__init__()=paramiko.PKey-class.html#__init__,Method paramiko.RSAKey.__init__()=paramiko.RSAKey-class.html#__init__,Method paramiko.SFTPAttributes.__init__()=paramiko.SFTPAttributes-class.html#__init__,Method paramiko.SFTPClient.__init__()=paramiko.SFTPClient-class.html#__init__,Method paramiko.SFTPFile.__init__()=paramiko.SFTPFile-class.html#__init__,Method paramiko.SFTPHandle.__init__()=paramiko.SFTPHandle-class.html#__init__,Method paramiko.SFTPServer.__init__()=paramiko.SFTPServer-class.html#__init__,Method paramiko.SFTPServerInterface.__init__()=paramiko.SFTPServerInterface-class.html#__init__,Method paramiko.SSHClient.__init__()=paramiko.SSHClient-class.html#__init__,Method paramiko.SSHConfig.__init__()=paramiko.SSHConfig-class.html#__init__,Method paramiko.SecurityOptions.__init__()=paramiko.SecurityOptions-class.html#__init__,Method paramiko.SubsystemHandler.__init__()=paramiko.SubsystemHandler-class.html#__init__,Method paramiko.Transport.__init__()=paramiko.Transport-class.html#__init__,Method paramiko.ber.BER.__init__()=paramiko.ber.BER-class.html#__init__,Method paramiko.buffered_pipe.BufferedPipe.__init__()=paramiko.buffered_pipe.BufferedPipe-class.html#__init__,Method paramiko.channel.ChannelStderrFile.__init__()=paramiko.channel.ChannelStderrFile-class.html#__init__,Method paramiko.compress.ZlibCompressor.__init__()=paramiko.compress.ZlibCompressor-class.html#__init__,Method paramiko.compress.ZlibDecompressor.__init__()=paramiko.compress.ZlibDecompressor-class.html#__init__,Method paramiko.hostkeys.HostKeyEntry.__init__()=paramiko.hostkeys.HostKeyEntry-class.html#__init__,Method paramiko.kex_gex.KexGex.__init__()=paramiko.kex_gex.KexGex-class.html#__init__,Method paramiko.kex_group1.KexGroup1.__init__()=paramiko.kex_group1.KexGroup1-class.html#__init__,Method paramiko.logging22.Formatter.__init__()=paramiko.logging22.Formatter-class.html#__init__,Method paramiko.logging22.StreamHandler.__init__()=paramiko.logging22.StreamHandler-class.html#__init__,Method paramiko.logging22.logger.__init__()=paramiko.logging22.logger-class.html#__init__,Method paramiko.pipe.OrPipe.__init__()=paramiko.pipe.OrPipe-class.html#__init__,Method paramiko.pipe.PosixPipe.__init__()=paramiko.pipe.PosixPipe-class.html#__init__,Method paramiko.pipe.WindowsPipe.__init__()=paramiko.pipe.WindowsPipe-class.html#__init__,Method paramiko.primes.ModulusPack.__init__()=paramiko.primes.ModulusPack-class.html#__init__,Method paramiko.rng.StrongLockingRandomPool.__init__()=paramiko.rng.StrongLockingRandomPool-class.html#__init__,Method paramiko.ssh_exception.PartialAuthentication.__init__()=paramiko.ssh_exception.PartialAuthentication-class.html#__init__,Method paramiko.transport.ChannelMap.__init__()=paramiko.transport.ChannelMap-class.html#__init__,Method paramiko.util.enumerate.__init__()=paramiko.util.enumerate-class.html#__init__,Method paramiko.win_pageant.PageantConnection.__init__()=paramiko.win_pageant.PageantConnection-class.html#__init__"><a title="paramiko.Agent.__init__ +paramiko.AgentKey.__init__ +paramiko.BadAuthenticationType.__init__ +paramiko.BadHostKeyException.__init__ +paramiko.BufferedFile.__init__ +paramiko.Channel.__init__ +paramiko.ChannelException.__init__ +paramiko.DSSKey.__init__ +paramiko.HostKeys.__init__ +paramiko.Message.__init__ +paramiko.PKey.__init__ +paramiko.RSAKey.__init__ +paramiko.SFTPAttributes.__init__ +paramiko.SFTPClient.__init__ +paramiko.SFTPFile.__init__ +paramiko.SFTPHandle.__init__ +paramiko.SFTPServer.__init__ +paramiko.SFTPServerInterface.__init__ +paramiko.SSHClient.__init__ +paramiko.SSHConfig.__init__ +paramiko.SecurityOptions.__init__ +paramiko.SubsystemHandler.__init__ +paramiko.Transport.__init__ +paramiko.ber.BER.__init__ +paramiko.buffered_pipe.BufferedPipe.__init__ +paramiko.channel.ChannelStderrFile.__init__ +paramiko.compress.ZlibCompressor.__init__ +paramiko.compress.ZlibDecompressor.__init__ +paramiko.hostkeys.HostKeyEntry.__init__ +paramiko.kex_gex.KexGex.__init__ +paramiko.kex_group1.KexGroup1.__init__ +paramiko.logging22.Formatter.__init__ +paramiko.logging22.StreamHandler.__init__ +paramiko.logging22.logger.__init__ +paramiko.pipe.OrPipe.__init__ +paramiko.pipe.PosixPipe.__init__ +paramiko.pipe.WindowsPipe.__init__ +paramiko.primes.ModulusPack.__init__ +paramiko.rng.StrongLockingRandomPool.__init__ +paramiko.ssh_exception.PartialAuthentication.__init__ +paramiko.transport.ChannelMap.__init__ +paramiko.util.enumerate.__init__ +paramiko.win_pageant.PageantConnection.__init__" class="py-name" href="#" onclick="return doclink('link-12', '__init__', 'link-12');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt> +<a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-13', 'sftp', 'link-3');">sftp</a></tt> <tt class="py-op">=</tt> <tt id="link-14" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-14', 'sftp', 'link-3');">sftp</a></tt> </tt> +<a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt> <tt class="py-op">=</tt> <tt class="py-name">handle</tt> </tt> +<a name="L47"></a><tt class="py-lineno"> 47</tt> <tt class="py-line"> <tt id="link-15" class="py-name"><a title="paramiko.BufferedFile" class="py-name" href="#" onclick="return doclink('link-15', 'BufferedFile', 'link-6');">BufferedFile</a></tt><tt class="py-op">.</tt><tt class="py-name">_set_mode</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">mode</tt><tt class="py-op">,</tt> <tt class="py-name">bufsize</tt><tt class="py-op">)</tt> </tt> +<a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">pipelined</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt> +<a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetching</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt> +<a name="L50"></a><tt class="py-lineno"> 50</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_done</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt> +<a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_data</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt> +<a name="L52"></a><tt class="py-lineno"> 52</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_reads</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt> +<a name="L53"></a><tt class="py-lineno"> 53</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_saved_exception</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt> +</div><a name="L54"></a><tt class="py-lineno"> 54</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.__del__"></a><div id="SFTPFile.__del__-def"><a name="L55"></a><tt class="py-lineno"> 55</tt> <a class="py-toggle" href="#" id="SFTPFile.__del__-toggle" onclick="return toggle('SFTPFile.__del__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#__del__">__del__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.__del__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.__del__-expanded"><a name="L56"></a><tt class="py-lineno"> 56</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_close</tt><tt class="py-op">(</tt><tt class="py-name">async</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt> +</div><a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.close"></a><div id="SFTPFile.close-def"><a name="L58"></a><tt class="py-lineno"> 58</tt> <a class="py-toggle" href="#" id="SFTPFile.close-toggle" onclick="return toggle('SFTPFile.close');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#close">close</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.close-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.close-expanded"><a name="L59"></a><tt class="py-lineno"> 59</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_close</tt><tt class="py-op">(</tt><tt class="py-name">async</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt> +</div><a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._close"></a><div id="SFTPFile._close-def"><a name="L61"></a><tt class="py-lineno"> 61</tt> <a class="py-toggle" href="#" id="SFTPFile._close-toggle" onclick="return toggle('SFTPFile._close');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_close">_close</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">async</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._close-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._close-expanded"><a name="L62"></a><tt class="py-lineno"> 62</tt> <tt class="py-line"> <tt class="py-comment"># We allow double-close without signaling an error, because real</tt> </tt> +<a name="L63"></a><tt class="py-lineno"> 63</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># Python file objects do. However, we must protect against actually</tt> </tt> +<a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># sending multiple CMD_CLOSE packets, because after we close our</tt> </tt> +<a name="L65"></a><tt class="py-lineno"> 65</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># handle, the same handle may be re-allocated by the server, and we</tt> </tt> +<a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># may end up mysteriously closing some random other file. (This is</tt> </tt> +<a name="L67"></a><tt class="py-lineno"> 67</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># especially important because we unconditionally call close() from</tt> </tt> +<a name="L68"></a><tt class="py-lineno"> 68</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># __del__.)</tt> </tt> +<a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_closed</tt><tt class="py-op">:</tt> </tt> +<a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> </tt> +<a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-16', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_log</tt><tt class="py-op">(</tt><tt id="link-17" class="py-name" targets="Variable paramiko.auth_handler.DEBUG=paramiko.auth_handler-module.html#DEBUG,Variable paramiko.channel.DEBUG=paramiko.channel-module.html#DEBUG,Variable paramiko.client.DEBUG=paramiko.client-module.html#DEBUG,Variable paramiko.common.DEBUG=paramiko.common-module.html#DEBUG,Variable paramiko.dsskey.DEBUG=paramiko.dsskey-module.html#DEBUG,Variable paramiko.hostkeys.DEBUG=paramiko.hostkeys-module.html#DEBUG,Variable paramiko.kex_gex.DEBUG=paramiko.kex_gex-module.html#DEBUG,Variable paramiko.kex_group1.DEBUG=paramiko.kex_group1-module.html#DEBUG,Variable paramiko.logging22.DEBUG=paramiko.logging22-module.html#DEBUG,Variable paramiko.packet.DEBUG=paramiko.packet-module.html#DEBUG,Variable paramiko.pkey.DEBUG=paramiko.pkey-module.html#DEBUG,Variable paramiko.rsakey.DEBUG=paramiko.rsakey-module.html#DEBUG,Variable paramiko.server.DEBUG=paramiko.server-module.html#DEBUG,Variable paramiko.sftp.DEBUG=paramiko.sftp-module.html#DEBUG,Variable paramiko.sftp_attr.DEBUG=paramiko.sftp_attr-module.html#DEBUG,Variable paramiko.sftp_client.DEBUG=paramiko.sftp_client-module.html#DEBUG,Variable paramiko.sftp_file.DEBUG=paramiko.sftp_file-module.html#DEBUG,Variable paramiko.sftp_handle.DEBUG=paramiko.sftp_handle-module.html#DEBUG,Variable paramiko.sftp_server.DEBUG=paramiko.sftp_server-module.html#DEBUG,Variable paramiko.sftp_si.DEBUG=paramiko.sftp_si-module.html#DEBUG,Variable paramiko.transport.DEBUG=paramiko.transport-module.html#DEBUG,Variable paramiko.util.DEBUG=paramiko.util-module.html#DEBUG"><a title="paramiko.auth_handler.DEBUG +paramiko.channel.DEBUG +paramiko.client.DEBUG +paramiko.common.DEBUG +paramiko.dsskey.DEBUG +paramiko.hostkeys.DEBUG +paramiko.kex_gex.DEBUG +paramiko.kex_group1.DEBUG +paramiko.logging22.DEBUG +paramiko.packet.DEBUG +paramiko.pkey.DEBUG +paramiko.rsakey.DEBUG +paramiko.server.DEBUG +paramiko.sftp.DEBUG +paramiko.sftp_attr.DEBUG +paramiko.sftp_client.DEBUG +paramiko.sftp_file.DEBUG +paramiko.sftp_handle.DEBUG +paramiko.sftp_server.DEBUG +paramiko.sftp_si.DEBUG +paramiko.transport.DEBUG +paramiko.util.DEBUG" class="py-name" href="#" onclick="return doclink('link-17', 'DEBUG', 'link-17');">DEBUG</a></tt><tt class="py-op">,</tt> <tt class="py-string">'close(%s)'</tt> <tt class="py-op">%</tt> <tt class="py-name">hexlify</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L72"></a><tt class="py-lineno"> 72</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">pipelined</tt><tt class="py-op">:</tt> </tt> +<a name="L73"></a><tt class="py-lineno"> 73</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-18', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_finish_responses</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt> +<a name="L74"></a><tt class="py-lineno"> 74</tt> <tt class="py-line"> <tt id="link-19" class="py-name"><a title="paramiko.BufferedFile" class="py-name" href="#" onclick="return doclink('link-19', 'BufferedFile', 'link-6');">BufferedFile</a></tt><tt class="py-op">.</tt><tt id="link-20" class="py-name" targets="Method paramiko.Agent.close()=paramiko.Agent-class.html#close,Method paramiko.BufferedFile.close()=paramiko.BufferedFile-class.html#close,Method paramiko.Channel.close()=paramiko.Channel-class.html#close,Method paramiko.SFTPClient.close()=paramiko.SFTPClient-class.html#close,Method paramiko.SFTPFile.close()=paramiko.SFTPFile-class.html#close,Method paramiko.SFTPHandle.close()=paramiko.SFTPHandle-class.html#close,Method paramiko.SSHClient.close()=paramiko.SSHClient-class.html#close,Method paramiko.Transport.close()=paramiko.Transport-class.html#close,Method paramiko.buffered_pipe.BufferedPipe.close()=paramiko.buffered_pipe.BufferedPipe-class.html#close,Method paramiko.pipe.PosixPipe.close()=paramiko.pipe.PosixPipe-class.html#close,Method paramiko.pipe.WindowsPipe.close()=paramiko.pipe.WindowsPipe-class.html#close,Method paramiko.win_pageant.PageantConnection.close()=paramiko.win_pageant.PageantConnection-class.html#close"><a title="paramiko.Agent.close +paramiko.BufferedFile.close +paramiko.Channel.close +paramiko.SFTPClient.close +paramiko.SFTPFile.close +paramiko.SFTPHandle.close +paramiko.SSHClient.close +paramiko.Transport.close +paramiko.buffered_pipe.BufferedPipe.close +paramiko.pipe.PosixPipe.close +paramiko.pipe.WindowsPipe.close +paramiko.win_pageant.PageantConnection.close" class="py-name" href="#" onclick="return doclink('link-20', 'close', 'link-20');">close</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt> +<a name="L75"></a><tt class="py-lineno"> 75</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt> +<a name="L76"></a><tt class="py-lineno"> 76</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">async</tt><tt class="py-op">:</tt> </tt> +<a name="L77"></a><tt class="py-lineno"> 77</tt> <tt class="py-line"> <tt class="py-comment"># GC'd file handle could be called from an arbitrary thread -- don't wait for a response</tt> </tt> +<a name="L78"></a><tt class="py-lineno"> 78</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-21" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-21', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_async_request</tt><tt class="py-op">(</tt><tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-22" class="py-name" targets="Variable paramiko.sftp.CMD_CLOSE=paramiko.sftp-module.html#CMD_CLOSE,Variable paramiko.sftp_attr.CMD_CLOSE=paramiko.sftp_attr-module.html#CMD_CLOSE,Variable paramiko.sftp_client.CMD_CLOSE=paramiko.sftp_client-module.html#CMD_CLOSE,Variable paramiko.sftp_file.CMD_CLOSE=paramiko.sftp_file-module.html#CMD_CLOSE,Variable paramiko.sftp_handle.CMD_CLOSE=paramiko.sftp_handle-module.html#CMD_CLOSE,Variable paramiko.sftp_server.CMD_CLOSE=paramiko.sftp_server-module.html#CMD_CLOSE,Variable paramiko.sftp_si.CMD_CLOSE=paramiko.sftp_si-module.html#CMD_CLOSE"><a title="paramiko.sftp.CMD_CLOSE +paramiko.sftp_attr.CMD_CLOSE +paramiko.sftp_client.CMD_CLOSE +paramiko.sftp_file.CMD_CLOSE +paramiko.sftp_handle.CMD_CLOSE +paramiko.sftp_server.CMD_CLOSE +paramiko.sftp_si.CMD_CLOSE" class="py-name" href="#" onclick="return doclink('link-22', 'CMD_CLOSE', 'link-22');">CMD_CLOSE</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt> </tt> +<a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt> +<a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-23', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_request</tt><tt class="py-op">(</tt><tt id="link-24" class="py-name"><a title="paramiko.sftp.CMD_CLOSE +paramiko.sftp_attr.CMD_CLOSE +paramiko.sftp_client.CMD_CLOSE +paramiko.sftp_file.CMD_CLOSE +paramiko.sftp_handle.CMD_CLOSE +paramiko.sftp_server.CMD_CLOSE +paramiko.sftp_si.CMD_CLOSE" class="py-name" href="#" onclick="return doclink('link-24', 'CMD_CLOSE', 'link-22');">CMD_CLOSE</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt> </tt> +<a name="L81"></a><tt class="py-lineno"> 81</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">EOFError</tt><tt class="py-op">:</tt> </tt> +<a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"> <tt class="py-comment"># may have outlived the Transport connection</tt> </tt> +<a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">pass</tt> </tt> +<a name="L84"></a><tt class="py-lineno"> 84</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-op">(</tt><tt class="py-name">IOError</tt><tt class="py-op">,</tt> <tt class="py-name">socket</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name" targets="Class paramiko.rng_posix.error=paramiko.rng_posix.error-class.html,Class paramiko.rng_win32.error=paramiko.rng_win32.error-class.html"><a title="paramiko.rng_posix.error +paramiko.rng_win32.error" class="py-name" href="#" onclick="return doclink('link-25', 'error', 'link-25');">error</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +<a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"> <tt class="py-comment"># may have outlived the Transport connection</tt> </tt> +<a name="L86"></a><tt class="py-lineno"> 86</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">pass</tt> </tt> +</div><a name="L87"></a><tt class="py-lineno"> 87</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._data_in_prefetch_requests"></a><div id="SFTPFile._data_in_prefetch_requests-def"><a name="L88"></a><tt class="py-lineno"> 88</tt> <a class="py-toggle" href="#" id="SFTPFile._data_in_prefetch_requests-toggle" onclick="return toggle('SFTPFile._data_in_prefetch_requests');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_data_in_prefetch_requests">_data_in_prefetch_requests</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">offset</tt><tt class="py-op">,</tt> <tt class="py-param">size</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._data_in_prefetch_requests-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._data_in_prefetch_requests-expanded"><a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"> <tt class="py-name">k</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">i</tt> <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_reads</tt> <tt class="py-keyword">if</tt> <tt class="py-name">i</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op"><=</tt> <tt class="py-name">offset</tt><tt class="py-op">]</tt> </tt> +<a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt> +<a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt> +<a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"> <tt class="py-name">k</tt><tt class="py-op">.</tt><tt class="py-name">sort</tt><tt class="py-op">(</tt><tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">:</tt> <tt class="py-name">cmp</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"> <tt class="py-name">buf_offset</tt><tt class="py-op">,</tt> <tt class="py-name">buf_size</tt> <tt class="py-op">=</tt> <tt class="py-name">k</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt> +<a name="L94"></a><tt class="py-lineno"> 94</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">buf_offset</tt> <tt class="py-op">+</tt> <tt class="py-name">buf_size</tt> <tt class="py-op"><=</tt> <tt class="py-name">offset</tt><tt class="py-op">:</tt> </tt> +<a name="L95"></a><tt class="py-lineno"> 95</tt> <tt class="py-line"> <tt class="py-comment"># prefetch request ends before this one begins</tt> </tt> +<a name="L96"></a><tt class="py-lineno"> 96</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt> +<a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">buf_offset</tt> <tt class="py-op">+</tt> <tt class="py-name">buf_size</tt> <tt class="py-op">>=</tt> <tt class="py-name">offset</tt> <tt class="py-op">+</tt> <tt class="py-name">size</tt><tt class="py-op">:</tt> </tt> +<a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"> <tt class="py-comment"># inclusive</tt> </tt> +<a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt> +<a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"> <tt class="py-comment"># well, we have part of the request. see if another chunk has the rest.</tt> </tt> +<a name="L101"></a><tt class="py-lineno">101</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_data_in_prefetch_requests</tt><tt class="py-op">(</tt><tt class="py-name">buf_offset</tt> <tt class="py-op">+</tt> <tt class="py-name">buf_size</tt><tt class="py-op">,</tt> <tt class="py-name">offset</tt> <tt class="py-op">+</tt> <tt class="py-name">size</tt> <tt class="py-op">-</tt> <tt class="py-name">buf_offset</tt> <tt class="py-op">-</tt> <tt class="py-name">buf_size</tt><tt class="py-op">)</tt> </tt> +</div><a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._data_in_prefetch_buffers"></a><div id="SFTPFile._data_in_prefetch_buffers-def"><a name="L103"></a><tt class="py-lineno">103</tt> <a class="py-toggle" href="#" id="SFTPFile._data_in_prefetch_buffers-toggle" onclick="return toggle('SFTPFile._data_in_prefetch_buffers');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_data_in_prefetch_buffers">_data_in_prefetch_buffers</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">offset</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._data_in_prefetch_buffers-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._data_in_prefetch_buffers-expanded"><a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"><tt class="py-docstring"> if a block of data is present in the prefetch buffers, at the given</tt> </tt> +<a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"><tt class="py-docstring"> offset, return the offset of the relevant prefetch buffer. otherwise,</tt> </tt> +<a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"><tt class="py-docstring"> return None. this guarantees nothing about the number of bytes</tt> </tt> +<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"><tt class="py-docstring"> collected in the prefetch buffer so far.</tt> </tt> +<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"> <tt class="py-name">k</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">i</tt> <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_data</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name" targets="Method paramiko.HostKeys.keys()=paramiko.HostKeys-class.html#keys"><a title="paramiko.HostKeys.keys" class="py-name" href="#" onclick="return doclink('link-26', 'keys', 'link-26');">keys</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-keyword">if</tt> <tt class="py-name">i</tt> <tt class="py-op"><=</tt> <tt class="py-name">offset</tt><tt class="py-op">]</tt> </tt> +<a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt> +<a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt> +<a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"> <tt class="py-name">index</tt> <tt class="py-op">=</tt> <tt class="py-name">max</tt><tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">)</tt> </tt> +<a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"> <tt class="py-name">buf_offset</tt> <tt class="py-op">=</tt> <tt class="py-name">offset</tt> <tt class="py-op">-</tt> <tt class="py-name">index</tt> </tt> +<a name="L115"></a><tt class="py-lineno">115</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">buf_offset</tt> <tt class="py-op">>=</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_data</tt><tt class="py-op">[</tt><tt class="py-name">index</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +<a name="L116"></a><tt class="py-lineno">116</tt> <tt class="py-line"> <tt class="py-comment"># it's not here</tt> </tt> +<a name="L117"></a><tt class="py-lineno">117</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt> +<a name="L118"></a><tt class="py-lineno">118</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">index</tt> </tt> +</div><a name="L119"></a><tt class="py-lineno">119</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._read_prefetch"></a><div id="SFTPFile._read_prefetch-def"><a name="L120"></a><tt class="py-lineno">120</tt> <a class="py-toggle" href="#" id="SFTPFile._read_prefetch-toggle" onclick="return toggle('SFTPFile._read_prefetch');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_read_prefetch">_read_prefetch</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">size</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._read_prefetch-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._read_prefetch-expanded"><a name="L121"></a><tt class="py-lineno">121</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L122"></a><tt class="py-lineno">122</tt> <tt class="py-line"><tt class="py-docstring"> read data out of the prefetch buffer, if possible. if the data isn't</tt> </tt> +<a name="L123"></a><tt class="py-lineno">123</tt> <tt class="py-line"><tt class="py-docstring"> in the buffer, return None. otherwise, behaves like a normal read.</tt> </tt> +<a name="L124"></a><tt class="py-lineno">124</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L125"></a><tt class="py-lineno">125</tt> <tt class="py-line"> <tt class="py-comment"># while not closed, and haven't fetched past the current position, and haven't reached EOF...</tt> </tt> +<a name="L126"></a><tt class="py-lineno">126</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">while</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt> +<a name="L127"></a><tt class="py-lineno">127</tt> <tt class="py-line"> <tt class="py-name">offset</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_data_in_prefetch_buffers</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt><tt class="py-op">)</tt> </tt> +<a name="L128"></a><tt class="py-lineno">128</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">offset</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt> +<a name="L129"></a><tt class="py-lineno">129</tt> <tt class="py-line"> <tt class="py-keyword">break</tt> </tt> +<a name="L130"></a><tt class="py-lineno">130</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_done</tt> <tt class="py-keyword">or</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_closed</tt><tt class="py-op">:</tt> </tt> +<a name="L131"></a><tt class="py-lineno">131</tt> <tt class="py-line"> <tt class="py-keyword">break</tt> </tt> +<a name="L132"></a><tt class="py-lineno">132</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-27', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_read_response</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L133"></a><tt class="py-lineno">133</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_check_exception</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L134"></a><tt class="py-lineno">134</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">offset</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt> +<a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetching</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt> +<a name="L136"></a><tt class="py-lineno">136</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt> +<a name="L137"></a><tt class="py-lineno">137</tt> <tt class="py-line"> <tt id="link-28" class="py-name" targets="Method paramiko.SFTPFile.prefetch()=paramiko.SFTPFile-class.html#prefetch"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-28', 'prefetch', 'link-28');">prefetch</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_data</tt><tt class="py-op">[</tt><tt class="py-name">offset</tt><tt class="py-op">]</tt> </tt> +<a name="L138"></a><tt class="py-lineno">138</tt> <tt class="py-line"> <tt class="py-keyword">del</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_data</tt><tt class="py-op">[</tt><tt class="py-name">offset</tt><tt class="py-op">]</tt> </tt> +<a name="L139"></a><tt class="py-lineno">139</tt> <tt class="py-line"> </tt> +<a name="L140"></a><tt class="py-lineno">140</tt> <tt class="py-line"> <tt class="py-name">buf_offset</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt> <tt class="py-op">-</tt> <tt class="py-name">offset</tt> </tt> +<a name="L141"></a><tt class="py-lineno">141</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">buf_offset</tt> <tt class="py-op">></tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt> +<a name="L142"></a><tt class="py-lineno">142</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_data</tt><tt class="py-op">[</tt><tt class="py-name">offset</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-29" class="py-name"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-29', 'prefetch', 'link-28');">prefetch</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-name">buf_offset</tt><tt class="py-op">]</tt> </tt> +<a name="L143"></a><tt class="py-lineno">143</tt> <tt class="py-line"> <tt id="link-30" class="py-name"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-30', 'prefetch', 'link-28');">prefetch</a></tt> <tt class="py-op">=</tt> <tt id="link-31" class="py-name"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-31', 'prefetch', 'link-28');">prefetch</a></tt><tt class="py-op">[</tt><tt class="py-name">buf_offset</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt> +<a name="L144"></a><tt class="py-lineno">144</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">size</tt> <tt class="py-op"><</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt id="link-32" class="py-name"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-32', 'prefetch', 'link-28');">prefetch</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +<a name="L145"></a><tt class="py-lineno">145</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_data</tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt> <tt class="py-op">+</tt> <tt class="py-name">size</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-33" class="py-name"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-33', 'prefetch', 'link-28');">prefetch</a></tt><tt class="py-op">[</tt><tt class="py-name">size</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt> +<a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"> <tt id="link-34" class="py-name"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-34', 'prefetch', 'link-28');">prefetch</a></tt> <tt class="py-op">=</tt> <tt id="link-35" class="py-name"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-35', 'prefetch', 'link-28');">prefetch</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-name">size</tt><tt class="py-op">]</tt> </tt> +<a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-36" class="py-name"><a title="paramiko.SFTPFile.prefetch" class="py-name" href="#" onclick="return doclink('link-36', 'prefetch', 'link-28');">prefetch</a></tt> </tt> +</div><a name="L148"></a><tt class="py-lineno">148</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._read"></a><div id="SFTPFile._read-def"><a name="L149"></a><tt class="py-lineno">149</tt> <a class="py-toggle" href="#" id="SFTPFile._read-toggle" onclick="return toggle('SFTPFile._read');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_read">_read</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">size</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._read-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._read-expanded"><a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"> <tt class="py-name">size</tt> <tt class="py-op">=</tt> <tt class="py-name">min</tt><tt class="py-op">(</tt><tt class="py-name">size</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="paramiko.SFTPFile.MAX_REQUEST_SIZE" class="py-name" href="#" onclick="return doclink('link-37', 'MAX_REQUEST_SIZE', 'link-10');">MAX_REQUEST_SIZE</a></tt><tt class="py-op">)</tt> </tt> +<a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetching</tt><tt class="py-op">:</tt> </tt> +<a name="L152"></a><tt class="py-lineno">152</tt> <tt class="py-line"> <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_read_prefetch</tt><tt class="py-op">(</tt><tt class="py-name">size</tt><tt class="py-op">)</tt> </tt> +<a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">data</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt> +<a name="L154"></a><tt class="py-lineno">154</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">data</tt> </tt> +<a name="L155"></a><tt class="py-lineno">155</tt> <tt class="py-line"> <tt class="py-name">t</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-38', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_request</tt><tt class="py-op">(</tt><tt id="link-39" class="py-name" targets="Variable paramiko.sftp.CMD_READ=paramiko.sftp-module.html#CMD_READ,Variable paramiko.sftp_attr.CMD_READ=paramiko.sftp_attr-module.html#CMD_READ,Variable paramiko.sftp_client.CMD_READ=paramiko.sftp_client-module.html#CMD_READ,Variable paramiko.sftp_file.CMD_READ=paramiko.sftp_file-module.html#CMD_READ,Variable paramiko.sftp_handle.CMD_READ=paramiko.sftp_handle-module.html#CMD_READ,Variable paramiko.sftp_server.CMD_READ=paramiko.sftp_server-module.html#CMD_READ,Variable paramiko.sftp_si.CMD_READ=paramiko.sftp_si-module.html#CMD_READ"><a title="paramiko.sftp.CMD_READ +paramiko.sftp_attr.CMD_READ +paramiko.sftp_client.CMD_READ +paramiko.sftp_file.CMD_READ +paramiko.sftp_handle.CMD_READ +paramiko.sftp_server.CMD_READ +paramiko.sftp_si.CMD_READ" class="py-name" href="#" onclick="return doclink('link-39', 'CMD_READ', 'link-39');">CMD_READ</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">,</tt> <tt class="py-name">long</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">size</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">t</tt> <tt class="py-op">!=</tt> <tt id="link-40" class="py-name" targets="Variable paramiko.sftp.CMD_DATA=paramiko.sftp-module.html#CMD_DATA,Variable paramiko.sftp_attr.CMD_DATA=paramiko.sftp_attr-module.html#CMD_DATA,Variable paramiko.sftp_client.CMD_DATA=paramiko.sftp_client-module.html#CMD_DATA,Variable paramiko.sftp_file.CMD_DATA=paramiko.sftp_file-module.html#CMD_DATA,Variable paramiko.sftp_handle.CMD_DATA=paramiko.sftp_handle-module.html#CMD_DATA,Variable paramiko.sftp_server.CMD_DATA=paramiko.sftp_server-module.html#CMD_DATA,Variable paramiko.sftp_si.CMD_DATA=paramiko.sftp_si-module.html#CMD_DATA"><a title="paramiko.sftp.CMD_DATA +paramiko.sftp_attr.CMD_DATA +paramiko.sftp_client.CMD_DATA +paramiko.sftp_file.CMD_DATA +paramiko.sftp_handle.CMD_DATA +paramiko.sftp_server.CMD_DATA +paramiko.sftp_si.CMD_DATA" class="py-name" href="#" onclick="return doclink('link-40', 'CMD_DATA', 'link-40');">CMD_DATA</a></tt><tt class="py-op">:</tt> </tt> +<a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt id="link-41" class="py-name" targets="Class paramiko.SFTPError=paramiko.SFTPError-class.html"><a title="paramiko.SFTPError" class="py-name" href="#" onclick="return doclink('link-41', 'SFTPError', 'link-41');">SFTPError</a></tt><tt class="py-op">(</tt><tt class="py-string">'Expected data'</tt><tt class="py-op">)</tt> </tt> +<a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">msg</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name" targets="Method paramiko.Message.get_string()=paramiko.Message-class.html#get_string"><a title="paramiko.Message.get_string" class="py-name" href="#" onclick="return doclink('link-42', 'get_string', 'link-42');">get_string</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +</div><a name="L159"></a><tt class="py-lineno">159</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._write"></a><div id="SFTPFile._write-def"><a name="L160"></a><tt class="py-lineno">160</tt> <a class="py-toggle" href="#" id="SFTPFile._write-toggle" onclick="return toggle('SFTPFile._write');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_write">_write</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._write-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._write-expanded"><a name="L161"></a><tt class="py-lineno">161</tt> <tt class="py-line"> <tt class="py-comment"># may write less than requested if it would exceed max packet size</tt> </tt> +<a name="L162"></a><tt class="py-lineno">162</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-name">chunk</tt> <tt class="py-op">=</tt> <tt class="py-name">min</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name"><a title="paramiko.SFTPFile.MAX_REQUEST_SIZE" class="py-name" href="#" onclick="return doclink('link-43', 'MAX_REQUEST_SIZE', 'link-10');">MAX_REQUEST_SIZE</a></tt><tt class="py-op">)</tt> </tt> +<a name="L163"></a><tt class="py-lineno">163</tt> <tt class="py-line"> <tt class="py-name">req</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-44', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_async_request</tt><tt class="py-op">(</tt><tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-45" class="py-name" targets="Variable paramiko.sftp.CMD_WRITE=paramiko.sftp-module.html#CMD_WRITE,Variable paramiko.sftp_attr.CMD_WRITE=paramiko.sftp_attr-module.html#CMD_WRITE,Variable paramiko.sftp_client.CMD_WRITE=paramiko.sftp_client-module.html#CMD_WRITE,Variable paramiko.sftp_file.CMD_WRITE=paramiko.sftp_file-module.html#CMD_WRITE,Variable paramiko.sftp_handle.CMD_WRITE=paramiko.sftp_handle-module.html#CMD_WRITE,Variable paramiko.sftp_server.CMD_WRITE=paramiko.sftp_server-module.html#CMD_WRITE,Variable paramiko.sftp_si.CMD_WRITE=paramiko.sftp_si-module.html#CMD_WRITE"><a title="paramiko.sftp.CMD_WRITE +paramiko.sftp_attr.CMD_WRITE +paramiko.sftp_client.CMD_WRITE +paramiko.sftp_file.CMD_WRITE +paramiko.sftp_handle.CMD_WRITE +paramiko.sftp_server.CMD_WRITE +paramiko.sftp_si.CMD_WRITE" class="py-name" href="#" onclick="return doclink('link-45', 'CMD_WRITE', 'link-45');">CMD_WRITE</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">,</tt> <tt class="py-name">long</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-name">chunk</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L164"></a><tt class="py-lineno">164</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">pipelined</tt> <tt class="py-keyword">or</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-46', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">sock</tt><tt class="py-op">.</tt><tt id="link-47" class="py-name" targets="Method paramiko.Channel.recv_ready()=paramiko.Channel-class.html#recv_ready"><a title="paramiko.Channel.recv_ready" class="py-name" href="#" onclick="return doclink('link-47', 'recv_ready', 'link-47');">recv_ready</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +<a name="L165"></a><tt class="py-lineno">165</tt> <tt class="py-line"> <tt class="py-name">t</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-48', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_read_response</tt><tt class="py-op">(</tt><tt class="py-name">req</tt><tt class="py-op">)</tt> </tt> +<a name="L166"></a><tt class="py-lineno">166</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">t</tt> <tt class="py-op">!=</tt> <tt id="link-49" class="py-name" targets="Variable paramiko.sftp.CMD_STATUS=paramiko.sftp-module.html#CMD_STATUS,Variable paramiko.sftp_attr.CMD_STATUS=paramiko.sftp_attr-module.html#CMD_STATUS,Variable paramiko.sftp_client.CMD_STATUS=paramiko.sftp_client-module.html#CMD_STATUS,Variable paramiko.sftp_file.CMD_STATUS=paramiko.sftp_file-module.html#CMD_STATUS,Variable paramiko.sftp_handle.CMD_STATUS=paramiko.sftp_handle-module.html#CMD_STATUS,Variable paramiko.sftp_server.CMD_STATUS=paramiko.sftp_server-module.html#CMD_STATUS,Variable paramiko.sftp_si.CMD_STATUS=paramiko.sftp_si-module.html#CMD_STATUS"><a title="paramiko.sftp.CMD_STATUS +paramiko.sftp_attr.CMD_STATUS +paramiko.sftp_client.CMD_STATUS +paramiko.sftp_file.CMD_STATUS +paramiko.sftp_handle.CMD_STATUS +paramiko.sftp_server.CMD_STATUS +paramiko.sftp_si.CMD_STATUS" class="py-name" href="#" onclick="return doclink('link-49', 'CMD_STATUS', 'link-49');">CMD_STATUS</a></tt><tt class="py-op">:</tt> </tt> +<a name="L167"></a><tt class="py-lineno">167</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt id="link-50" class="py-name"><a title="paramiko.SFTPError" class="py-name" href="#" onclick="return doclink('link-50', 'SFTPError', 'link-41');">SFTPError</a></tt><tt class="py-op">(</tt><tt class="py-string">'Expected status'</tt><tt class="py-op">)</tt> </tt> +<a name="L168"></a><tt class="py-lineno">168</tt> <tt class="py-line"> <tt class="py-comment"># convert_status already called</tt> </tt> +<a name="L169"></a><tt class="py-lineno">169</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">return</tt> <tt class="py-name">chunk</tt> </tt> +</div><a name="L170"></a><tt class="py-lineno">170</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.settimeout"></a><div id="SFTPFile.settimeout-def"><a name="L171"></a><tt class="py-lineno">171</tt> <a class="py-toggle" href="#" id="SFTPFile.settimeout-toggle" onclick="return toggle('SFTPFile.settimeout');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#settimeout">settimeout</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">timeout</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.settimeout-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.settimeout-expanded"><a name="L172"></a><tt class="py-lineno">172</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L173"></a><tt class="py-lineno">173</tt> <tt class="py-line"><tt class="py-docstring"> Set a timeout on read/write operations on the underlying socket or</tt> </tt> +<a name="L174"></a><tt class="py-lineno">174</tt> <tt class="py-line"><tt class="py-docstring"> ssh L{Channel}.</tt> </tt> +<a name="L175"></a><tt class="py-lineno">175</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> +<a name="L176"></a><tt class="py-lineno">176</tt> <tt class="py-line"><tt class="py-docstring"> @see: L{Channel.settimeout}</tt> </tt> +<a name="L177"></a><tt class="py-lineno">177</tt> <tt class="py-line"><tt class="py-docstring"> @param timeout: seconds to wait for a pending read/write operation</tt> </tt> +<a name="L178"></a><tt class="py-lineno">178</tt> <tt class="py-line"><tt class="py-docstring"> before raising C{socket.timeout}, or C{None} for no timeout</tt> </tt> +<a name="L179"></a><tt class="py-lineno">179</tt> <tt class="py-line"><tt class="py-docstring"> @type timeout: float</tt> </tt> +<a name="L180"></a><tt class="py-lineno">180</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L181"></a><tt class="py-lineno">181</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-51', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">sock</tt><tt class="py-op">.</tt><tt id="link-52" class="py-name" targets="Method paramiko.Channel.settimeout()=paramiko.Channel-class.html#settimeout,Method paramiko.SFTPFile.settimeout()=paramiko.SFTPFile-class.html#settimeout"><a title="paramiko.Channel.settimeout +paramiko.SFTPFile.settimeout" class="py-name" href="#" onclick="return doclink('link-52', 'settimeout', 'link-52');">settimeout</a></tt><tt class="py-op">(</tt><tt class="py-name">timeout</tt><tt class="py-op">)</tt> </tt> +</div><a name="L182"></a><tt class="py-lineno">182</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.gettimeout"></a><div id="SFTPFile.gettimeout-def"><a name="L183"></a><tt class="py-lineno">183</tt> <a class="py-toggle" href="#" id="SFTPFile.gettimeout-toggle" onclick="return toggle('SFTPFile.gettimeout');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#gettimeout">gettimeout</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.gettimeout-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.gettimeout-expanded"><a name="L184"></a><tt class="py-lineno">184</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L185"></a><tt class="py-lineno">185</tt> <tt class="py-line"><tt class="py-docstring"> Returns the timeout in seconds (as a float) associated with the socket</tt> </tt> +<a name="L186"></a><tt class="py-lineno">186</tt> <tt class="py-line"><tt class="py-docstring"> or ssh L{Channel} used for this file.</tt> </tt> +<a name="L187"></a><tt class="py-lineno">187</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> +<a name="L188"></a><tt class="py-lineno">188</tt> <tt class="py-line"><tt class="py-docstring"> @see: L{Channel.gettimeout}</tt> </tt> +<a name="L189"></a><tt class="py-lineno">189</tt> <tt class="py-line"><tt class="py-docstring"> @rtype: float</tt> </tt> +<a name="L190"></a><tt class="py-lineno">190</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L191"></a><tt class="py-lineno">191</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-53', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">sock</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name" targets="Method paramiko.Channel.gettimeout()=paramiko.Channel-class.html#gettimeout,Method paramiko.SFTPFile.gettimeout()=paramiko.SFTPFile-class.html#gettimeout"><a title="paramiko.Channel.gettimeout +paramiko.SFTPFile.gettimeout" class="py-name" href="#" onclick="return doclink('link-54', 'gettimeout', 'link-54');">gettimeout</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +</div><a name="L192"></a><tt class="py-lineno">192</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.setblocking"></a><div id="SFTPFile.setblocking-def"><a name="L193"></a><tt class="py-lineno">193</tt> <a class="py-toggle" href="#" id="SFTPFile.setblocking-toggle" onclick="return toggle('SFTPFile.setblocking');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#setblocking">setblocking</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">blocking</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.setblocking-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.setblocking-expanded"><a name="L194"></a><tt class="py-lineno">194</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L195"></a><tt class="py-lineno">195</tt> <tt class="py-line"><tt class="py-docstring"> Set blocking or non-blocking mode on the underiying socket or ssh</tt> </tt> +<a name="L196"></a><tt class="py-lineno">196</tt> <tt class="py-line"><tt class="py-docstring"> L{Channel}.</tt> </tt> +<a name="L197"></a><tt class="py-lineno">197</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> +<a name="L198"></a><tt class="py-lineno">198</tt> <tt class="py-line"><tt class="py-docstring"> @see: L{Channel.setblocking}</tt> </tt> +<a name="L199"></a><tt class="py-lineno">199</tt> <tt class="py-line"><tt class="py-docstring"> @param blocking: 0 to set non-blocking mode; non-0 to set blocking</tt> </tt> +<a name="L200"></a><tt class="py-lineno">200</tt> <tt class="py-line"><tt class="py-docstring"> mode.</tt> </tt> +<a name="L201"></a><tt class="py-lineno">201</tt> <tt class="py-line"><tt class="py-docstring"> @type blocking: int</tt> </tt> +<a name="L202"></a><tt class="py-lineno">202</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L203"></a><tt class="py-lineno">203</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-55" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-55', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">sock</tt><tt class="py-op">.</tt><tt id="link-56" class="py-name" targets="Method paramiko.Channel.setblocking()=paramiko.Channel-class.html#setblocking,Method paramiko.SFTPFile.setblocking()=paramiko.SFTPFile-class.html#setblocking"><a title="paramiko.Channel.setblocking +paramiko.SFTPFile.setblocking" class="py-name" href="#" onclick="return doclink('link-56', 'setblocking', 'link-56');">setblocking</a></tt><tt class="py-op">(</tt><tt class="py-name">blocking</tt><tt class="py-op">)</tt> </tt> +</div><a name="L204"></a><tt class="py-lineno">204</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.seek"></a><div id="SFTPFile.seek-def"><a name="L205"></a><tt class="py-lineno">205</tt> <a class="py-toggle" href="#" id="SFTPFile.seek-toggle" onclick="return toggle('SFTPFile.seek');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#seek">seek</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">offset</tt><tt class="py-op">,</tt> <tt class="py-param">whence</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.seek-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.seek-expanded"><a name="L206"></a><tt class="py-lineno">206</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name" targets="Method paramiko.BufferedFile.flush()=paramiko.BufferedFile-class.html#flush"><a title="paramiko.BufferedFile.flush" class="py-name" href="#" onclick="return doclink('link-57', 'flush', 'link-57');">flush</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L207"></a><tt class="py-lineno">207</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">whence</tt> <tt class="py-op">==</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-58" class="py-name" targets="Variable paramiko.BufferedFile.SEEK_SET=paramiko.BufferedFile-class.html#SEEK_SET"><a title="paramiko.BufferedFile.SEEK_SET" class="py-name" href="#" onclick="return doclink('link-58', 'SEEK_SET', 'link-58');">SEEK_SET</a></tt><tt class="py-op">:</tt> </tt> +<a name="L208"></a><tt class="py-lineno">208</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pos</tt> <tt class="py-op">=</tt> <tt class="py-name">offset</tt> </tt> +<a name="L209"></a><tt class="py-lineno">209</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">whence</tt> <tt class="py-op">==</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-59" class="py-name" targets="Variable paramiko.BufferedFile.SEEK_CUR=paramiko.BufferedFile-class.html#SEEK_CUR"><a title="paramiko.BufferedFile.SEEK_CUR" class="py-name" href="#" onclick="return doclink('link-59', 'SEEK_CUR', 'link-59');">SEEK_CUR</a></tt><tt class="py-op">:</tt> </tt> +<a name="L210"></a><tt class="py-lineno">210</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pos</tt> <tt class="py-op">+=</tt> <tt class="py-name">offset</tt> </tt> +<a name="L211"></a><tt class="py-lineno">211</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pos</tt> </tt> +<a name="L212"></a><tt class="py-lineno">212</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt> +<a name="L213"></a><tt class="py-lineno">213</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pos</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_get_size</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">offset</tt> </tt> +<a name="L214"></a><tt class="py-lineno">214</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_rbuffer</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt> +</div><a name="L215"></a><tt class="py-lineno">215</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.stat"></a><div id="SFTPFile.stat-def"><a name="L216"></a><tt class="py-lineno">216</tt> <a class="py-toggle" href="#" id="SFTPFile.stat-toggle" onclick="return toggle('SFTPFile.stat');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#stat">stat</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.stat-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.stat-expanded"><a name="L217"></a><tt class="py-lineno">217</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L218"></a><tt class="py-lineno">218</tt> <tt class="py-line"><tt class="py-docstring"> Retrieve information about this file from the remote system. This is</tt> </tt> +<a name="L219"></a><tt class="py-lineno">219</tt> <tt class="py-line"><tt class="py-docstring"> exactly like L{SFTP.stat}, except that it operates on an already-open</tt> </tt> +<a name="L220"></a><tt class="py-lineno">220</tt> <tt class="py-line"><tt class="py-docstring"> file.</tt> </tt> +<a name="L221"></a><tt class="py-lineno">221</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> +<a name="L222"></a><tt class="py-lineno">222</tt> <tt class="py-line"><tt class="py-docstring"> @return: an object containing attributes about this file.</tt> </tt> +<a name="L223"></a><tt class="py-lineno">223</tt> <tt class="py-line"><tt class="py-docstring"> @rtype: SFTPAttributes</tt> </tt> +<a name="L224"></a><tt class="py-lineno">224</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L225"></a><tt class="py-lineno">225</tt> <tt class="py-line"> <tt class="py-name">t</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-60" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-60', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_request</tt><tt class="py-op">(</tt><tt id="link-61" class="py-name" targets="Variable paramiko.sftp.CMD_FSTAT=paramiko.sftp-module.html#CMD_FSTAT,Variable paramiko.sftp_attr.CMD_FSTAT=paramiko.sftp_attr-module.html#CMD_FSTAT,Variable paramiko.sftp_client.CMD_FSTAT=paramiko.sftp_client-module.html#CMD_FSTAT,Variable paramiko.sftp_file.CMD_FSTAT=paramiko.sftp_file-module.html#CMD_FSTAT,Variable paramiko.sftp_handle.CMD_FSTAT=paramiko.sftp_handle-module.html#CMD_FSTAT,Variable paramiko.sftp_server.CMD_FSTAT=paramiko.sftp_server-module.html#CMD_FSTAT,Variable paramiko.sftp_si.CMD_FSTAT=paramiko.sftp_si-module.html#CMD_FSTAT"><a title="paramiko.sftp.CMD_FSTAT +paramiko.sftp_attr.CMD_FSTAT +paramiko.sftp_client.CMD_FSTAT +paramiko.sftp_file.CMD_FSTAT +paramiko.sftp_handle.CMD_FSTAT +paramiko.sftp_server.CMD_FSTAT +paramiko.sftp_si.CMD_FSTAT" class="py-name" href="#" onclick="return doclink('link-61', 'CMD_FSTAT', 'link-61');">CMD_FSTAT</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt> </tt> +<a name="L226"></a><tt class="py-lineno">226</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">t</tt> <tt class="py-op">!=</tt> <tt id="link-62" class="py-name" targets="Variable paramiko.sftp.CMD_ATTRS=paramiko.sftp-module.html#CMD_ATTRS,Variable paramiko.sftp_attr.CMD_ATTRS=paramiko.sftp_attr-module.html#CMD_ATTRS,Variable paramiko.sftp_client.CMD_ATTRS=paramiko.sftp_client-module.html#CMD_ATTRS,Variable paramiko.sftp_file.CMD_ATTRS=paramiko.sftp_file-module.html#CMD_ATTRS,Variable paramiko.sftp_handle.CMD_ATTRS=paramiko.sftp_handle-module.html#CMD_ATTRS,Variable paramiko.sftp_server.CMD_ATTRS=paramiko.sftp_server-module.html#CMD_ATTRS,Variable paramiko.sftp_si.CMD_ATTRS=paramiko.sftp_si-module.html#CMD_ATTRS"><a title="paramiko.sftp.CMD_ATTRS +paramiko.sftp_attr.CMD_ATTRS +paramiko.sftp_client.CMD_ATTRS +paramiko.sftp_file.CMD_ATTRS +paramiko.sftp_handle.CMD_ATTRS +paramiko.sftp_server.CMD_ATTRS +paramiko.sftp_si.CMD_ATTRS" class="py-name" href="#" onclick="return doclink('link-62', 'CMD_ATTRS', 'link-62');">CMD_ATTRS</a></tt><tt class="py-op">:</tt> </tt> +<a name="L227"></a><tt class="py-lineno">227</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt id="link-63" class="py-name"><a title="paramiko.SFTPError" class="py-name" href="#" onclick="return doclink('link-63', 'SFTPError', 'link-41');">SFTPError</a></tt><tt class="py-op">(</tt><tt class="py-string">'Expected attributes'</tt><tt class="py-op">)</tt> </tt> +<a name="L228"></a><tt class="py-lineno">228</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-64" class="py-name"><a title="paramiko.SFTPAttributes" class="py-name" href="#" onclick="return doclink('link-64', 'SFTPAttributes', 'link-9');">SFTPAttributes</a></tt><tt class="py-op">.</tt><tt class="py-name">_from_msg</tt><tt class="py-op">(</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt> +</div><a name="L229"></a><tt class="py-lineno">229</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.chmod"></a><div id="SFTPFile.chmod-def"><a name="L230"></a><tt class="py-lineno">230</tt> <a class="py-toggle" href="#" id="SFTPFile.chmod-toggle" onclick="return toggle('SFTPFile.chmod');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#chmod">chmod</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">mode</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.chmod-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.chmod-expanded"><a name="L231"></a><tt class="py-lineno">231</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L232"></a><tt class="py-lineno">232</tt> <tt class="py-line"><tt class="py-docstring"> Change the mode (permissions) of this file. The permissions are</tt> </tt> +<a name="L233"></a><tt class="py-lineno">233</tt> <tt class="py-line"><tt class="py-docstring"> unix-style and identical to those used by python's C{os.chmod}</tt> </tt> +<a name="L234"></a><tt class="py-lineno">234</tt> <tt class="py-line"><tt class="py-docstring"> function.</tt> </tt> +<a name="L235"></a><tt class="py-lineno">235</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> +<a name="L236"></a><tt class="py-lineno">236</tt> <tt class="py-line"><tt class="py-docstring"> @param mode: new permissions</tt> </tt> +<a name="L237"></a><tt class="py-lineno">237</tt> <tt class="py-line"><tt class="py-docstring"> @type mode: int</tt> </tt> +<a name="L238"></a><tt class="py-lineno">238</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L239"></a><tt class="py-lineno">239</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-65" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-65', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_log</tt><tt class="py-op">(</tt><tt id="link-66" class="py-name"><a title="paramiko.auth_handler.DEBUG +paramiko.channel.DEBUG +paramiko.client.DEBUG +paramiko.common.DEBUG +paramiko.dsskey.DEBUG +paramiko.hostkeys.DEBUG +paramiko.kex_gex.DEBUG +paramiko.kex_group1.DEBUG +paramiko.logging22.DEBUG +paramiko.packet.DEBUG +paramiko.pkey.DEBUG +paramiko.rsakey.DEBUG +paramiko.server.DEBUG +paramiko.sftp.DEBUG +paramiko.sftp_attr.DEBUG +paramiko.sftp_client.DEBUG +paramiko.sftp_file.DEBUG +paramiko.sftp_handle.DEBUG +paramiko.sftp_server.DEBUG +paramiko.sftp_si.DEBUG +paramiko.transport.DEBUG +paramiko.util.DEBUG" class="py-name" href="#" onclick="return doclink('link-66', 'DEBUG', 'link-17');">DEBUG</a></tt><tt class="py-op">,</tt> <tt class="py-string">'chmod(%s, %r)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">hexlify</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">mode</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L240"></a><tt class="py-lineno">240</tt> <tt class="py-line"> <tt class="py-name">attr</tt> <tt class="py-op">=</tt> <tt id="link-67" class="py-name"><a title="paramiko.SFTPAttributes" class="py-name" href="#" onclick="return doclink('link-67', 'SFTPAttributes', 'link-9');">SFTPAttributes</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L241"></a><tt class="py-lineno">241</tt> <tt class="py-line"> <tt class="py-name">attr</tt><tt class="py-op">.</tt><tt class="py-name">st_mode</tt> <tt class="py-op">=</tt> <tt class="py-name">mode</tt> </tt> +<a name="L242"></a><tt class="py-lineno">242</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-68" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-68', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_request</tt><tt class="py-op">(</tt><tt id="link-69" class="py-name" targets="Variable paramiko.sftp.CMD_FSETSTAT=paramiko.sftp-module.html#CMD_FSETSTAT,Variable paramiko.sftp_attr.CMD_FSETSTAT=paramiko.sftp_attr-module.html#CMD_FSETSTAT,Variable paramiko.sftp_client.CMD_FSETSTAT=paramiko.sftp_client-module.html#CMD_FSETSTAT,Variable paramiko.sftp_file.CMD_FSETSTAT=paramiko.sftp_file-module.html#CMD_FSETSTAT,Variable paramiko.sftp_handle.CMD_FSETSTAT=paramiko.sftp_handle-module.html#CMD_FSETSTAT,Variable paramiko.sftp_server.CMD_FSETSTAT=paramiko.sftp_server-module.html#CMD_FSETSTAT,Variable paramiko.sftp_si.CMD_FSETSTAT=paramiko.sftp_si-module.html#CMD_FSETSTAT"><a title="paramiko.sftp.CMD_FSETSTAT +paramiko.sftp_attr.CMD_FSETSTAT +paramiko.sftp_client.CMD_FSETSTAT +paramiko.sftp_file.CMD_FSETSTAT +paramiko.sftp_handle.CMD_FSETSTAT +paramiko.sftp_server.CMD_FSETSTAT +paramiko.sftp_si.CMD_FSETSTAT" class="py-name" href="#" onclick="return doclink('link-69', 'CMD_FSETSTAT', 'link-69');">CMD_FSETSTAT</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">,</tt> <tt class="py-name">attr</tt><tt class="py-op">)</tt> </tt> +</div><a name="L243"></a><tt class="py-lineno">243</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.chown"></a><div id="SFTPFile.chown-def"><a name="L244"></a><tt class="py-lineno">244</tt> <a class="py-toggle" href="#" id="SFTPFile.chown-toggle" onclick="return toggle('SFTPFile.chown');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#chown">chown</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">uid</tt><tt class="py-op">,</tt> <tt class="py-param">gid</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.chown-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.chown-expanded"><a name="L245"></a><tt class="py-lineno">245</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L246"></a><tt class="py-lineno">246</tt> <tt class="py-line"><tt class="py-docstring"> Change the owner (C{uid}) and group (C{gid}) of this file. As with</tt> </tt> +<a name="L247"></a><tt class="py-lineno">247</tt> <tt class="py-line"><tt class="py-docstring"> python's C{os.chown} function, you must pass both arguments, so if you</tt> </tt> +<a name="L248"></a><tt class="py-lineno">248</tt> <tt class="py-line"><tt class="py-docstring"> only want to change one, use L{stat} first to retrieve the current</tt> </tt> +<a name="L249"></a><tt class="py-lineno">249</tt> <tt class="py-line"><tt class="py-docstring"> owner and group.</tt> </tt> +<a name="L250"></a><tt class="py-lineno">250</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> +<a name="L251"></a><tt class="py-lineno">251</tt> <tt class="py-line"><tt class="py-docstring"> @param uid: new owner's uid</tt> </tt> +<a name="L252"></a><tt class="py-lineno">252</tt> <tt class="py-line"><tt class="py-docstring"> @type uid: int</tt> </tt> +<a name="L253"></a><tt class="py-lineno">253</tt> <tt class="py-line"><tt class="py-docstring"> @param gid: new group id</tt> </tt> +<a name="L254"></a><tt class="py-lineno">254</tt> <tt class="py-line"><tt class="py-docstring"> @type gid: int</tt> </tt> +<a name="L255"></a><tt class="py-lineno">255</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L256"></a><tt class="py-lineno">256</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-70', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_log</tt><tt class="py-op">(</tt><tt id="link-71" class="py-name"><a title="paramiko.auth_handler.DEBUG +paramiko.channel.DEBUG +paramiko.client.DEBUG +paramiko.common.DEBUG +paramiko.dsskey.DEBUG +paramiko.hostkeys.DEBUG +paramiko.kex_gex.DEBUG +paramiko.kex_group1.DEBUG +paramiko.logging22.DEBUG +paramiko.packet.DEBUG +paramiko.pkey.DEBUG +paramiko.rsakey.DEBUG +paramiko.server.DEBUG +paramiko.sftp.DEBUG +paramiko.sftp_attr.DEBUG +paramiko.sftp_client.DEBUG +paramiko.sftp_file.DEBUG +paramiko.sftp_handle.DEBUG +paramiko.sftp_server.DEBUG +paramiko.sftp_si.DEBUG +paramiko.transport.DEBUG +paramiko.util.DEBUG" class="py-name" href="#" onclick="return doclink('link-71', 'DEBUG', 'link-17');">DEBUG</a></tt><tt class="py-op">,</tt> <tt class="py-string">'chown(%s, %r, %r)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">hexlify</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">uid</tt><tt class="py-op">,</tt> <tt class="py-name">gid</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L257"></a><tt class="py-lineno">257</tt> <tt class="py-line"> <tt class="py-name">attr</tt> <tt class="py-op">=</tt> <tt id="link-72" class="py-name"><a title="paramiko.SFTPAttributes" class="py-name" href="#" onclick="return doclink('link-72', 'SFTPAttributes', 'link-9');">SFTPAttributes</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L258"></a><tt class="py-lineno">258</tt> <tt class="py-line"> <tt class="py-name">attr</tt><tt class="py-op">.</tt><tt class="py-name">st_uid</tt><tt class="py-op">,</tt> <tt class="py-name">attr</tt><tt class="py-op">.</tt><tt class="py-name">st_gid</tt> <tt class="py-op">=</tt> <tt class="py-name">uid</tt><tt class="py-op">,</tt> <tt class="py-name">gid</tt> </tt> +<a name="L259"></a><tt class="py-lineno">259</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-73', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_request</tt><tt class="py-op">(</tt><tt id="link-74" class="py-name"><a title="paramiko.sftp.CMD_FSETSTAT +paramiko.sftp_attr.CMD_FSETSTAT +paramiko.sftp_client.CMD_FSETSTAT +paramiko.sftp_file.CMD_FSETSTAT +paramiko.sftp_handle.CMD_FSETSTAT +paramiko.sftp_server.CMD_FSETSTAT +paramiko.sftp_si.CMD_FSETSTAT" class="py-name" href="#" onclick="return doclink('link-74', 'CMD_FSETSTAT', 'link-69');">CMD_FSETSTAT</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">,</tt> <tt class="py-name">attr</tt><tt class="py-op">)</tt> </tt> +</div><a name="L260"></a><tt class="py-lineno">260</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.utime"></a><div id="SFTPFile.utime-def"><a name="L261"></a><tt class="py-lineno">261</tt> <a class="py-toggle" href="#" id="SFTPFile.utime-toggle" onclick="return toggle('SFTPFile.utime');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#utime">utime</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">times</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.utime-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.utime-expanded"><a name="L262"></a><tt class="py-lineno">262</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L263"></a><tt class="py-lineno">263</tt> <tt class="py-line"><tt class="py-docstring"> Set the access and modified times of this file. If</tt> </tt> +<a name="L264"></a><tt class="py-lineno">264</tt> <tt class="py-line"><tt class="py-docstring"> C{times} is C{None}, then the file's access and modified times are set</tt> </tt> +<a name="L265"></a><tt class="py-lineno">265</tt> <tt class="py-line"><tt class="py-docstring"> to the current time. Otherwise, C{times} must be a 2-tuple of numbers,</tt> </tt> +<a name="L266"></a><tt class="py-lineno">266</tt> <tt class="py-line"><tt class="py-docstring"> of the form C{(atime, mtime)}, which is used to set the access and</tt> </tt> +<a name="L267"></a><tt class="py-lineno">267</tt> <tt class="py-line"><tt class="py-docstring"> modified times, respectively. This bizarre API is mimicked from python</tt> </tt> +<a name="L268"></a><tt class="py-lineno">268</tt> <tt class="py-line"><tt class="py-docstring"> for the sake of consistency -- I apologize.</tt> </tt> +<a name="L269"></a><tt class="py-lineno">269</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> +<a name="L270"></a><tt class="py-lineno">270</tt> <tt class="py-line"><tt class="py-docstring"> @param times: C{None} or a tuple of (access time, modified time) in</tt> </tt> +<a name="L271"></a><tt class="py-lineno">271</tt> <tt class="py-line"><tt class="py-docstring"> standard internet epoch time (seconds since 01 January 1970 GMT)</tt> </tt> +<a name="L272"></a><tt class="py-lineno">272</tt> <tt class="py-line"><tt class="py-docstring"> @type times: tuple(int)</tt> </tt> +<a name="L273"></a><tt class="py-lineno">273</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L274"></a><tt class="py-lineno">274</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">times</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt> +<a name="L275"></a><tt class="py-lineno">275</tt> <tt class="py-line"> <tt class="py-name">times</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">time</tt><tt class="py-op">.</tt><tt class="py-name">time</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">time</tt><tt class="py-op">.</tt><tt class="py-name">time</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L276"></a><tt class="py-lineno">276</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-75" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-75', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_log</tt><tt class="py-op">(</tt><tt id="link-76" class="py-name"><a title="paramiko.auth_handler.DEBUG +paramiko.channel.DEBUG +paramiko.client.DEBUG +paramiko.common.DEBUG +paramiko.dsskey.DEBUG +paramiko.hostkeys.DEBUG +paramiko.kex_gex.DEBUG +paramiko.kex_group1.DEBUG +paramiko.logging22.DEBUG +paramiko.packet.DEBUG +paramiko.pkey.DEBUG +paramiko.rsakey.DEBUG +paramiko.server.DEBUG +paramiko.sftp.DEBUG +paramiko.sftp_attr.DEBUG +paramiko.sftp_client.DEBUG +paramiko.sftp_file.DEBUG +paramiko.sftp_handle.DEBUG +paramiko.sftp_server.DEBUG +paramiko.sftp_si.DEBUG +paramiko.transport.DEBUG +paramiko.util.DEBUG" class="py-name" href="#" onclick="return doclink('link-76', 'DEBUG', 'link-17');">DEBUG</a></tt><tt class="py-op">,</tt> <tt class="py-string">'utime(%s, %r)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">hexlify</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">times</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L277"></a><tt class="py-lineno">277</tt> <tt class="py-line"> <tt class="py-name">attr</tt> <tt class="py-op">=</tt> <tt id="link-77" class="py-name"><a title="paramiko.SFTPAttributes" class="py-name" href="#" onclick="return doclink('link-77', 'SFTPAttributes', 'link-9');">SFTPAttributes</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L278"></a><tt class="py-lineno">278</tt> <tt class="py-line"> <tt class="py-name">attr</tt><tt class="py-op">.</tt><tt class="py-name">st_atime</tt><tt class="py-op">,</tt> <tt class="py-name">attr</tt><tt class="py-op">.</tt><tt class="py-name">st_mtime</tt> <tt class="py-op">=</tt> <tt class="py-name">times</tt> </tt> +<a name="L279"></a><tt class="py-lineno">279</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-78', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_request</tt><tt class="py-op">(</tt><tt id="link-79" class="py-name"><a title="paramiko.sftp.CMD_FSETSTAT +paramiko.sftp_attr.CMD_FSETSTAT +paramiko.sftp_client.CMD_FSETSTAT +paramiko.sftp_file.CMD_FSETSTAT +paramiko.sftp_handle.CMD_FSETSTAT +paramiko.sftp_server.CMD_FSETSTAT +paramiko.sftp_si.CMD_FSETSTAT" class="py-name" href="#" onclick="return doclink('link-79', 'CMD_FSETSTAT', 'link-69');">CMD_FSETSTAT</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">,</tt> <tt class="py-name">attr</tt><tt class="py-op">)</tt> </tt> +</div><a name="L280"></a><tt class="py-lineno">280</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.truncate"></a><div id="SFTPFile.truncate-def"><a name="L281"></a><tt class="py-lineno">281</tt> <a class="py-toggle" href="#" id="SFTPFile.truncate-toggle" onclick="return toggle('SFTPFile.truncate');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#truncate">truncate</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">size</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.truncate-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.truncate-expanded"><a name="L282"></a><tt class="py-lineno">282</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L283"></a><tt class="py-lineno">283</tt> <tt class="py-line"><tt class="py-docstring"> Change the size of this file. This usually extends</tt> </tt> +<a name="L284"></a><tt class="py-lineno">284</tt> <tt class="py-line"><tt class="py-docstring"> or shrinks the size of the file, just like the C{truncate()} method on</tt> </tt> +<a name="L285"></a><tt class="py-lineno">285</tt> <tt class="py-line"><tt class="py-docstring"> python file objects.</tt> </tt> +<a name="L286"></a><tt class="py-lineno">286</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L287"></a><tt class="py-lineno">287</tt> <tt class="py-line"><tt class="py-docstring"> @param size: the new size of the file</tt> </tt> +<a name="L288"></a><tt class="py-lineno">288</tt> <tt class="py-line"><tt class="py-docstring"> @type size: int or long</tt> </tt> +<a name="L289"></a><tt class="py-lineno">289</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L290"></a><tt class="py-lineno">290</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-80', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_log</tt><tt class="py-op">(</tt><tt id="link-81" class="py-name"><a title="paramiko.auth_handler.DEBUG +paramiko.channel.DEBUG +paramiko.client.DEBUG +paramiko.common.DEBUG +paramiko.dsskey.DEBUG +paramiko.hostkeys.DEBUG +paramiko.kex_gex.DEBUG +paramiko.kex_group1.DEBUG +paramiko.logging22.DEBUG +paramiko.packet.DEBUG +paramiko.pkey.DEBUG +paramiko.rsakey.DEBUG +paramiko.server.DEBUG +paramiko.sftp.DEBUG +paramiko.sftp_attr.DEBUG +paramiko.sftp_client.DEBUG +paramiko.sftp_file.DEBUG +paramiko.sftp_handle.DEBUG +paramiko.sftp_server.DEBUG +paramiko.sftp_si.DEBUG +paramiko.transport.DEBUG +paramiko.util.DEBUG" class="py-name" href="#" onclick="return doclink('link-81', 'DEBUG', 'link-17');">DEBUG</a></tt><tt class="py-op">,</tt> <tt class="py-string">'truncate(%s, %r)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">hexlify</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">size</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L291"></a><tt class="py-lineno">291</tt> <tt class="py-line"> <tt class="py-name">attr</tt> <tt class="py-op">=</tt> <tt id="link-82" class="py-name"><a title="paramiko.SFTPAttributes" class="py-name" href="#" onclick="return doclink('link-82', 'SFTPAttributes', 'link-9');">SFTPAttributes</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L292"></a><tt class="py-lineno">292</tt> <tt class="py-line"> <tt class="py-name">attr</tt><tt class="py-op">.</tt><tt class="py-name">st_size</tt> <tt class="py-op">=</tt> <tt class="py-name">size</tt> </tt> +<a name="L293"></a><tt class="py-lineno">293</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-83', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_request</tt><tt class="py-op">(</tt><tt id="link-84" class="py-name"><a title="paramiko.sftp.CMD_FSETSTAT +paramiko.sftp_attr.CMD_FSETSTAT +paramiko.sftp_client.CMD_FSETSTAT +paramiko.sftp_file.CMD_FSETSTAT +paramiko.sftp_handle.CMD_FSETSTAT +paramiko.sftp_server.CMD_FSETSTAT +paramiko.sftp_si.CMD_FSETSTAT" class="py-name" href="#" onclick="return doclink('link-84', 'CMD_FSETSTAT', 'link-69');">CMD_FSETSTAT</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">,</tt> <tt class="py-name">attr</tt><tt class="py-op">)</tt> </tt> +</div><a name="L294"></a><tt class="py-lineno">294</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.check"></a><div id="SFTPFile.check-def"><a name="L295"></a><tt class="py-lineno">295</tt> <a class="py-toggle" href="#" id="SFTPFile.check-toggle" onclick="return toggle('SFTPFile.check');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#check">check</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">hash_algorithm</tt><tt class="py-op">,</tt> <tt class="py-param">offset</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-param">length</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-param">block_size</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.check-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.check-expanded"><a name="L296"></a><tt class="py-lineno">296</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L297"></a><tt class="py-lineno">297</tt> <tt class="py-line"><tt class="py-docstring"> Ask the server for a hash of a section of this file. This can be used</tt> </tt> +<a name="L298"></a><tt class="py-lineno">298</tt> <tt class="py-line"><tt class="py-docstring"> to verify a successful upload or download, or for various rsync-like</tt> </tt> +<a name="L299"></a><tt class="py-lineno">299</tt> <tt class="py-line"><tt class="py-docstring"> operations.</tt> </tt> +<a name="L300"></a><tt class="py-lineno">300</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L301"></a><tt class="py-lineno">301</tt> <tt class="py-line"><tt class="py-docstring"> The file is hashed from C{offset}, for C{length} bytes. If C{length}</tt> </tt> +<a name="L302"></a><tt class="py-lineno">302</tt> <tt class="py-line"><tt class="py-docstring"> is 0, the remainder of the file is hashed. Thus, if both C{offset}</tt> </tt> +<a name="L303"></a><tt class="py-lineno">303</tt> <tt class="py-line"><tt class="py-docstring"> and C{length} are zero, the entire file is hashed.</tt> </tt> +<a name="L304"></a><tt class="py-lineno">304</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L305"></a><tt class="py-lineno">305</tt> <tt class="py-line"><tt class="py-docstring"> Normally, C{block_size} will be 0 (the default), and this method will</tt> </tt> +<a name="L306"></a><tt class="py-lineno">306</tt> <tt class="py-line"><tt class="py-docstring"> return a byte string representing the requested hash (for example, a</tt> </tt> +<a name="L307"></a><tt class="py-lineno">307</tt> <tt class="py-line"><tt class="py-docstring"> string of length 16 for MD5, or 20 for SHA-1). If a non-zero</tt> </tt> +<a name="L308"></a><tt class="py-lineno">308</tt> <tt class="py-line"><tt class="py-docstring"> C{block_size} is given, each chunk of the file (from C{offset} to</tt> </tt> +<a name="L309"></a><tt class="py-lineno">309</tt> <tt class="py-line"><tt class="py-docstring"> C{offset + length}) of C{block_size} bytes is computed as a separate</tt> </tt> +<a name="L310"></a><tt class="py-lineno">310</tt> <tt class="py-line"><tt class="py-docstring"> hash. The hash results are all concatenated and returned as a single</tt> </tt> +<a name="L311"></a><tt class="py-lineno">311</tt> <tt class="py-line"><tt class="py-docstring"> string.</tt> </tt> +<a name="L312"></a><tt class="py-lineno">312</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L313"></a><tt class="py-lineno">313</tt> <tt class="py-line"><tt class="py-docstring"> For example, C{check('sha1', 0, 1024, 512)} will return a string of</tt> </tt> +<a name="L314"></a><tt class="py-lineno">314</tt> <tt class="py-line"><tt class="py-docstring"> length 40. The first 20 bytes will be the SHA-1 of the first 512 bytes</tt> </tt> +<a name="L315"></a><tt class="py-lineno">315</tt> <tt class="py-line"><tt class="py-docstring"> of the file, and the last 20 bytes will be the SHA-1 of the next 512</tt> </tt> +<a name="L316"></a><tt class="py-lineno">316</tt> <tt class="py-line"><tt class="py-docstring"> bytes.</tt> </tt> +<a name="L317"></a><tt class="py-lineno">317</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L318"></a><tt class="py-lineno">318</tt> <tt class="py-line"><tt class="py-docstring"> @param hash_algorithm: the name of the hash algorithm to use (normally</tt> </tt> +<a name="L319"></a><tt class="py-lineno">319</tt> <tt class="py-line"><tt class="py-docstring"> C{"sha1"} or C{"md5"})</tt> </tt> +<a name="L320"></a><tt class="py-lineno">320</tt> <tt class="py-line"><tt class="py-docstring"> @type hash_algorithm: str</tt> </tt> +<a name="L321"></a><tt class="py-lineno">321</tt> <tt class="py-line"><tt class="py-docstring"> @param offset: offset into the file to begin hashing (0 means to start</tt> </tt> +<a name="L322"></a><tt class="py-lineno">322</tt> <tt class="py-line"><tt class="py-docstring"> from the beginning)</tt> </tt> +<a name="L323"></a><tt class="py-lineno">323</tt> <tt class="py-line"><tt class="py-docstring"> @type offset: int or long</tt> </tt> +<a name="L324"></a><tt class="py-lineno">324</tt> <tt class="py-line"><tt class="py-docstring"> @param length: number of bytes to hash (0 means continue to the end of</tt> </tt> +<a name="L325"></a><tt class="py-lineno">325</tt> <tt class="py-line"><tt class="py-docstring"> the file)</tt> </tt> +<a name="L326"></a><tt class="py-lineno">326</tt> <tt class="py-line"><tt class="py-docstring"> @type length: int or long</tt> </tt> +<a name="L327"></a><tt class="py-lineno">327</tt> <tt class="py-line"><tt class="py-docstring"> @param block_size: number of bytes to hash per result (must not be less</tt> </tt> +<a name="L328"></a><tt class="py-lineno">328</tt> <tt class="py-line"><tt class="py-docstring"> than 256; 0 means to compute only one hash of the entire segment)</tt> </tt> +<a name="L329"></a><tt class="py-lineno">329</tt> <tt class="py-line"><tt class="py-docstring"> @type block_size: int</tt> </tt> +<a name="L330"></a><tt class="py-lineno">330</tt> <tt class="py-line"><tt class="py-docstring"> @return: string of bytes representing the hash of each block,</tt> </tt> +<a name="L331"></a><tt class="py-lineno">331</tt> <tt class="py-line"><tt class="py-docstring"> concatenated together</tt> </tt> +<a name="L332"></a><tt class="py-lineno">332</tt> <tt class="py-line"><tt class="py-docstring"> @rtype: str</tt> </tt> +<a name="L333"></a><tt class="py-lineno">333</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L334"></a><tt class="py-lineno">334</tt> <tt class="py-line"><tt class="py-docstring"> @note: Many (most?) servers don't support this extension yet.</tt> </tt> +<a name="L335"></a><tt class="py-lineno">335</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L336"></a><tt class="py-lineno">336</tt> <tt class="py-line"><tt class="py-docstring"> @raise IOError: if the server doesn't support the "check-file"</tt> </tt> +<a name="L337"></a><tt class="py-lineno">337</tt> <tt class="py-line"><tt class="py-docstring"> extension, or possibly doesn't support the hash algorithm</tt> </tt> +<a name="L338"></a><tt class="py-lineno">338</tt> <tt class="py-line"><tt class="py-docstring"> requested</tt> </tt> +<a name="L339"></a><tt class="py-lineno">339</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L340"></a><tt class="py-lineno">340</tt> <tt class="py-line"><tt class="py-docstring"> @since: 1.4</tt> </tt> +<a name="L341"></a><tt class="py-lineno">341</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L342"></a><tt class="py-lineno">342</tt> <tt class="py-line"> <tt class="py-name">t</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-85" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-85', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_request</tt><tt class="py-op">(</tt><tt id="link-86" class="py-name" targets="Variable paramiko.sftp.CMD_EXTENDED=paramiko.sftp-module.html#CMD_EXTENDED,Variable paramiko.sftp_attr.CMD_EXTENDED=paramiko.sftp_attr-module.html#CMD_EXTENDED,Variable paramiko.sftp_client.CMD_EXTENDED=paramiko.sftp_client-module.html#CMD_EXTENDED,Variable paramiko.sftp_file.CMD_EXTENDED=paramiko.sftp_file-module.html#CMD_EXTENDED,Variable paramiko.sftp_handle.CMD_EXTENDED=paramiko.sftp_handle-module.html#CMD_EXTENDED,Variable paramiko.sftp_server.CMD_EXTENDED=paramiko.sftp_server-module.html#CMD_EXTENDED,Variable paramiko.sftp_si.CMD_EXTENDED=paramiko.sftp_si-module.html#CMD_EXTENDED"><a title="paramiko.sftp.CMD_EXTENDED +paramiko.sftp_attr.CMD_EXTENDED +paramiko.sftp_client.CMD_EXTENDED +paramiko.sftp_file.CMD_EXTENDED +paramiko.sftp_handle.CMD_EXTENDED +paramiko.sftp_server.CMD_EXTENDED +paramiko.sftp_si.CMD_EXTENDED" class="py-name" href="#" onclick="return doclink('link-86', 'CMD_EXTENDED', 'link-86');">CMD_EXTENDED</a></tt><tt class="py-op">,</tt> <tt class="py-string">'check-file'</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">,</tt> </tt> +<a name="L343"></a><tt class="py-lineno">343</tt> <tt class="py-line"> <tt class="py-name">hash_algorithm</tt><tt class="py-op">,</tt> <tt class="py-name">long</tt><tt class="py-op">(</tt><tt class="py-name">offset</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">long</tt><tt class="py-op">(</tt><tt class="py-name">length</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">block_size</tt><tt class="py-op">)</tt> </tt> +<a name="L344"></a><tt class="py-lineno">344</tt> <tt class="py-line"> <tt class="py-name">ext</tt> <tt class="py-op">=</tt> <tt class="py-name">msg</tt><tt class="py-op">.</tt><tt id="link-87" class="py-name"><a title="paramiko.Message.get_string" class="py-name" href="#" onclick="return doclink('link-87', 'get_string', 'link-42');">get_string</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L345"></a><tt class="py-lineno">345</tt> <tt class="py-line"> <tt class="py-name">alg</tt> <tt class="py-op">=</tt> <tt class="py-name">msg</tt><tt class="py-op">.</tt><tt id="link-88" class="py-name"><a title="paramiko.Message.get_string" class="py-name" href="#" onclick="return doclink('link-88', 'get_string', 'link-42');">get_string</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L346"></a><tt class="py-lineno">346</tt> <tt class="py-line"> <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">msg</tt><tt class="py-op">.</tt><tt id="link-89" class="py-name" targets="Method paramiko.Message.get_remainder()=paramiko.Message-class.html#get_remainder"><a title="paramiko.Message.get_remainder" class="py-name" href="#" onclick="return doclink('link-89', 'get_remainder', 'link-89');">get_remainder</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L347"></a><tt class="py-lineno">347</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">data</tt> </tt> +</div><a name="L348"></a><tt class="py-lineno">348</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.set_pipelined"></a><div id="SFTPFile.set_pipelined-def"><a name="L349"></a><tt class="py-lineno">349</tt> <a class="py-toggle" href="#" id="SFTPFile.set_pipelined-toggle" onclick="return toggle('SFTPFile.set_pipelined');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#set_pipelined">set_pipelined</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">pipelined</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.set_pipelined-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.set_pipelined-expanded"><a name="L350"></a><tt class="py-lineno">350</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L351"></a><tt class="py-lineno">351</tt> <tt class="py-line"><tt class="py-docstring"> Turn on/off the pipelining of write operations to this file. When</tt> </tt> +<a name="L352"></a><tt class="py-lineno">352</tt> <tt class="py-line"><tt class="py-docstring"> pipelining is on, paramiko won't wait for the server response after</tt> </tt> +<a name="L353"></a><tt class="py-lineno">353</tt> <tt class="py-line"><tt class="py-docstring"> each write operation. Instead, they're collected as they come in.</tt> </tt> +<a name="L354"></a><tt class="py-lineno">354</tt> <tt class="py-line"><tt class="py-docstring"> At the first non-write operation (including L{close}), all remaining</tt> </tt> +<a name="L355"></a><tt class="py-lineno">355</tt> <tt class="py-line"><tt class="py-docstring"> server responses are collected. This means that if there was an error</tt> </tt> +<a name="L356"></a><tt class="py-lineno">356</tt> <tt class="py-line"><tt class="py-docstring"> with one of your later writes, an exception might be thrown from</tt> </tt> +<a name="L357"></a><tt class="py-lineno">357</tt> <tt class="py-line"><tt class="py-docstring"> within L{close} instead of L{write}.</tt> </tt> +<a name="L358"></a><tt class="py-lineno">358</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L359"></a><tt class="py-lineno">359</tt> <tt class="py-line"><tt class="py-docstring"> By default, files are I{not} pipelined.</tt> </tt> +<a name="L360"></a><tt class="py-lineno">360</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L361"></a><tt class="py-lineno">361</tt> <tt class="py-line"><tt class="py-docstring"> @param pipelined: C{True} if pipelining should be turned on for this</tt> </tt> +<a name="L362"></a><tt class="py-lineno">362</tt> <tt class="py-line"><tt class="py-docstring"> file; C{False} otherwise</tt> </tt> +<a name="L363"></a><tt class="py-lineno">363</tt> <tt class="py-line"><tt class="py-docstring"> @type pipelined: bool</tt> </tt> +<a name="L364"></a><tt class="py-lineno">364</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L365"></a><tt class="py-lineno">365</tt> <tt class="py-line"><tt class="py-docstring"> @since: 1.5</tt> </tt> +<a name="L366"></a><tt class="py-lineno">366</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L367"></a><tt class="py-lineno">367</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">pipelined</tt> <tt class="py-op">=</tt> <tt class="py-name">pipelined</tt> </tt> +</div><a name="L368"></a><tt class="py-lineno">368</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.prefetch"></a><div id="SFTPFile.prefetch-def"><a name="L369"></a><tt class="py-lineno">369</tt> <a class="py-toggle" href="#" id="SFTPFile.prefetch-toggle" onclick="return toggle('SFTPFile.prefetch');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#prefetch">prefetch</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.prefetch-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.prefetch-expanded"><a name="L370"></a><tt class="py-lineno">370</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L371"></a><tt class="py-lineno">371</tt> <tt class="py-line"><tt class="py-docstring"> Pre-fetch the remaining contents of this file in anticipation of</tt> </tt> +<a name="L372"></a><tt class="py-lineno">372</tt> <tt class="py-line"><tt class="py-docstring"> future L{read} calls. If reading the entire file, pre-fetching can</tt> </tt> +<a name="L373"></a><tt class="py-lineno">373</tt> <tt class="py-line"><tt class="py-docstring"> dramatically improve the download speed by avoiding roundtrip latency.</tt> </tt> +<a name="L374"></a><tt class="py-lineno">374</tt> <tt class="py-line"><tt class="py-docstring"> The file's contents are incrementally buffered in a background thread.</tt> </tt> +<a name="L375"></a><tt class="py-lineno">375</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L376"></a><tt class="py-lineno">376</tt> <tt class="py-line"><tt class="py-docstring"> The prefetched data is stored in a buffer until read via the L{read}</tt> </tt> +<a name="L377"></a><tt class="py-lineno">377</tt> <tt class="py-line"><tt class="py-docstring"> method. Once data has been read, it's removed from the buffer. The</tt> </tt> +<a name="L378"></a><tt class="py-lineno">378</tt> <tt class="py-line"><tt class="py-docstring"> data may be read in a random order (using L{seek}); chunks of the</tt> </tt> +<a name="L379"></a><tt class="py-lineno">379</tt> <tt class="py-line"><tt class="py-docstring"> buffer that haven't been read will continue to be buffered.</tt> </tt> +<a name="L380"></a><tt class="py-lineno">380</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt> +<a name="L381"></a><tt class="py-lineno">381</tt> <tt class="py-line"><tt class="py-docstring"> @since: 1.5.1</tt> </tt> +<a name="L382"></a><tt class="py-lineno">382</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L383"></a><tt class="py-lineno">383</tt> <tt class="py-line"> <tt class="py-name">size</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-90" class="py-name" targets="Method paramiko.SFTPClient.stat()=paramiko.SFTPClient-class.html#stat,Method paramiko.SFTPFile.stat()=paramiko.SFTPFile-class.html#stat,Method paramiko.SFTPHandle.stat()=paramiko.SFTPHandle-class.html#stat,Method paramiko.SFTPServerInterface.stat()=paramiko.SFTPServerInterface-class.html#stat"><a title="paramiko.SFTPClient.stat +paramiko.SFTPFile.stat +paramiko.SFTPHandle.stat +paramiko.SFTPServerInterface.stat" class="py-name" href="#" onclick="return doclink('link-90', 'stat', 'link-90');">stat</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">st_size</tt> </tt> +<a name="L384"></a><tt class="py-lineno">384</tt> <tt class="py-line"> <tt class="py-comment"># queue up async reads for the rest of the file</tt> </tt> +<a name="L385"></a><tt class="py-lineno">385</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-name">chunks</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt> +<a name="L386"></a><tt class="py-lineno">386</tt> <tt class="py-line"> <tt class="py-name">n</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_realpos</tt> </tt> +<a name="L387"></a><tt class="py-lineno">387</tt> <tt class="py-line"> <tt class="py-keyword">while</tt> <tt class="py-name">n</tt> <tt class="py-op"><</tt> <tt class="py-name">size</tt><tt class="py-op">:</tt> </tt> +<a name="L388"></a><tt class="py-lineno">388</tt> <tt class="py-line"> <tt class="py-name">chunk</tt> <tt class="py-op">=</tt> <tt class="py-name">min</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-91" class="py-name"><a title="paramiko.SFTPFile.MAX_REQUEST_SIZE" class="py-name" href="#" onclick="return doclink('link-91', 'MAX_REQUEST_SIZE', 'link-10');">MAX_REQUEST_SIZE</a></tt><tt class="py-op">,</tt> <tt class="py-name">size</tt> <tt class="py-op">-</tt> <tt class="py-name">n</tt><tt class="py-op">)</tt> </tt> +<a name="L389"></a><tt class="py-lineno">389</tt> <tt class="py-line"> <tt class="py-name">chunks</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">n</tt><tt class="py-op">,</tt> <tt class="py-name">chunk</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L390"></a><tt class="py-lineno">390</tt> <tt class="py-line"> <tt class="py-name">n</tt> <tt class="py-op">+=</tt> <tt class="py-name">chunk</tt> </tt> +<a name="L391"></a><tt class="py-lineno">391</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">chunks</tt><tt class="py-op">)</tt> <tt class="py-op">></tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt> +<a name="L392"></a><tt class="py-lineno">392</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_start_prefetch</tt><tt class="py-op">(</tt><tt class="py-name">chunks</tt><tt class="py-op">)</tt> </tt> +</div><a name="L393"></a><tt class="py-lineno">393</tt> <tt class="py-line"> </tt> +<a name="SFTPFile.readv"></a><div id="SFTPFile.readv-def"><a name="L394"></a><tt class="py-lineno">394</tt> <a class="py-toggle" href="#" id="SFTPFile.readv-toggle" onclick="return toggle('SFTPFile.readv');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#readv">readv</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">chunks</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile.readv-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile.readv-expanded"><a name="L395"></a><tt class="py-lineno">395</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt> +<a name="L396"></a><tt class="py-lineno">396</tt> <tt class="py-line"><tt class="py-docstring"> Read a set of blocks from the file by (offset, length). This is more</tt> </tt> +<a name="L397"></a><tt class="py-lineno">397</tt> <tt class="py-line"><tt class="py-docstring"> efficient than doing a series of L{seek} and L{read} calls, since the</tt> </tt> +<a name="L398"></a><tt class="py-lineno">398</tt> <tt class="py-line"><tt class="py-docstring"> prefetch machinery is used to retrieve all the requested blocks at</tt> </tt> +<a name="L399"></a><tt class="py-lineno">399</tt> <tt class="py-line"><tt class="py-docstring"> once.</tt> </tt> +<a name="L400"></a><tt class="py-lineno">400</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L401"></a><tt class="py-lineno">401</tt> <tt class="py-line"><tt class="py-docstring"> @param chunks: a list of (offset, length) tuples indicating which</tt> </tt> +<a name="L402"></a><tt class="py-lineno">402</tt> <tt class="py-line"><tt class="py-docstring"> sections of the file to read</tt> </tt> +<a name="L403"></a><tt class="py-lineno">403</tt> <tt class="py-line"><tt class="py-docstring"> @type chunks: list(tuple(long, int))</tt> </tt> +<a name="L404"></a><tt class="py-lineno">404</tt> <tt class="py-line"><tt class="py-docstring"> @return: a list of blocks read, in the same order as in C{chunks}</tt> </tt> +<a name="L405"></a><tt class="py-lineno">405</tt> <tt class="py-line"><tt class="py-docstring"> @rtype: list(str)</tt> </tt> +<a name="L406"></a><tt class="py-lineno">406</tt> <tt class="py-line"><tt class="py-docstring"> </tt> </tt> +<a name="L407"></a><tt class="py-lineno">407</tt> <tt class="py-line"><tt class="py-docstring"> @since: 1.5.4</tt> </tt> +<a name="L408"></a><tt class="py-lineno">408</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt> +<a name="L409"></a><tt class="py-lineno">409</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-92" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-92', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_log</tt><tt class="py-op">(</tt><tt id="link-93" class="py-name"><a title="paramiko.auth_handler.DEBUG +paramiko.channel.DEBUG +paramiko.client.DEBUG +paramiko.common.DEBUG +paramiko.dsskey.DEBUG +paramiko.hostkeys.DEBUG +paramiko.kex_gex.DEBUG +paramiko.kex_group1.DEBUG +paramiko.logging22.DEBUG +paramiko.packet.DEBUG +paramiko.pkey.DEBUG +paramiko.rsakey.DEBUG +paramiko.server.DEBUG +paramiko.sftp.DEBUG +paramiko.sftp_attr.DEBUG +paramiko.sftp_client.DEBUG +paramiko.sftp_file.DEBUG +paramiko.sftp_handle.DEBUG +paramiko.sftp_server.DEBUG +paramiko.sftp_si.DEBUG +paramiko.transport.DEBUG +paramiko.util.DEBUG" class="py-name" href="#" onclick="return doclink('link-93', 'DEBUG', 'link-17');">DEBUG</a></tt><tt class="py-op">,</tt> <tt class="py-string">'readv(%s, %r)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">hexlify</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">chunks</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L410"></a><tt class="py-lineno">410</tt> <tt class="py-line"> </tt> +<a name="L411"></a><tt class="py-lineno">411</tt> <tt class="py-line"> <tt class="py-name">read_chunks</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt> +<a name="L412"></a><tt class="py-lineno">412</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">offset</tt><tt class="py-op">,</tt> <tt class="py-name">size</tt> <tt class="py-keyword">in</tt> <tt class="py-name">chunks</tt><tt class="py-op">:</tt> </tt> +<a name="L413"></a><tt class="py-lineno">413</tt> <tt class="py-line"> <tt class="py-comment"># don't fetch data that's already in the prefetch buffer</tt> </tt> +<a name="L414"></a><tt class="py-lineno">414</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_data_in_prefetch_buffers</tt><tt class="py-op">(</tt><tt class="py-name">offset</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_data_in_prefetch_requests</tt><tt class="py-op">(</tt><tt class="py-name">offset</tt><tt class="py-op">,</tt> <tt class="py-name">size</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +<a name="L415"></a><tt class="py-lineno">415</tt> <tt class="py-line"> <tt class="py-keyword">continue</tt> </tt> +<a name="L416"></a><tt class="py-lineno">416</tt> <tt class="py-line"> </tt> +<a name="L417"></a><tt class="py-lineno">417</tt> <tt class="py-line"> <tt class="py-comment"># break up anything larger than the max read size</tt> </tt> +<a name="L418"></a><tt class="py-lineno">418</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">while</tt> <tt class="py-name">size</tt> <tt class="py-op">></tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt> +<a name="L419"></a><tt class="py-lineno">419</tt> <tt class="py-line"> <tt class="py-name">chunk_size</tt> <tt class="py-op">=</tt> <tt class="py-name">min</tt><tt class="py-op">(</tt><tt class="py-name">size</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-94" class="py-name"><a title="paramiko.SFTPFile.MAX_REQUEST_SIZE" class="py-name" href="#" onclick="return doclink('link-94', 'MAX_REQUEST_SIZE', 'link-10');">MAX_REQUEST_SIZE</a></tt><tt class="py-op">)</tt> </tt> +<a name="L420"></a><tt class="py-lineno">420</tt> <tt class="py-line"> <tt class="py-name">read_chunks</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">offset</tt><tt class="py-op">,</tt> <tt class="py-name">chunk_size</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L421"></a><tt class="py-lineno">421</tt> <tt class="py-line"> <tt class="py-name">offset</tt> <tt class="py-op">+=</tt> <tt class="py-name">chunk_size</tt> </tt> +<a name="L422"></a><tt class="py-lineno">422</tt> <tt class="py-line"> <tt class="py-name">size</tt> <tt class="py-op">-=</tt> <tt class="py-name">chunk_size</tt> </tt> +<a name="L423"></a><tt class="py-lineno">423</tt> <tt class="py-line"> </tt> +<a name="L424"></a><tt class="py-lineno">424</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_start_prefetch</tt><tt class="py-op">(</tt><tt class="py-name">read_chunks</tt><tt class="py-op">)</tt> </tt> +<a name="L425"></a><tt class="py-lineno">425</tt> <tt class="py-line"> <tt class="py-comment"># now we can just devolve to a bunch of read()s :)</tt> </tt> +<a name="L426"></a><tt class="py-lineno">426</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">for</tt> <tt class="py-name">x</tt> <tt class="py-keyword">in</tt> <tt class="py-name">chunks</tt><tt class="py-op">:</tt> </tt> +<a name="L427"></a><tt class="py-lineno">427</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-95" class="py-name" targets="Method paramiko.BufferedFile.seek()=paramiko.BufferedFile-class.html#seek,Method paramiko.SFTPFile.seek()=paramiko.SFTPFile-class.html#seek"><a title="paramiko.BufferedFile.seek +paramiko.SFTPFile.seek" class="py-name" href="#" onclick="return doclink('link-95', 'seek', 'link-95');">seek</a></tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt> +<a name="L428"></a><tt class="py-lineno">428</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-96" class="py-name" targets="Method paramiko.BufferedFile.read()=paramiko.BufferedFile-class.html#read,Method paramiko.SFTPHandle.read()=paramiko.SFTPHandle-class.html#read,Method paramiko.buffered_pipe.BufferedPipe.read()=paramiko.buffered_pipe.BufferedPipe-class.html#read"><a title="paramiko.BufferedFile.read +paramiko.SFTPHandle.read +paramiko.buffered_pipe.BufferedPipe.read" class="py-name" href="#" onclick="return doclink('link-96', 'read', 'link-96');">read</a></tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt> +</div><a name="L429"></a><tt class="py-lineno">429</tt> <tt class="py-line"> </tt> +<a name="L430"></a><tt class="py-lineno">430</tt> <tt class="py-line"> </tt> +<a name="L431"></a><tt class="py-lineno">431</tt> <tt class="py-line"> <tt class="py-comment">### internals...</tt> </tt> +<a name="L432"></a><tt class="py-lineno">432</tt> <tt class="py-line"><tt class="py-comment"></tt> </tt> +<a name="L433"></a><tt class="py-lineno">433</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._get_size"></a><div id="SFTPFile._get_size-def"><a name="L434"></a><tt class="py-lineno">434</tt> <a class="py-toggle" href="#" id="SFTPFile._get_size-toggle" onclick="return toggle('SFTPFile._get_size');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_get_size">_get_size</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._get_size-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._get_size-expanded"><a name="L435"></a><tt class="py-lineno">435</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt> +<a name="L436"></a><tt class="py-lineno">436</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-97" class="py-name"><a title="paramiko.SFTPClient.stat +paramiko.SFTPFile.stat +paramiko.SFTPHandle.stat +paramiko.SFTPServerInterface.stat" class="py-name" href="#" onclick="return doclink('link-97', 'stat', 'link-90');">stat</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">st_size</tt> </tt> +<a name="L437"></a><tt class="py-lineno">437</tt> <tt class="py-line"> <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt> +<a name="L438"></a><tt class="py-lineno">438</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-number">0</tt> </tt> +</div><a name="L439"></a><tt class="py-lineno">439</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._start_prefetch"></a><div id="SFTPFile._start_prefetch-def"><a name="L440"></a><tt class="py-lineno">440</tt> <a class="py-toggle" href="#" id="SFTPFile._start_prefetch-toggle" onclick="return toggle('SFTPFile._start_prefetch');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_start_prefetch">_start_prefetch</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">chunks</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._start_prefetch-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._start_prefetch-expanded"><a name="L441"></a><tt class="py-lineno">441</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetching</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt> +<a name="L442"></a><tt class="py-lineno">442</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_done</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt> +<a name="L443"></a><tt class="py-lineno">443</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_reads</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">chunks</tt><tt class="py-op">)</tt> </tt> +<a name="L444"></a><tt class="py-lineno">444</tt> <tt class="py-line"> </tt> +<a name="L445"></a><tt class="py-lineno">445</tt> <tt class="py-line"> <tt class="py-name">t</tt> <tt class="py-op">=</tt> <tt class="py-name">threading</tt><tt class="py-op">.</tt><tt class="py-name">Thread</tt><tt class="py-op">(</tt><tt class="py-name">target</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_thread</tt><tt class="py-op">,</tt> <tt class="py-name">args</tt><tt class="py-op">=</tt><tt class="py-op">(</tt><tt class="py-name">chunks</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +<a name="L446"></a><tt class="py-lineno">446</tt> <tt class="py-line"> <tt class="py-name">t</tt><tt class="py-op">.</tt><tt class="py-name">setDaemon</tt><tt class="py-op">(</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt> +<a name="L447"></a><tt class="py-lineno">447</tt> <tt class="py-line"> <tt class="py-name">t</tt><tt class="py-op">.</tt><tt class="py-name">start</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +</div><a name="L448"></a><tt class="py-lineno">448</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._prefetch_thread"></a><div id="SFTPFile._prefetch_thread-def"><a name="L449"></a><tt class="py-lineno">449</tt> <a class="py-toggle" href="#" id="SFTPFile._prefetch_thread-toggle" onclick="return toggle('SFTPFile._prefetch_thread');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_prefetch_thread">_prefetch_thread</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">chunks</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._prefetch_thread-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._prefetch_thread-expanded"><a name="L450"></a><tt class="py-lineno">450</tt> <tt class="py-line"> <tt class="py-comment"># do these read requests in a temporary thread because there may be</tt> </tt> +<a name="L451"></a><tt class="py-lineno">451</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># a lot of them, so it may block.</tt> </tt> +<a name="L452"></a><tt class="py-lineno">452</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">for</tt> <tt class="py-name">offset</tt><tt class="py-op">,</tt> <tt class="py-name">length</tt> <tt class="py-keyword">in</tt> <tt class="py-name">chunks</tt><tt class="py-op">:</tt> </tt> +<a name="L453"></a><tt class="py-lineno">453</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-98" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-98', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_async_request</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt id="link-99" class="py-name"><a title="paramiko.sftp.CMD_READ +paramiko.sftp_attr.CMD_READ +paramiko.sftp_client.CMD_READ +paramiko.sftp_file.CMD_READ +paramiko.sftp_handle.CMD_READ +paramiko.sftp_server.CMD_READ +paramiko.sftp_si.CMD_READ" class="py-name" href="#" onclick="return doclink('link-99', 'CMD_READ', 'link-39');">CMD_READ</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">,</tt> <tt class="py-name">long</tt><tt class="py-op">(</tt><tt class="py-name">offset</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">length</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt> +</div><a name="L454"></a><tt class="py-lineno">454</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._async_response"></a><div id="SFTPFile._async_response-def"><a name="L455"></a><tt class="py-lineno">455</tt> <a class="py-toggle" href="#" id="SFTPFile._async_response-toggle" onclick="return toggle('SFTPFile._async_response');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_async_response">_async_response</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">t</tt><tt class="py-op">,</tt> <tt class="py-param">msg</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._async_response-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._async_response-expanded"><a name="L456"></a><tt class="py-lineno">456</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">t</tt> <tt class="py-op">==</tt> <tt id="link-100" class="py-name"><a title="paramiko.sftp.CMD_STATUS +paramiko.sftp_attr.CMD_STATUS +paramiko.sftp_client.CMD_STATUS +paramiko.sftp_file.CMD_STATUS +paramiko.sftp_handle.CMD_STATUS +paramiko.sftp_server.CMD_STATUS +paramiko.sftp_si.CMD_STATUS" class="py-name" href="#" onclick="return doclink('link-100', 'CMD_STATUS', 'link-49');">CMD_STATUS</a></tt><tt class="py-op">:</tt> </tt> +<a name="L457"></a><tt class="py-lineno">457</tt> <tt class="py-line"> <tt class="py-comment"># save exception and re-raise it on next file operation</tt> </tt> +<a name="L458"></a><tt class="py-lineno">458</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt> +<a name="L459"></a><tt class="py-lineno">459</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-101" class="py-name"><a title="paramiko.sftp" class="py-name" href="#" onclick="return doclink('link-101', 'sftp', 'link-3');">sftp</a></tt><tt class="py-op">.</tt><tt class="py-name">_convert_status</tt><tt class="py-op">(</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt> +<a name="L460"></a><tt class="py-lineno">460</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt><tt class="py-op">,</tt> <tt class="py-name">x</tt><tt class="py-op">:</tt> </tt> +<a name="L461"></a><tt class="py-lineno">461</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_saved_exception</tt> <tt class="py-op">=</tt> <tt class="py-name">x</tt> </tt> +<a name="L462"></a><tt class="py-lineno">462</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> </tt> +<a name="L463"></a><tt class="py-lineno">463</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">t</tt> <tt class="py-op">!=</tt> <tt id="link-102" class="py-name"><a title="paramiko.sftp.CMD_DATA +paramiko.sftp_attr.CMD_DATA +paramiko.sftp_client.CMD_DATA +paramiko.sftp_file.CMD_DATA +paramiko.sftp_handle.CMD_DATA +paramiko.sftp_server.CMD_DATA +paramiko.sftp_si.CMD_DATA" class="py-name" href="#" onclick="return doclink('link-102', 'CMD_DATA', 'link-40');">CMD_DATA</a></tt><tt class="py-op">:</tt> </tt> +<a name="L464"></a><tt class="py-lineno">464</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt id="link-103" class="py-name"><a title="paramiko.SFTPError" class="py-name" href="#" onclick="return doclink('link-103', 'SFTPError', 'link-41');">SFTPError</a></tt><tt class="py-op">(</tt><tt class="py-string">'Expected data'</tt><tt class="py-op">)</tt> </tt> +<a name="L465"></a><tt class="py-lineno">465</tt> <tt class="py-line"> <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">msg</tt><tt class="py-op">.</tt><tt id="link-104" class="py-name"><a title="paramiko.Message.get_string" class="py-name" href="#" onclick="return doclink('link-104', 'get_string', 'link-42');">get_string</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> +<a name="L466"></a><tt class="py-lineno">466</tt> <tt class="py-line"> <tt class="py-name">offset</tt><tt class="py-op">,</tt> <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_reads</tt><tt class="py-op">.</tt><tt class="py-name">pop</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">)</tt> </tt> +<a name="L467"></a><tt class="py-lineno">467</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_data</tt><tt class="py-op">[</tt><tt class="py-name">offset</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">data</tt> </tt> +<a name="L468"></a><tt class="py-lineno">468</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_reads</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt> +<a name="L469"></a><tt class="py-lineno">469</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_prefetch_done</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt> +</div><a name="L470"></a><tt class="py-lineno">470</tt> <tt class="py-line"> </tt> +<a name="SFTPFile._check_exception"></a><div id="SFTPFile._check_exception-def"><a name="L471"></a><tt class="py-lineno">471</tt> <a class="py-toggle" href="#" id="SFTPFile._check_exception-toggle" onclick="return toggle('SFTPFile._check_exception');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="paramiko.sftp_file.SFTPFile-class.html#_check_exception">_check_exception</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> +</div><div id="SFTPFile._check_exception-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SFTPFile._check_exception-expanded"><a name="L472"></a><tt class="py-lineno">472</tt> <tt class="py-line"> <tt class="py-docstring">"if there's a saved exception, raise & clear it"</tt> </tt> +<a name="L473"></a><tt class="py-lineno">473</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_saved_exception</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt> +<a name="L474"></a><tt class="py-lineno">474</tt> <tt class="py-line"> <tt class="py-name">x</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_saved_exception</tt> </tt> +<a name="L475"></a><tt class="py-lineno">475</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_saved_exception</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt> +<a name="L476"></a><tt class="py-lineno">476</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">x</tt> </tt> +</div></div><a name="L477"></a><tt class="py-lineno">477</tt> <tt class="py-line"> </tt><script type="text/javascript"> +<!-- +expandto(location.href); +// --> +</script> +</pre> +<br /> +<!-- ==================== NAVIGATION BAR ==================== --> +<table class="navbar" border="0" width="100%" cellpadding="0" + bgcolor="#a0c0ff" cellspacing="0"> + <tr valign="middle"> + <!-- Home link --> + <th> <a + href="paramiko-module.html">Home</a> </th> + + <!-- Tree link --> + <th> <a + href="module-tree.html">Trees</a> </th> + + <!-- Index link --> + <th> <a + href="identifier-index.html">Indices</a> </th> + + <!-- Help link --> + <th> <a + href="help.html">Help</a> </th> + + <th class="navbar" width="100%"></th> + </tr> +</table> +<table border="0" cellpadding="0" cellspacing="0" width="100%%"> + <tr> + <td align="left" class="footer"> + Generated by Epydoc 3.0.1 on Sun Jul 6 18:30:36 2008 + </td> + <td align="right" class="footer"> + <a target="mainFrame" href="http://epydoc.sourceforge.net" + >http://epydoc.sourceforge.net</a> + </td> + </tr> +</table> + +<script type="text/javascript"> + <!-- + // Private objects are initially displayed (because if + // javascript is turned off then we want them to be + // visible); but by default, we want to hide them. So hide + // them unless we have a cookie that says to show them. + checkCookie(); + // --> +</script> +</body> +</html> |