%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/paramiko/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/paramiko/__pycache__/file.cpython-312.pyc

�

�ec�L��^�ddlmZmZmZmZmZddlmZmZm	Z	m
Z
mZddlm
Z
Gd�de
�Zy)�)�linefeed_byte_value�crlf�cr_byte�
linefeed_byte�
cr_byte_value)�BytesIO�PY2�u�bytes_types�	text_type)�ClosingContextManagerc���eZdZdZdZdZdZdZdZdZ	dZ
dZdZd	Z
d
Zd�Zd�Zd
�Zd�Zd�Zerd�Znd�Zd�Zd�Zd�Zd�Zd&d�Zd&d�Zd&d�Zd'd�Zd�Zd�Z d�Z!d�Z"e#d��Z$d �Z%d!�Z&d"�Z'd(d#�Z(d$�Z)d%�Z*y))�BufferedFilezc
    Reusable base class to implement Python-style file buffering around a
    simpler stream.
    i r����� �@�c���d|_d|_|j|_t	�|_t
�|_d|_d|_	dx|_
|_d|_y)NrF)
�newlines�_flags�_DEFAULT_BUFSIZE�_bufsizer�_wbuffer�bytes�_rbuffer�_at_trailing_cr�_closed�_pos�_realpos�_size��selfs �//usr/lib/python3/dist-packages/paramiko/file.py�__init__zBufferedFile.__init__2sU����
�����-�-��
��	��
����
�$������%&�%��	�D�M���
�c�$�|j�y�N)�closer$s r&�__del__zBufferedFile.__del__As���
�
�r(c�4�|jrtd��|S)z�
        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.
        zI/O operation on closed file)r �
ValueErrorr$s r&�__iter__zBufferedFile.__iter__Ds���<�<��;�<�<��r(c�2�|j�d|_y)zN
        Close the file.  Future read and write operations will fail.
        TN)�flushr r$s r&r+zBufferedFile.closePs��	
�
�
����r(c�t�|j|jj��t�|_y)z{
        Write out any data in the write buffer.  This may do nothing if write
        buffering is not turned on.
        N)�
_write_allr�getvaluerr$s r&r1zBufferedFile.flushWs)��
	
����
�
�.�.�0�1��	��
�r(c�6�|j�}|st�|S)a\
            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.
            ��readline�
StopIteration�r%�lines  r&�nextzBufferedFile.nextb����=�=�?�D��#�#��Kr(c�6�|j�}|st�|S)a^
            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.
            r6r9s  r&�__next__zBufferedFile.__next__sr<r(c�N�|j|jz|jk(S)z�
        Check if the file can be read from.

        :returns:
            `True` if the file can be read from. If `False`, `read` will raise
            an exception.
        )r�	FLAG_READr$s r&�readablezBufferedFile.readable�s �����d�n�n�,����?�?r(c�N�|j|jz|jk(S)z�
        Check if the file can be written to.

        :returns:
            `True` if the file can be written to. If `False`, `write` will
            raise an exception.
        )r�
FLAG_WRITEr$s r&�writablezBufferedFile.writable�s �����d�o�o�-�$�/�/�A�Ar(c��y)z�
        Check if the file supports random access.

        :returns:
            `True` if the file supports random access. If `False`, `seek` will
            raise an exception.
        F�r$s r&�seekablezBufferedFile.seekable�s��r(c�h�|jt|��}||dt|�t|�S)z�
        Read up to ``len(buff)`` bytes into ``bytearray`` *buff* and return the
        number of bytes read.

        :returns:
            The number of bytes read.
        N)�read�len)r%�buff�datas   r&�readintozBufferedFile.readinto�s0���y�y��T��#�� ��[�s�4�y���4�y�r(Nc�6�|jrtd��|j|jzstd��|�|dkr�t	|j
�}t
�|_|xjt|�z
c_		|j|j�}|�t|�dk(r	t
|�S|j|�|xjt|�z
c_
|xjt|�z
c_��|t|j
�krC|j
d|}|j
|d|_|xjt|�z
c_|St|j
�|kr�|t|j
�z
}|j|jzrt|j |�}	|j|�}|�t|�dk(rnL|xj
|z
c_|xjt|�z
c_
t|j
�|kr��|j
d|}|j
|d|_|xjt|�z
c_|S#t$rd}Y���wxYw#t$rd}Y��wxYw)a�
        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
        �File is closedzFile is not open for readingNr)r �IOErrorrr@�	bytearrayrrr!rJ�_readr�EOFError�extendr"�
