%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/utils/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/utils/filebuffer.pyo

�
���^c@@szdZddlmZmZmZddlZddlZddlm	Z	de	fd��YZ
defd��YZdS(	u�
    :codeauthor: Pedro Algarvio (pedro@algarvio.me)


    salt.utils.filebuffer
    ~~~~~~~~~~~~~~~~~~~~~

    This utility allows parsing a file in chunks.
i(tabsolute_importtunicode_literalstprint_functionN(t
SaltExceptiontInvalidFileModecB@seZdZRS(uM
    An invalid file mode was used to open the file passed to the buffer
    (t__name__t
__module__t__doc__(((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pyRstBufferedReadercB@sYeZdZdddd�Zed��Zd�Zd�ZeZd	�Z	d
�Z
RS(
u�
    This object allows iterating through the contents of a file keeping
    X configurable bytes in memory which can be used to, for example,
    do regex search/matching on more than a single line.

    So, **an imaginary, non accurate**, example could be:

        1 - Initiate the BufferedReader filling it to max_in_men:
            br = [1, 2, 3]

        2 - next chunk(pop chunk_size from the left, append chunk_size to the
        right):
            br = [2, 3, 4]


    :type  path: str
    :param path: The file path to be read

    :type  max_in_mem: int
    :param max_in_mem: The maximum bytes kept in memory while iterating through
                       the file. Default 256KB.

    :type  chunk_size: int
    :param chunk_size: The size of each consequent read chunk. Default 32KB.

    :type  mode: str
    :param mode: The mode the file should be opened. **Only read modes**.

    iii urcC@smd|ksd|kr'td��n||_tjjj|j|�|_||_||_d|_
dS(Nuauwu(Cannot open file in write or append mode(Rt_BufferedReader__pathtsalttutilstfilestfopent_BufferedReader__filet_BufferedReader__max_in_memt_BufferedReader__chunk_sizetNonet_BufferedReader__buffered(tselftpatht
max_in_memt
chunk_sizetmode((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pyt__init__7s			cC@s|jS(N(R(R((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pytbufferedBscC@s|S(N((R((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pyt__iter__GscC@s�|jdkr+|j|j}d|_nd}|j|j|_|jj|j|�}tjjj	|�}|s�|jj
�t�n|j|7_|jS(u�
        Return the next iteration by popping `chunk_size` from the left and
        appending `chunk_size` to the right if there's info on the file left
        to be read.
        uiN(RRRRRtreadR
Rtstringutilstto_strtcloset
StopIteration(Rt
multipliertdata((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pytnextJs
	cC@s|S(N((R((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pyt	__enter__iscC@s&|jjtkr"|jj�ndS(N(RtclosedtFalseR(Rtexc_typet	exc_valuet	traceback((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pyt__exit__lsii�(RRRRtpropertyRRR"t__next__R#R)(((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pyRs
			(
Rt
__future__RRRtsalt.utils.filesR
tsalt.utils.stringutilstsalt.exceptionsRRtobjectR(((s9/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pyt<module>
s

Zerion Mini Shell 1.0