%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/
Upload File :
Create Path :
Current File : //opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyc

�
��Abc@szddlmZmZmZmZmZddlmZmZm	Z	m
Z
mZddlm
Z
de
fd��YZdS(i����(tlinefeed_byte_valuetcrlftcr_bytet
linefeed_bytet
cr_byte_value(tBytesIOtPY2tutbytes_typest	text_type(tClosingContextManagertBufferedFilecBs[eZdZdZdZdZdZdZdZdZ	dZ
dZdZd	Z
d
�Zd�Zd�Zd
�Zd�Zer�d�Zn	d�Zd�Zd�Zd�Zd�Zd&d�Zd&d�Zd&d�Zdd�Zd�Zd�Z d�Z!d�Z"e#d��Z$d�Z%d�Z&d �Z'd!d"d#�Z(d$�Z)d%�Z*RS('sc
    Reusable base class to implement Python-style file buffering around a
    simpler stream.
    i iiiiii i@i�cCsed|_d|_|j|_t�|_t�|_t	|_
t	|_d|_|_
d|_dS(Ni(tNonetnewlinest_flagst_DEFAULT_BUFSIZEt_bufsizeRt_wbuffertbytest_rbuffertFalset_at_trailing_crt_closedt_post_realpost_size(tself((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt__init__2s				cCs|j�dS(N(tclose(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt__del__AscCs|jrtd��n|S(s�
        Returns an iterator that can be used to iterate over the lines in this
        file.  This iterator happens to return the file itself, since a file is
        its own iterator.

        :raises: ``ValueError`` -- if the file is closed.
        sI/O operation on closed file(Rt
ValueError(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt__iter__Ds	cCs|j�t|_dS(sN
        Close the file.  Future read and write operations will fail.
        N(tflushtTrueR(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyRPs
cCs&|j|jj��t�|_dS(s{
        Write out any data in the write buffer.  This may do nothing if write
        buffering is not turned on.
        N(t
_write_allRtgetvalueR(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyR WscCs|j�}|st�n|S(s\
            Returns the next line from the input, or raises
            ``StopIteration`` when EOF is hit.  Unlike Python file
            objects, it's okay to mix calls to `next` and `readline`.

            :raises: ``StopIteration`` -- when the end of the file is reached.

            :returns: a line (`str`) read from the file.
            (treadlinet
StopIteration(Rtline((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pytnextbs
	cCs|j�}|st�n|S(s^
            Returns the next line from the input, or raises ``StopIteration``
            when EOF is hit.  Unlike python file objects, it's okay to mix
            calls to `.next` and `.readline`.

            :raises: ``StopIteration`` -- when the end of the file is reached.

            :returns: a line (`str`) read from the file.
            (R$R%(RR&((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt__next__ss
	cCs|j|j@|jkS(s�
        Check if the file can be read from.

        :returns:
            `True` if the file can be read from. If `False`, `read` will raise
            an exception.
        (Rt	FLAG_READ(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pytreadable�scCs|j|j@|jkS(s�
        Check if the file can be written to.

        :returns:
            `True` if the file can be written to. If `False`, `write` will
            raise an exception.
        (Rt
FLAG_WRITE(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pytwritable�scCstS(s�
        Check if the file supports random access.

        :returns:
            `True` if the file supports random access. If `False`, `seek` will
            raise an exception.
        (R(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pytseekable�scCs/|jt|��}||t|�*t|�S(s�
        Read up to ``len(buff)`` bytes into ``bytearray`` *buff* and return the
        number of bytes read.

        :returns:
            The number of bytes read.
        (treadtlen(Rtbufftdata((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pytreadinto�scCsg|jrtd��n|j|j@s7td��n|dksO|dkrt|j�}t�|_|jt	|�7_x�t
ry|j|j�}Wnt
k
r�d}nX|dks�t	|�dkr�Pn|j|�|jt	|�7_|jt	|�7_q�Wt|�S|t	|j�krj|j| }|j||_|jt	|�7_|Sx�t	|j�|kr0|t	|j�}|j|j@r�t|j|�}ny|j|�}Wnt
k
r�d}nX|dkst	|�dkr	Pn|j|7_|jt	|�7_qmW|j| }|j||_|jt	|�7_|S(s�
        Read at most ``size`` bytes from the file (less if we hit the end of
        the file first).  If the ``size`` argument is negative or omitted,
        read all the remaining data in the file.

        .. note::
            ``'b'`` mode flag is ignored (``self.FLAG_BINARY`` in
            ``self._flags``), because SSH treats all files as binary, since we
            have no idea what encoding the file is in, or even if the file is
            text data.

        :param int size: maximum number of bytes to read
        :returns:
            data read from the file (as bytes), or an empty string if EOF was
            encountered immediately
        sFile is closedsFile is not open for readingiN(RtIOErrorRR)Rt	bytearrayRRRR/R!t_readRtEOFErrortextendRt
FLAG_BUFFEREDtmaxR(Rtsizetresulttnew_datat	read_size((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyR.�sP		







c
Cs�|jrtd��n|j|j@s7td��n|j}t}x�tr�|jr�|j|j@r�t	|�dkr�|dt
kr�|d}|jt�n
|jt
�t|_n|dk	r|dkrt	|�|kr|||_|| }t}Pn|t	|�}n	|j}t|ksL|j|j@rPt
|krPPny|j|�}Wntk
r|d}nX|dks�t	|�dkr�t�|_|jt	|�7_|j|j@r�|St|�S||7}|jt	|�7_qIW|jt�}|j|j@r[|jt
�}|dkr[||ksO|dkr[|}q[n|dkr�|jt	|�7_|j|j@r�|St|�S|d}||tkr�|t	|�kr�||t
kr�|d7}n|r|||j|_n
|||_|||!}	|| t}t	|j�dkrU|	t
krUt|_n
|j|	�|jt	|�7_|j|j@r�|St|�S(s�
        Read one entire line from the file.  A trailing newline character is
        kept in the string (but may be absent when a file ends with an
        incomplete line).  If the size argument is present and non-negative, it
        is a maximum byte count (including the trailing newline) and an
        incomplete line may be returned.  An empty string is returned only when
        EOF is encountered immediately.

        .. note::
            Unlike stdio's ``fgets``, the returned string contains null
            characters (``'\0'``) if they occurred in the input.

        :param int size: maximum length of returned string.
        :returns:
            next line of the file, or an empty string if the end of the
            file has been reached.

            If the file was opened in binary (``'b'``) mode: bytes are returned
            Else: the encoding of the file is assumed to be UTF-8 and character
            strings (`str`) are returned
        sFile is closedsFile not open for readingiii����N(RR3RR)RRR!RtFLAG_UNIVERSAL_NEWLINER/Rt_record_newlineRRRRRR5R6RRtFLAG_BINARYRRtfindR(
RR:R&t	truncatedtnR<tpostrpostxpostlf((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyR$�sv				



	


$



!
cCsxg}d}xetrs|j�}t|�dkr7Pn|j|�|t|�7}|dk	r||krPqqW|S(s�
        Read all remaining lines using `readline` and return them as a list.
        If the optional ``sizehint`` argument is present, instead of reading up
        to EOF, whole lines totalling approximately sizehint bytes (possibly
        after rounding up to an internal buffer size) are read.

        :param int sizehint: desired maximum number of bytes to read.
        :returns: list of lines read from the file.
        iN(R!R$R/tappendR(Rtsizehinttlinest
byte_countR&((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt	readlinesPs
	
cCstd��dS(s�
        Set the file's current position, like stdio's ``fseek``.  Not all file
        objects support seeking.

        .. note::
            If a file is opened in append mode (``'a'`` or ``'a+'``), any seek
            operations will be undone at the next write (as the file position
            will move back to the end of the file).

        :param int offset:
            position to move to within the file, relative to ``whence``.
        :param int whence:
            type of movement: 0 = absolute; 1 = relative to the current
            position; 2 = relative to the end of the file.

        :raises: ``IOError`` -- if the file doesn't support random access.
        sFile does not support seeking.N(R3(Rtoffsettwhence((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pytseekfscCs|jS(s�
        Return the file's current position.  This may not be accurate or
        useful if the underlying file doesn't support random access, or was
        opened in append mode.

        :returns: file position (`number <int>` of bytes).
        (R(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyttellzscCsFt|t�r!|jd�}n|jr9td��n|j|j@sXtd��n|j|j@sy|j|�dS|j	j
|�|j|j@r|jt
�}|dkr|j	j�}|t|�t|�7}|j||d �t�|_	|j	j
||d�ndS|j	j�|jkrB|j�ndS(s8
        Write data to the file.  If write buffering is on (``bufsize`` was
        specified and non-zero), some or all of the data may not actually be
        written yet.  (Use `flush` or `close` to force buffered data to be
        written out.)

        :param data: ``str``/``bytes`` data to write
        sutf-8sFile is closedsFile not open for writingNii(t
isinstanceR	tencodeRR3RR+R8R"RtwritetFLAG_LINE_BUFFEREDtrfindRR#R/RRPRR (RR1tlast_newline_postwbuf((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyRS�s,		

cCs"x|D]}|j|�qWdS(s?
        Write a sequence of strings to the file.  The sequence can be any
        iterable object producing strings, typically a list of strings.  (The
        name is intended to match `readlines`; `writelines` does not add line
        separators.)

        :param sequence: an iterable sequence of strings.
        N(RS(RtsequenceR&((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt
writelines�s	
cCs|S(s
        Identical to ``iter(f)``.  This is a deprecated file interface that
        predates Python iterator support.
        ((R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt
xreadlines�scCs|jS(N(R(R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pytclosed�scCs
t��dS(s�
        (subclass override)
        Read data from the stream.  Return ``None`` or raise ``EOFError`` to
        indicate EOF.
        N(R6(RR:((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyR5�scCstd��dS(sI
        (subclass override)
        Write data into the stream.
        swrite not implementedN(R3(RR1((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt_write�scCsdS(si
        (subclass override)
        Return the size of the file.  This is called from within `_set_mode`
        if the file is opened in append mode, so the file position can be
        tracked and `seek` and `tell` will work correctly.  If the file is
        a stream that can't be randomly accessed, you don't need to override
        this method,
        i((R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt	_get_size�s	tri����cCs�|j|_|dkr!d}n|dkrI|j|j|jBO_nf|dkr�||_|j|jO_|j|jM_n)|dkr�|j|j|jBM_nd|ks�d|kr�|j|jO_nd|ks�d|kr	|j|jO_nd|krS|j|j|jBO_|j�|_	|j	|_
|_nd|krt|j|jO_nd|kr�|j|j
O_d	|_nd	S(
sM
        Subclasses call this method to initialize the BufferedFile.
        iiR^t+twtatbtUN(RRRR8RTR)R+tFLAG_APPENDR]RRRR@R>RR
(Rtmodetbufsize((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt	_set_mode�s0		cCs�t|�}x�t|�dkr�|j|�}||}|j|j@ro|j|7_|j|_|_q|j|7_|j|7_qWdS(Ni(	t
memoryviewR/R\RRdRRRR(Rtraw_dataR1tcount((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyR"s
cCs�|j|j@sdS|jdkr/||_nZ|j|kret|jt�re|j|f|_n$||jkr�|j|f7_ndS(N(RR>R
RRQR(Rtnewline((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyR?sN(+t__name__t
__module__t__doc__RtSEEK_SETtSEEK_CURtSEEK_ENDR)R+RdR@R8RTR>RRRRR RR'R(R*R,R-R2RR.R$RLRORPRSRYRZtpropertyR[R5R\R]RgR"R?(((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyRsN								
	
	
	;i	
	$	
				
(	N(tparamiko.commonRRRRRtparamiko.py3compatRRRRR	t
paramiko.utilR
R(((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/file.pyt<module>s((

Zerion Mini Shell 1.0