FLAG_BUFFERED�maxr)r%�size�result�new_data�	read_sizes     r&rIzBufferedFile.read�s0��"�<�<��*�+�+����d�n�n�,��8�9�9��L�d�Q�h��t�}�}�-�F�!�G�D�M��I�I��V��$�I��$�#�z�z�$�*?�*?�@�H��$�#�h�-�1�*<����=� ��
�
�h�'��
�
��X��.�
��	�	�S��]�*�	���3�t�}�}�%�%��]�]�5�D�)�F� �M�M�$�%�0�D�M��I�I��V��$�I��M��$�-�-� �4�'��s�4�=�=�1�1�I��{�{�T�/�/�/���
�
�y�9�	�
 ��:�:�i�0��� �c�(�m�q�&8���M�M�X�%�M��M�M�S��]�*�M��$�-�-� �4�'����u��%���
�
�d�e�,��
��	�	�S��[� �	��
��9 �$�#�H�$��&�
 ���
 �s$�I8�J
�8J�J�
J�Jc��|jrtd��|j|jzstd��|j}d}	|j
rj|j|jzrQt|�dkDrC|dtk(r|dd}|jt�n|jt�d|_|�4|dk\r/t|�|k\r||d|_|d|}d}n�|t|�z
}n|j}t|vs!|j|jzr	t|vrn�	|j|�}|�t|�dk(rSt!�|_|xj"t|�z
c_|j|j$zr|St'|�S||z
}|xj(t|�z
c_��||j+t�}|j|jzr&|j+t�}|dk\r||ks|dkr|}|dk(rD|xj"t|�z
c_|j|j$zr|St'|�S|dz}||t,k(r|t|�kr||tk(r|dz
}|r||d|jz|_n
||d|_|||}	|d|tz}t|j�dk(r|	tk(rd|_n|j|	�|xj"t|�z
c_|j|j$zr|St'|�S#t$rd}Y��wxYw)	a�
        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
        rOzFile not open for readingFTrrN���)r rPrr@rr�FLAG_UNIVERSAL_NEWLINErJr�_record_newlinerrrrrRrSrr!�FLAG_BINARYr
r"�findr)
r%rWr:�	truncated�nrY�pos�rpos�xpos�lfs
          r&r7zBufferedFile.readline�s��.�<�<��*�+�+����d�n�n�,��5�6�6��}�}���	���$�$��K�K�$�"=�"=�=���I��M���7�1�1����8�D��(�(��.��(�(��1�',��$�� �t�q�y��t�9��$�$(���K�D�M����;�D� $�I���3�t�9�$���M�M����$����d�9�9�9�g��o��
 ��:�:�a�=��� �c�(�m�q�&8� %���
��	�	�S��Y�&�	�#�{�{�T�-=�-=�=�t�J�1�T�7�J��H��D��M�M�S��]�*�M�O�R�i�i�
�&���;�;��4�4�4��9�9�W�%�D���	��s�
�c�A�g����"�9��I�I��T��"�I��;�;��)9�)9�9�4�F�q��w�F��Q�w����I��&��s�4�y� ��T�
�1�1��A�I�D�� ���K�$�-�-�7�D�M� ���K�D�M�
�#�d�^���D�S�z�M�)����
�
��!�#�"��-�$(�D� �� � ��$��	�	�S��Y��	��{�{�T�%5�%5�5�t�B�1�T�7�B��U�
 ���
 �s�.M�M�Mc��g}d}	|j�}t|�dk(r	|S|j|�|t|�z
}|�||k\r	|S�K)a�
        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.
        r)r7rJ�append)r%�sizehint�lines�
byte_countr:s     r&�	readlineszBufferedFile.readlinesPsg�����
���=�=�?�D��4�y�A�~��
��	
�L�L����#�d�)�#�J��$�:��+A����r(c��td��)a�
        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.
        zFile does not support seeking.�rP)r%�offset�whences   r&�seekzBufferedFile.seekfs��$�6�7�7r(c��|jS)z�
        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$s r&�tellzBufferedFile.tellzs���y�y�r(c��t|t�r|jd�}|jrt	d��|j
|jzst	d��|j
|jzs|j|�y|jj|�|j
|jzr�|jt�}|dk\r{|jj�}|t|�t|�z
z
}|j|d|dz�t!�|_	|jj||dzd�y|jj#�|j$k\r|j'�y)a8
        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
        zutf-8rOzFile not open for writingNrr)�
