%PDF- %PDF-
| Direktori : /proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/utils/ |
| Current File : //proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/utils/filebuffer.pyc |
�
���^c @@ sz d Z d d l m Z m Z m Z d d l Z d d l Z d d l m Z d e f d � � YZ
d e f d � � YZ d S( u�
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
salt.utils.filebuffer
~~~~~~~~~~~~~~~~~~~~~
This utility allows parsing a file in chunks.
i ( t absolute_importt unicode_literalst print_functionN( t
SaltExceptiont InvalidFileModec B@ s e Z d Z RS( 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.pyR s t BufferedReaderc B@ sY e Z d Z d d d d � Z e d � � Z d � Z d � Z e Z d � 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**.
i i i u rc C@ sm d | k s d | k r'