isinstancer�encoder rPrrCrUr3r�write�FLAG_LINE_BUFFERED�rfindrr4rJrrsrr1)r%rL�last_newline_pos�wbufs    r&rwzBufferedFile.write�s>���d�I�&��;�;�w�'�D��<�<��*�+�+����d�o�o�-��5�6�6����d�0�0�0��O�O�D�!���
�
���D�!��;�;��0�0�0�#�z�z�-�8���1�$��}�}�-�-�/�� �C��I��D�	�$9�9� �����%;�'7�!�';� <�=� '�	��
��
�
�#�#�D�)9�A�)=�)?�$@�A���=�=����4�=�=�0��J�J�L�r(c�4�|D]}|j|��y)a?
        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)rw)r%�sequencer:s   r&�
writelineszBufferedFile.writelines�s"���	�D��J�J�t��	�r(c��|S)z
        Identical to ``iter(f)``.  This is a deprecated file interface that
        predates Python iterator support.
        rFr$s r&�
xreadlineszBufferedFile.xreadlines�s	��
�r(c��|jSr*)r r$s r&�closedzBufferedFile.closed�s���|�|�r(c��t��)z�
        (subclass override)
        Read data from the stream.  Return ``None`` or raise ``EOFError`` to
        indicate EOF.
        )rS)r%rWs  r&rRzBufferedFile._read�s���j�r(c��td��)zI
        (subclass override)
        Write data into the stream.
        zwrite not implementedrn)r%rLs  r&�_writezBufferedFile._write�s��
�-�.�.r(c��y)ai
        (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,
        rrFr$s r&�	_get_sizezBufferedFile._get_size�s��r(c��|j|_|dkrd}|dk(r-|xj|j|jzzc_n~|dkDrG||_|xj|jzc_|xj|jzc_n2|dk(r-|xj|j|jzzc_d|vsd|vr|xj|j
zc_d|vsd|vr|xj|jzc_d|vrY|xj|j|jzzc_|j�|_	|jx|_
|_d|vr|xj|jzc_d|vr'|xj|jzc_d	|_y	y	)
zM
        Subclasses call this method to initialize the BufferedFile.
        rr�r�+�w�a�b�UN)rrrrUrxr@rC�FLAG_APPENDr�r#r!r"r_r]r)r%�mode�bufsizes   r&�	_set_modezBufferedFile._set_mode�so��
�-�-��
��Q�;��G��a�<�
�K�K�4�-�-��0G�0G�G�G�K�
�q�[�#�D�M��K�K�4�-�-�-�K��K�K�D�3�3�3�3�K�
��\��K�K�T�/�/�$�2I�2I�I�J�J�K��4�K�S�D�[��K�K�4�>�>�)�K��4�K�S�D�[��K�K�4�?�?�*�K��$�;��K�K�4�?�?�T�-=�-=�=�=�K����)�D�J�(,�
�
�2�D�I��
��$�;��K�K�4�+�+�+�K��$�;��K�K�4�6�6�6�K�!�D�M�r(c�b�t|�}t|�dkDr�|j|�}||d}|j|jzr.|xj
|z
c_|j
x|_|_n*|xj|z
c_|xj|z
c_t|�dkDr��y)Nr)�
memoryviewrJr�rr�r#r!r")r%�raw_datarL�counts    r&r3zBufferedFile._write_alls����(�#���$�i�!�m��K�K��%�E����<�D��{�{�T�-�-�-��
�
�e�#�
�,0�J�J�6��	�D�M��	�	�U�"�	��
�
��&�
��$�i�!�m�r(c�$�|j|jzsy|j�||_y|j|k7r.t|jt�r|j|f|_y||jvr|xj|fz
c_yyr*)rr]rrur)r%�newlines  r&r^zBufferedFile._record_newlinesy�����d�9�9�9���=�=� �#�D�M�
�]�]�g�
%�*��M�M�;�+
�"�]�]�G�4�D�M�
�D�M�M�
)��M�M�g�Z�'�M�*r(r*)r)r�r\)+�__name__�
__module__�__qualname__�__doc__r�SEEK_SET�SEEK_CUR�SEEK_ENDr@rCr�r_rUrxr]r'r,r/r+r1r	r;r>rArDrGrMrIr7rlrqrsrwr~r��propertyr�rRr�r�r�r3r^rFr(r&rrs����
���H��H��H��I��J��K��K��M���!��
��
����
	�"
	�@�B��
�9�vgC�R�,8�(�"�H������
�/�	�&!�P
�
(r(rN)�paramiko.commonrrrrr�paramiko.py3compatrr	r
rr�
paramiko.utilr
rrFr(r&�<module>r�s*��$��G�F�/�D(�(�D(r(

Zerion Mini Shell 1.0