Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
 lŽŒY Wã@sadZddlZddlZddlZddlZddlZddlZddlZyddlm Z Wn"e k r’ddl m Z YnXej ddhkr»ddlmZndZddlZddlmZmZmZmZddd hZeed ƒr-ejejƒejejƒd d ZeZd d ddddddd„ZGdd„dƒZGdd„dƒZy ej Z Wn+e!k r¿Gdd„de"e#ƒZ YnXGdd„ddej$ƒZ%ej%j&e%ƒGdd„de%ƒZ'ej'j&e'ƒddl(m)Z)e'j&e)ƒGdd„de%ƒZ*ej*j&e*ƒGdd „d e*ƒZ+Gd!d"„d"e*ƒZ,Gd#d$„d$e+ƒZ-Gd%d&„d&e+ƒZ.Gd'd(„d(e*ƒZ/Gd)d*„d*e.e-ƒZ0Gd+d,„d,e'ƒZ)Gd-d.„d.e%ƒZ1ej1j&e1ƒGd/d0„d0ej2ƒZ3Gd1d2„d2e1ƒZ4Gd3d4„d4e4ƒZ5dS)5z) Python implementation of the io module. éN)Ú allocate_lockÚwin32Úcygwin)Úsetmode)Ú__all__ÚSEEK_SETÚSEEK_CURÚSEEK_ENDééÚ SEEK_HOLEéiÚrTcCsSt|tttfƒs(td|ƒ‚t|tƒsGtd|ƒ‚t|tƒsftd|ƒ‚|dk r’t|tƒ r’td|ƒ‚|dk r¾t|tƒ r¾td|ƒ‚t|ƒ}|tdƒsòt|ƒt|ƒkrtd|ƒ‚d|k} d |k} d |k} d |k} d |k} d |k}d|k}d|kr¥| st| st| r€tdƒ‚ddl}|j dt dƒd} |r½|r½tdƒ‚| | | | dkrátdƒ‚| pö| pö| pö| stdƒ‚|r#|dk r#tdƒ‚|rA|dk rAtdƒ‚|r_|dk r_tdƒ‚t || rqdptd| r€d pƒd| r�d p“d| r d p£d| r°d p³d|d|ƒ}|}ynd}|dksö|dkr|j ƒrd"}d}|dkr]t }ytj|jƒƒj}Wnttfk rJYnX|dkr]|}|dkrutdƒ‚|dkr—|r‹|Std ƒ‚| r¯t||ƒ}nL| sÁ| sÁ| rÓt||ƒ}n(| rët||ƒ}ntd!|ƒ‚|}|r |St|||||ƒ}|}||_|SWn|jƒ‚YnXdS)#aÀOpen file and return a stream. Raise OSError upon failure. file is either a text or byte string giving the name (and the path if the file isn't in the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is closed when the returned I/O object is closed, unless closefd is set to False.) mode is an optional string that specifies the mode in which the file is opened. It defaults to 'r' which means open for reading in text mode. Other common values are 'w' for writing (truncating the file if it already exists), 'x' for exclusive creation of a new file, and 'a' for appending (which on some Unix systems, means that all writes append to the end of the file regardless of the current seek position). In text mode, if encoding is not specified the encoding used is platform dependent. (For reading and writing raw bytes use binary mode and leave encoding unspecified.) The available modes are: ========= =============================================================== Character Meaning --------- --------------------------------------------------------------- 'r' open for reading (default) 'w' open for writing, truncating the file first 'x' create a new file and open it for writing 'a' open for writing, appending to the end of the file if it exists 'b' binary mode 't' text mode (default) '+' open a disk file for updating (reading and writing) 'U' universal newline mode (deprecated) ========= =============================================================== The default mode is 'rt' (open for reading text). For binary random access, the mode 'w+b' opens and truncates the file to 0 bytes, while 'r+b' opens the file without truncation. The 'x' mode implies 'w' and raises an `FileExistsError` if the file already exists. Python distinguishes between files opened in binary and text modes, even when the underlying operating system doesn't. Files opened in binary mode (appending 'b' to the mode argument) return contents as bytes objects without any decoding. In text mode (the default, or when 't' is appended to the mode argument), the contents of the file are returned as strings, the bytes having been first decoded using a platform-dependent encoding or using the specified encoding if given. 'U' mode is deprecated and will raise an exception in future versions of Python. It has no effect in Python 3. Use newline to control universal newlines mode. buffering is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size of a fixed-size chunk buffer. When no buffering argument is given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`. On many systems, the buffer will typically be 4096 or 8192 bytes long. * "Interactive" text files (files for which isatty() returns True) use line buffering. Other text files use the policy described above for binary files. encoding is the str name of the encoding used to decode or encode the file. This should only be used in text mode. The default encoding is platform dependent, but any encoding supported by Python can be passed. See the codecs module for the list of supported encodings. errors is an optional string that specifies how encoding errors are to be handled---this argument should not be used in binary mode. Pass 'strict' to raise a ValueError exception if there is an encoding error (the default of None has the same effect), or pass 'ignore' to ignore errors. (Note that ignoring encoding errors can lead to data loss.) See the documentation for codecs.register for a list of the permitted encoding error strings. newline is a string controlling how universal newlines works (it only applies to text mode). It can be None, '', '\n', '\r', and '\r\n'. It works as follows: * On input, if newline is None, universal newlines mode is enabled. Lines in the input can end in '\n', '\r', or '\r\n', and these are translated into '\n' before being returned to the caller. If it is '', universal newline mode is enabled, but line endings are returned to the caller untranslated. If it has any of the other legal values, input lines are only terminated by the given string, and the line ending is returned to the caller untranslated. * On output, if newline is None, any '\n' characters written are translated to the system default line separator, os.linesep. If newline is '', no translation takes place. If newline is any of the other legal values, any '\n' characters written are translated to the given string. closedfd is a bool. If closefd is False, the underlying file descriptor will be kept open when the file is closed. This does not work when a file name is given and must be True in that case. The newly created file is non-inheritable. A custom opener can be used by passing a callable as *opener*. The underlying file descriptor for the file object is then obtained by calling *opener* with (*file*, *flags*). *opener* must return an open file descriptor (passing os.open as *opener* results in functionality similar to passing None). open() returns a file object whose type depends on the mode, and through which the standard file operations such as reading and writing are performed. When open() is used to open a file in a text mode ('w', 'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open a file in a binary mode, the returned class varies: in read binary mode, it returns a BufferedReader; in write binary and append binary modes, it returns a BufferedWriter, and in read/write mode, it returns a BufferedRandom. It is also possible to use a string or bytearray as a file for both reading and writing. For strings StringIO can be used like a file opened in a text mode, and for bytes a BytesIO can be used like a file opened in a binary mode. zinvalid file: %rzinvalid mode: %rzinvalid buffering: %rNzinvalid encoding: %rzinvalid errors: %rzaxrwb+tUÚxrÚwÚaú+ÚtÚbÚUz$can't use U and writing mode at oncerz'U' mode is deprecatedr Tz'can't have text and binary mode at oncer z)can't have read/write/append mode at oncez/must have exactly one of read/write/append modez-binary mode doesn't take an encoding argumentz+binary mode doesn't take an errors argumentz+binary mode doesn't take a newline argumentÚÚopenerFzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %réÿÿÿÿ)Ú isinstanceÚstrÚbytesÚintÚ TypeErrorÚsetÚlenÚ ValueErrorÚwarningsÚwarnÚDeprecationWarningÚFileIOÚisattyÚDEFAULT_BUFFER_SIZEÚosÚfstatÚfilenoÚ st_blksizeÚOSErrorÚAttributeErrorÚBufferedRandomÚBufferedWriterÚBufferedReaderÚ TextIOWrapperÚmodeÚclose)Úfiler1Ú bufferingÚencodingÚerrorsÚnewlineÚclosefdrZmodesZcreatingÚreadingÚwritingZ appendingZupdatingÚtextÚbinaryr!ÚrawÚresultÚline_bufferingÚbsÚbuffer©rBú$/opt/python35/lib/python3.5/_pyio.pyÚopen)s { (                   ?$        rDc@s"eZdZdZdd„ZdS)Ú DocDescriptorz%Helper for builtins.open.__doc__ cCs dtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True) )rDÚ__doc__)ÚselfÚobjÚtyprBrBrCÚ__get__þszDocDescriptor.__get__N)Ú__name__Ú __module__Ú __qualname__rFrJrBrBrBrCrEûs rEc@s+eZdZdZeƒZdd„ZdS)Ú OpenWrapperz¸Wrapper for builtins.open Trick so that open won't become a bound method when stored as a class variable (as dbm.dumb does). See initstdio() in Python/pylifecycle.c. cOs t||ŽS)N)rD)ÚclsÚargsÚkwargsrBrBrCÚ__new__szOpenWrapper.__new__N)rKrLrMrFrErRrBrBrBrCrNs  rNc@seZdZdS)ÚUnsupportedOperationN)rKrLrMrBrBrBrCrSs rSc@sZeZdZdZdd„Zddd„Zdd„Zd d d „Zd d „ZdZ dd„Z dd„Z dd„Z d dd„Z dd„Zd dd„Zdd„Zd dd„Zedd „ƒZd d!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd6d,d-„Zd.d/„Zd0d1„Zd d2d3„Zd4d5„Zd S)7ÚIOBaseagThe abstract base class for all I/O classes, acting on streams of bytes. There is no public constructor. This class provides dummy implementations for many methods that derived classes can override selectively; the default implementations represent a file that cannot be read, written or seeked. Even though IOBase does not declare read, readinto, or write because their signatures will vary, implementations and clients should consider those methods part of the interface. Also, implementations may raise UnsupportedOperation when operations they do not support are called. The basic type used for binary data read from or written to a file is bytes. Other bytes-like objects are accepted as method arguments too. In some cases (such as readinto), a writable object is required. Text I/O classes work with str data. Note that calling any method (even inquiries) on a closed stream is undefined. Implementations may raise OSError in this case. IOBase (and its subclasses) support the iterator protocol, meaning that an IOBase object can be iterated over yielding the lines in a stream. IOBase also supports the :keyword:`with` statement. In this example, fp is closed after the suite of the with statement is complete: with open('spam.txt', 'r') as fp: fp.write('Spam and eggs!') cCs td|jj|fƒ‚dS)z@Internal: raise an OSError exception for unsupported operations.z%s.%s() not supportedN)rSÚ __class__rK)rGÚnamerBrBrCÚ _unsupported?szIOBase._unsupportedrcCs|jdƒdS)a$Change stream position. Change the stream position to byte offset pos. Argument pos is interpreted relative to the position indicated by whence. Values for whence are ints: * 0 -- start of stream (the default); offset should be zero or positive * 1 -- current stream position; offset may be negative * 2 -- end of stream; offset is usually negative Some operating systems / file systems could provide additional values. Return an int indicating the new absolute position. ÚseekN)rW)rGÚposÚwhencerBrBrCrXFsz IOBase.seekcCs|jddƒS)z5Return an int indicating the current stream position.rr )rX)rGrBrBrCÚtellVsz IOBase.tellNcCs|jdƒdS)zŒTruncate file to size bytes. Size defaults to the current IO position as reported by tell(). Return the new size. ÚtruncateN)rW)rGrYrBrBrCr\ZszIOBase.truncatecCs|jƒdS)zuFlush write buffers, if applicable. This is not implemented for read-only and non-blocking streams. N)Ú _checkClosed)rGrBrBrCÚflushdsz IOBase.flushFc Cs(|js$z|jƒWdd|_XdS)ziFlush and close the IO object. This method has no effect if the file is already closed. NT)Ú_IOBase__closedr^)rGrBrBrCr2ns z IOBase.closec Csy|jƒWnYnXdS)zDestructor. Calls close().N)r2)rGrBrBrCÚ__del__yszIOBase.__del__cCsdS)z¿Return a bool indicating whether object supports random access. If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek(). FrB)rGrBrBrCÚseekable‡szIOBase.seekablecCs.|jƒs*t|dkr!dn|ƒ‚dS)zEInternal: raise UnsupportedOperation if file is not seekable NzFile or stream is not seekable.)rarS)rGÚmsgrBrBrCÚ_checkSeekable�s zIOBase._checkSeekablecCsdS)zvReturn a bool indicating whether object was opened for reading. If False, read() will raise OSError. FrB)rGrBrBrCÚreadable–szIOBase.readablecCs.|jƒs*t|dkr!dn|ƒ‚dS)zEInternal: raise UnsupportedOperation if file is not readable NzFile or stream is not readable.)rdrS)rGrbrBrBrCÚ_checkReadable�s zIOBase._checkReadablecCsdS)z†Return a bool indicating whether object was opened for writing. If False, write() and truncate() will raise OSError. FrB)rGrBrBrCÚwritable¤szIOBase.writablecCs.|jƒs*t|dkr!dn|ƒ‚dS)zEInternal: raise UnsupportedOperation if file is not writable NzFile or stream is not writable.)rfrS)rGrbrBrBrCÚ_checkWritable«s zIOBase._checkWritablecCs|jS)z…closed: bool. True iff the file has been closed. For backwards compatibility, this is a property, not a predicate. )r_)rGrBrBrCÚclosed²sz IOBase.closedcCs+|jr't|dkrdn|ƒ‚dS)z7Internal: raise a ValueError if file is closed NzI/O operation on closed file.)rhr )rGrbrBrBrCr]ºs zIOBase._checkClosedcCs|jƒ|S)zCContext management protocol. Returns self (an instance of IOBase).)r])rGrBrBrCÚ __enter__Ãs zIOBase.__enter__cGs|jƒdS)z+Context management protocol. Calls close()N)r2)rGrPrBrBrCÚ__exit__ÈszIOBase.__exit__cCs|jdƒdS)z’Returns underlying file descriptor (an int) if one exists. An OSError is raised if the IO object does not use a file descriptor. r)N)rW)rGrBrBrCr)Ðsz IOBase.filenocCs|jƒdS)z{Return a bool indicating whether this is an 'interactive' stream. Return False if it can't be determined. F)r])rGrBrBrCr%×s z IOBase.isattyr csÎtˆdƒr'‡‡fdd†}n dd„}ˆdkrHd ‰ntˆtƒsctdƒ‚tƒ}xUˆdks�t|ƒˆkrÈj|ƒƒ}|s¦P||7}|jd ƒroPqoWt|ƒS) aNRead and return a line of bytes from the stream. If size is specified, at most size bytes will be read. Size should be an int. The line terminator is always b'\n' for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized. ÚpeekcsWˆjdƒ}|sdS|jdƒdp5t|ƒ}ˆdkrSt|ˆƒ}|S)Nr s r)rkÚfindrÚmin)Z readaheadÚn)rGÚsizerBrCÚ nreadaheadís z#IOBase.readline..nreadaheadcSsdS)Nr rBrBrBrBrCrpösNr zsize must be an integerrs r) ÚhasattrrrrÚ bytearrayrÚreadÚendswithr)rGrorpÚresrrB)rGrorCÚreadlineás      ! zIOBase.readlinecCs|jƒ|S)N)r])rGrBrBrCÚ__iter__s zIOBase.__iter__cCs|jƒ}|st‚|S)N)rvÚ StopIteration)rGÚlinerBrBrCÚ__next__ s zIOBase.__next__cCsm|dks|dkr"t|ƒSd}g}x8|D]0}|j|ƒ|t|ƒ7}||kr5Pq5W|S)zéReturn a list of lines from the stream. hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint. Nr)ÚlistÚappendr)rGZhintrnÚlinesryrBrBrCÚ readliness    zIOBase.readlinescCs,|jƒx|D]}|j|ƒqWdS)N)r]Úwrite)rGr}ryrBrBrCÚ writelines"s  zIOBase.writelinesr)rKrLrMrFrWrXr[r\r^r_r2r`rarcrdrerfrgÚpropertyrhr]rirjr)r%rvrwrzr~r€rBrBrBrCrTs4            %  rTÚ metaclassc@sIeZdZdZd dd„Zdd„Zdd„Zd d „Zd S) Ú RawIOBasezBase class for raw binary I/O.r cCsp|dkrd}|dkr(|jƒSt|jƒƒ}|j|ƒ}|dkrYdS||d…=t|ƒS)zºRead and return up to size bytes, where size is an int. Returns an empty bytes object on EOF, or None if the object is set not to block and has no data to read. Nr rr)ÚreadallrrÚ __index__Úreadintor)rGrorrnrBrBrCrs8s     zRawIOBase.readcCsHtƒ}x$|jtƒ}|s"P||7}q W|r@t|ƒS|SdS)z+Read until EOF, using multiple read() call.N)rrrsr&r)rGruÚdatarBrBrCr„Is  zRawIOBase.readallcCs|jdƒdS)zÓRead bytes into a pre-allocated bytes-like object b. Returns an int representing the number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read. r†N)rW)rGrrBrBrCr†WszRawIOBase.readintocCs|jdƒdS)z˜Write the given buffer to the IO stream. Returns the number of bytes written, which may be less than the length of b in bytes. rN)rW)rGrrBrBrCr_szRawIOBase.writeNr)rKrLrMrFrsr„r†rrBrBrBrCrƒ*s    rƒ)r$c@speZdZdZddd„Zddd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dS)ÚBufferedIOBaseaBase class for buffered IO objects. The main difference with RawIOBase is that the read() method supports omitting the size argument, and does not have a default implementation that defers to readinto(). In addition, read(), readinto() and write() may raise BlockingIOError if the underlying raw stream is in non-blocking mode and not ready; unlike their raw counterparts, they will never return None. A typical implementation should not inherit from a RawIOBase implementation, but wrap one. NcCs|jdƒdS)a¤Read and return up to size bytes, where size is an int. If the argument is omitted, None, or negative, reads and returns all data until EOF. If the argument is positive, and the underlying raw stream is not 'interactive', multiple raw reads may be issued to satisfy the byte count (unless EOF is reached first). But for interactive raw streams (XXX and for pipes?), at most one raw read will be issued, and a short result does not imply that EOF is imminent. Returns an empty bytes array on EOF. Raises BlockingIOError if the underlying raw stream has no data at the moment. rsN)rW)rGrorBrBrCrs}szBufferedIOBase.readcCs|jdƒdS)zaRead up to size bytes with at most one read() system call, where size is an int. Úread1N)rW)rGrorBrBrCr‰‘szBufferedIOBase.read1cCs|j|ddƒS)afRead bytes into a pre-allocated bytes-like object b. Like read(), this may issue multiple reads to the underlying raw stream, unless the latter is 'interactive'. Returns an int representing the number of bytes read (0 for EOF). Raises BlockingIOError if the underlying raw stream has no data at the moment. r‰F)Ú _readinto)rGrrBrBrCr†—s zBufferedIOBase.readintocCs|j|ddƒS)zíRead bytes into buffer *b*, using at most one system call Returns an int representing the number of bytes read (0 for EOF). Raises BlockingIOError if the underlying raw stream has no data at the moment. r‰T)rŠ)rGrrBrBrCÚ readinto1¥s zBufferedIOBase.readinto1cCs}t|tƒst|ƒ}|jdƒ}|rH|jt|ƒƒ}n|jt|ƒƒ}t|ƒ}||d|…<|S)NÚB)rÚ memoryviewÚcastr‰rrs)rGrr‰r‡rnrBrBrCrаs  zBufferedIOBase._readintocCs|jdƒdS)aWrite the given bytes buffer to the IO stream. Return the number of bytes written, which is always the length of b in bytes. Raises BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment. rN)rW)rGrrBrBrCr¿s zBufferedIOBase.writecCs|jdƒdS)z° Separate the underlying raw stream from the buffer and return it. After the raw stream has been detached, the buffer is in an unusable state. ÚdetachN)rW)rGrBrBrCr�ÊszBufferedIOBase.detach) rKrLrMrFrsr‰r†r‹rŠrr�rBrBrBrCrˆls    rˆc@sôeZdZdZdd„Zddd„Zdd„Zd d d „Zd d „Zdd„Z dd„Z dd„Z e dd„ƒZ e dd„ƒZe dd„ƒZe dd„ƒZdd„Zdd„Zd d!„Zd"d#„Zd S)$Ú_BufferedIOMixinzÝA mixin implementation of BufferedIOBase with an underlying raw stream. This passes most requests on to the underlying raw stream. It does *not* provide implementations of read(), readinto() or write(). cCs ||_dS)N)Ú_raw)rGr=rBrBrCÚ__init__ßsz_BufferedIOMixin.__init__rcCs1|jj||ƒ}|dkr-tdƒ‚|S)Nrz#seek() returned an invalid position)r=rXr+)rGrYrZZ new_positionrBrBrCrXäs  z_BufferedIOMixin.seekcCs+|jjƒ}|dkr'tdƒ‚|S)Nrz#tell() returned an invalid position)r=r[r+)rGrYrBrBrCr[ês  z_BufferedIOMixin.tellNcCs2|jƒ|dkr"|jƒ}|jj|ƒS)N)r^r[r=r\)rGrYrBrBrCr\ðs   z_BufferedIOMixin.truncatecCs&|jrtdƒ‚|jjƒdS)Nzflush of closed file)rhr r=r^)rGrBrBrCr^þs  z_BufferedIOMixin.flushc Cs<|jdk r8|j r8z|jƒWd|jjƒXdS)N)r=rhr^r2)rGrBrBrCr2sz_BufferedIOMixin.closecCs;|jdkrtdƒ‚|jƒ|j}d|_|S)Nzraw stream already detached)r=r r^r‘)rGr=rBrBrCr� s     z_BufferedIOMixin.detachcCs |jjƒS)N)r=ra)rGrBrBrCrasz_BufferedIOMixin.seekablecCs|jS)N)r‘)rGrBrBrCr=sz_BufferedIOMixin.rawcCs |jjS)N)r=rh)rGrBrBrCrhsz_BufferedIOMixin.closedcCs |jjS)N)r=rV)rGrBrBrCrV sz_BufferedIOMixin.namecCs |jjS)N)r=r1)rGrBrBrCr1$sz_BufferedIOMixin.modecCstdj|jjƒƒ‚dS)Nz can not serialize a '{0}' object)rÚformatrUrK)rGrBrBrCÚ __getstate__(s z_BufferedIOMixin.__getstate__c Csa|jj}|jj}y |j}Wn"tk rIdj||ƒSYnXdj|||ƒSdS)Nz<{}.{}>z<{}.{} name={!r}>)rUrLrMrVÚ Exceptionr“)rGÚmodnameZclsnamerVrBrBrCÚ__repr__,s    z_BufferedIOMixin.__repr__cCs |jjƒS)N)r=r))rGrBrBrCr)8sz_BufferedIOMixin.filenocCs |jjƒS)N)r=r%)rGrBrBrCr%;sz_BufferedIOMixin.isatty)rKrLrMrFr’rXr[r\r^r2r�rar�r=rhrVr1r”r—r)r%rBrBrBrCr�Ös"        r�csÐeZdZdZddd„Zdd„Zdd„Zd d „Z‡fd d †Zdd d„Z dd„Z dd„Z ddd„Z dd„Z ddd„Zdd„Zdd„Zdd„Z‡S) ÚBytesIOz˜sz"FileIO.__init__..rzKMust have exactly one of create/read/write/append mode and at most one plusrTrrrÚO_BINARYZ O_NOINHERITÚ O_CLOEXECz'Cannot use closefd=False with file namei¶zexpected integer from openerzNegative file descriptorFr*rr),Ú_fdÚ_closefdr'r2rÚfloatrrr rrÚsumÚcountÚ_createdÚ _writableÚO_EXCLÚO_CREATÚ _readableÚO_TRUNCÚ _appendingÚO_APPENDÚO_RDWRÚO_RDONLYÚO_WRONLYÚgetattrrDr+Úset_inheritabler(ÚstatÚS_ISDIRÚst_modeÚIsADirectoryErrorr¼ZEISDIRr½r,Ú_blksizer&Ú_setmoderÇrVÚlseekr ) rGr3r1r8rÚfdÚflagsZnoinherit_flagZowned_fdZfdfstatrBrBrCr’vs      4                                zFileIO.__init__cCsY|jdkrU|jrU|j rUddl}|jd|ftddƒ|jƒdS)Nrzunclosed file %rÚ stacklevelr )rÉrÊrhr!r"ÚResourceWarningr2)rGr!rBrBrCr`ës " zFileIO.__del__cCstd|jjƒ‚dS)Nzcannot serialize '%s' object)rrUrK)rGrBrBrCr”òszFileIO.__getstate__c CsŠd|jj|jjf}|jr-d|Sy |j}Wn/tk rkd||j|j|jfSYnXd|||j|jfSdS)Nz%s.%sz <%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>) rUrLrMrhrVr,rÉr1rÊ)rGÚ class_namerVrBrBrCr—õs    zFileIO.__repr__cCs|jstdƒ‚dS)NzFile not open for reading)rÒrS)rGrBrBrCres zFileIO._checkReadablecCs|jstdƒ‚dS)NzFile not open for writing)rÏrS)rGrbrBrBrCrgs zFileIO._checkWritablec Csj|jƒ|jƒ|dks,|dkr6|jƒSytj|j|ƒSWntk redSYnXdS)zöRead at most size bytes, returned as bytes. Only makes one system call, so less data may be returned than requested In non-blocking mode, returns None if no data is available. Return an empty bytes object at EOF. Nr)r]rer„r'rsrÉr»)rGrorBrBrCrs s    z FileIO.readcCs|jƒ|jƒt}yKtj|jdtƒ}tj|jƒj}||krd||d}Wnt k ryYnXt ƒ}x�t |ƒ|kr·t |ƒ}|t |tƒ7}|t |ƒ}ytj |j|ƒ}Wntk rÿ|r÷PdSYnX|sP||7}q†Wt|ƒS)zÓRead all data from the file, returned as bytes. In non-blocking mode, returns as much as is immediately available, or None if no data is available. Return an empty bytes object at EOF. rr N)r]rer&r'rárÉrr(Úst_sizer+rrrr¥rsr»r)rGÚbufsizerYÚendr>rnr¯rBrBrCr„s4        zFileIO.readallcCsJt|ƒjdƒ}|jt|ƒƒ}t|ƒ}||d|…<|S)zSame as RawIOBase.readinto().rŒN)r�rŽrsr)rGrÚmr‡rnrBrBrCr†>s  zFileIO.readintoc CsH|jƒ|jƒytj|j|ƒSWntk rCdSYnXdS)aWrite bytes b to file, return number written. Only makes one system call, so not all of the data may be written. The number of bytes actually written is returned. In non-blocking mode, returns None if the write would block. N)r]rgr'rrÉr»)rGrrBrBrCrFs    z FileIO.writecCs;t|tƒrtdƒ‚|jƒtj|j||ƒS)aéMove to new file position. Argument offset is a byte count. Optional argument whence defaults to SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values are SEEK_CUR or 1 (move relative to current position, positive or negative), and SEEK_END or 2 (move relative to end of file, usually negative, although many platforms allow seeking beyond the end of a file). Note that not all file objects are seekable. zan integer is required)rrËrr]r'rárÉ)rGrYrZrBrBrCrXTs   z FileIO.seekcCs |jƒtj|jdtƒS)zYtell() -> int. Current file position. Can raise OSError for non seekable files.r)r]r'rárÉr)rGrBrBrCr[ds z FileIO.tellcCsC|jƒ|jƒ|dkr,|jƒ}tj|j|ƒ|S)zÀTruncate the file to at most size bytes. Size defaults to the current file position, as returned by tell(). The current file position is changed to the value of size. N)r]rgr[r'Ú ftruncaterÉ)rGrorBrBrCr\ks     zFileIO.truncatec s;|js7z|jr%tj|jƒWdtƒjƒXdS)z—Close the file. A closed file cannot be used for further I/O operations. close() may be called more than once without error. N)rhrÊr'r2rÉr¡)rG)rUrBrCr2xs   z FileIO.closec CsU|jƒ|jdkrNy|jƒWntk rDd|_Yn Xd|_|jS)z$True if file supports random-access.NFT)r]Ú _seekabler[r+)rGrBrBrCra…s   zFileIO.seekablecCs|jƒ|jS)z'True if file was opened in a read mode.)r]rÒ)rGrBrBrCrd‘s zFileIO.readablecCs|jƒ|jS)z(True if file was opened in a write mode.)r]rÏ)rGrBrBrCrf–s zFileIO.writablecCs|jƒ|jS)z3Return the underlying file descriptor (an integer).)r]rÉ)rGrBrBrCr)›s z FileIO.filenocCs|jƒtj|jƒS)z.True if the file is connected to a TTY device.)r]r'r%rÉ)rGrBrBrCr% s z FileIO.isattycCs|jS)z6True if the file descriptor will be closed by close().)rÊ)rGrBrBrCr8¥szFileIO.closefdcCs_|jr|jrdSdSn>|jr:|jr3dSdSn!|jrW|jrPdSdSndSdS) zString giving the file modezxb+Úxbzab+Úabzrb+ÚrbÚwbN)rÎrÒrÔrÏ)rGrBrBrCr1ªs      z FileIO.moder)!rKrLrMrÉrÎrÒrÏrÔrìrÊr’r`r”r—rergrsr„r†rrrXr[r\r2rardrfr)r%r�r8r1rBrB)rUrCr$ms8 u     #        r$c@sŽeZdZdZddd„Zdd„Zddd „Zd d „Zd d „Ze dd„ƒZ e dd„ƒZ e dd„ƒZ dS)Ú TextIOBasezàBase class for text I/O. This class provides a character and line based interface to stream I/O. There is no readinto method because Python's character strings are immutable. There is no public constructor. r cCs|jdƒdS)zíRead at most size characters from stream, where size is an int. Read from underlying buffer until we have size characters or we hit EOF. If size is negative or omitted, read until EOF. Returns a string. rsN)rW)rGrorBrBrCrsÉszTextIOBase.readcCs|jdƒdS)z.Write string s to stream and returning an int.rN)rW)rGÚsrBrBrCrÓszTextIOBase.writeNcCs|jdƒdS)z*Truncate size to pos, where pos is an int.r\N)rW)rGrYrBrBrCr\×szTextIOBase.truncatecCs|jdƒdS)z_Read until newline or EOF. Returns an empty string if EOF is hit immediately. rvN)rW)rGrBrBrCrvÛszTextIOBase.readlinecCs|jdƒdS)z· Separate the underlying buffer from the TextIOBase and return it. After the underlying buffer has been detached, the TextIO is in an unusable state. r�N)rW)rGrBrBrCr�âszTextIOBase.detachcCsdS)zSubclasses should override.NrB)rGrBrBrCr5ëszTextIOBase.encodingcCsdS)z’Line endings translated so far. Only line endings translated during reading are considered. Subclasses should override. NrB)rGrBrBrCÚnewlinesðszTextIOBase.newlinescCsdS)zMError setting of the decoder or encoder. Subclasses should override.NrB)rGrBrBrCr6úszTextIOBase.errorsr) rKrLrMrFrsrr\rvr�r�r5rór6rBrBrBrCrñÀs     rñc@s|eZdZdZddd„Zddd„Zdd „Zd d „Zd d „ZdZ dZ dZ e dd„ƒZ dS)ÚIncrementalNewlineDecodera+Codec used when reading a file in universal newlines mode. It wraps another incremental decoder, translating \r\n and \r into \n. It also records the types of newlines encountered. When used with translate=False, it ensures that the newline sequence is returned in one piece. ÚstrictcCs>tjj|d|ƒ||_||_d|_d|_dS)Nr6rF)ÚcodecsÚIncrementalDecoderr’Ú translateÚdecoderÚseennlÚ pendingcr)rGrùrør6rBrBrCr’ s    z"IncrementalNewlineDecoder.__init__FcCs+|jdkr|}n|jj|d|ƒ}|jrX|sE|rXd|}d|_|jdƒr‡| r‡|dd…}d|_|jdƒ}|jdƒ|}|jdƒ|}|j|oÏ|j|oÛ|jB|oè|jBO_|j r'|r|j ddƒ}|r'|j ddƒ}|S) NÚfinalú Fr Tz Ú r) rùÚdecoderûrtrÍrúÚ_LFÚ_CRÚ_CRLFrøÚreplace)rGÚinputrüÚoutputZcrlfZcrZlfrBrBrCrÿs(    + z IncrementalNewlineDecoder.decodecCsZ|jdkrd}d}n|jjƒ\}}|dK}|jrP|dO}||fS)Nr¢rr )rùÚgetstaterû)rGr›ÚflagrBrBrCr1s    z"IncrementalNewlineDecoder.getstatecCsL|\}}t|d@ƒ|_|jdk rH|jj||d?fƒdS)Nr )ÚboolrûrùÚsetstate)rGÚstater›rrBrBrCr <s z"IncrementalNewlineDecoder.setstatecCs2d|_d|_|jdk r.|jjƒdS)NrF)rúrûrùÚreset)rGrBrBrCr Bs  zIncrementalNewlineDecoder.resetr r éc Cs d|jS) Nrþrýú ©rýrþ©rþr ©rýr ©rýrþr )Nrþrýrr rrr)rú)rGrBrBrCróLsz"IncrementalNewlineDecoder.newlinesN)rKrLrMrFr’rÿrr r rrrr�rórBrBrBrCrôs   rôc@sðeZdZdZdZddddddd„Zdd„Zed d „ƒZed d „ƒZ ed d„ƒZ edd„ƒZ dd„Z dd„Z dd„Zdd„Zdd„Zedd„ƒZedd„ƒZdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zdd+d,„Zd-d.„Zd/d0„Zd1d1d1d1d2d3„Zd4d5„Zd6d7„Zdd8d9„Zd:d;„Z d1d<d=„Z!dd>d?„Z"d@dA„Z#ddBdC„Z$edDdE„ƒZ%dS)Fr0aCharacter and line based layer over a BufferedIOBase object, buffer. encoding gives the name of the encoding that the stream will be decoded or encoded with. It defaults to locale.getpreferredencoding(False). errors determines the strictness of encoding and decoding (see the codecs.register) and defaults to "strict". newline can be None, '', '\n', '\r', or '\r\n'. It controls the handling of line endings. If it is None, universal newlines is enabled. With this enabled, on input, the lines endings '\n', '\r', or '\r\n' are translated to '\n' before being returned to the caller. Conversely, on output, '\n' is translated to the system default line separator, os.linesep. If newline is any other of its legal values, that newline becomes the newline when the file is read and it is returned untranslated. On output, '\n' is converted to the newline. If line_buffering is True, a call to flush is implied when a call to write contains a newline character. iNFc Cs€|dk r5t|tƒ r5tdt|ƒfƒ‚|dkrTtd|fƒ‚|dkrÚytj|jƒƒ}Wntt fk r“YnX|dkrÚyddl }Wnt k rÊd}YnX|j d ƒ}t|tƒsùtd |ƒ‚t j|ƒjs!d }t||ƒ‚|dkr6d }nt|tƒsUtd |ƒ‚||_||_||_||_| |_|dk|_||_|dk|_|p¶tj|_d|_d|_d|_d|_d|_|j j!ƒ|_"|_#t$|j dƒ|_%d|_&|j"r||j'ƒr||j j(ƒ} | dkr|y|j)ƒj*dƒWntk r{YnXdS)Nzillegal newline type: %rrrþrýú zillegal newline value: %rrÚasciiFzinvalid encoding: %rzG%r is not a text encoding; use codecs.open() to handle arbitrary codecsrõzinvalid errors: %rr‰g)Nrrþrýr)+rrrÚtyper r'Údevice_encodingr)r,rSÚlocaleÚ ImportErrorÚgetpreferredencodingröÚlookupÚ_is_text_encodingÚ LookupErrorr™Ú_line_bufferingÚ _encodingÚ_errorsÚ_readuniversalÚ_readtranslateÚ_readnlÚ_writetranslateÚlinesepÚ_writenlÚ_encoderÚ_decoderÚ_decoded_charsÚ_decoded_chars_usedÚ _snapshotrArarìÚ_tellingrqÚ _has_read1Ú _b2cratiorfr[Ú _get_encoderr ) rGrAr5r6r7r?Ú write_throughrrbÚpositionrBrBrCr’vs`                     zTextIOWrapper.__init__cCsœdj|jj|jjƒ}y |j}Wntk r?YnX|dj|ƒ7}y |j}Wntk rtYnX|dj|ƒ7}|dj|jƒS)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r“rUrLrMrVr•r1r5)rGr>rVr1rBrBrCr—¼s    zTextIOWrapper.__repr__cCs|jS)N)r)rGrBrBrCr5ÍszTextIOWrapper.encodingcCs|jS)N)r)rGrBrBrCr6ÑszTextIOWrapper.errorscCs|jS)N)r)rGrBrBrCr?ÕszTextIOWrapper.line_bufferingcCs|jS)N)r™)rGrBrBrCrAÙszTextIOWrapper.buffercCs|jrtdƒ‚|jS)NzI/O operation on closed file.)rhr rì)rGrBrBrCraÝs  zTextIOWrapper.seekablecCs |jjƒS)N)rArd)rGrBrBrCrdâszTextIOWrapper.readablecCs |jjƒS)N)rArf)rGrBrBrCrfåszTextIOWrapper.writablecCs|jjƒ|j|_dS)N)rAr^rìr*)rGrBrBrCr^ès zTextIOWrapper.flushc Cs<|jdk r8|j r8z|jƒWd|jjƒXdS)N)rArhr^r2)rGrBrBrCr2ìszTextIOWrapper.closecCs |jjS)N)rArh)rGrBrBrCrhószTextIOWrapper.closedcCs |jjS)N)rArV)rGrBrBrCrV÷szTextIOWrapper.namecCs |jjƒS)N)rAr))rGrBrBrCr)ûszTextIOWrapper.filenocCs |jjƒS)N)rAr%)rGrBrBrCr%þszTextIOWrapper.isattycCs|jrtdƒ‚t|tƒs:td|jjƒ‚t|ƒ}|jsX|j oad|k}|r—|jr—|j dkr—|j d|j ƒ}|j p©|j ƒ}|j|ƒ}|jj|ƒ|j rð|sæd|krð|jƒd|_|jr|jjƒ|S)zWrite data, where s is a strzwrite to closed filezcan't write %s to text streamrþrýN)rhr rrrrUrKrr"rr$rr%r-ÚencoderArr^r)r&r )rGròÚlengthZhaslfÚencoderrrBrBrCrs$       zTextIOWrapper.writecCs+tj|jƒ}||jƒ|_|jS)N)röÚgetincrementalencoderrrr%)rGZ make_encoderrBrBrCr-szTextIOWrapper._get_encodercCsItj|jƒ}||jƒ}|jr<t||jƒ}||_|S)N)röÚgetincrementaldecoderrrrrôr r&)rGZ make_decoderrùrBrBrCÚ _get_decoders   zTextIOWrapper._get_decodercCs||_d|_dS)zSet the _decoded_chars buffer.rN)r'r()rGÚcharsrBrBrCÚ_set_decoded_chars's z TextIOWrapper._set_decoded_charscCs[|j}|dkr+|j|d…}n|j|||…}|jt|ƒ7_|S)z'Advance into the _decoded_chars buffer.N)r(r'r)rGrnÚoffsetr6rBrBrCÚ_get_decoded_chars,s   z TextIOWrapper._get_decoded_charscCs.|j|krtdƒ‚|j|8_dS)z!Rewind the _decoded_chars buffer.z"rewind decoded_chars out of boundsN)r(ÚAssertionError)rGrnrBrBrCÚ_rewind_decoded_chars6s z#TextIOWrapper._rewind_decoded_charscCsç|jdkrtdƒ‚|jr9|jjƒ\}}|jrZ|jj|jƒ}n|jj|jƒ}| }|jj ||ƒ}|j |ƒ|r½t |ƒt |j ƒ|_ n d|_ |jrâ|||f|_| S)zQ Read and decode the next chunk of data from the BufferedReader. Nz no decoderg)r&r r*rr+rAr‰Ú _CHUNK_SIZErsrÿr7rr'r,r))rGÚ dec_bufferÚ dec_flagsÚ input_chunkÚeofZ decoded_charsrBrBrCÚ _read_chunk<s       zTextIOWrapper._read_chunkrcCs*||d>B|d>B|d>Bt|ƒd>BS)Né@é€éÀé)r)rGr/r>Ú bytes_to_feedÚneed_eofÚ chars_to_skiprBrBrCÚ _pack_cookiefszTextIOWrapper._pack_cookiecCsgt|dƒ\}}t|dƒ\}}t|dƒ\}}t|dƒ\}}|||||fS)Nr rBllll)Údivmod)rGZbigintÚrestr/r>rFrGrHrBrBrCÚ_unpack_cookieps zTextIOWrapper._unpack_cookiecCs|jstdƒ‚|js*tdƒ‚|jƒ|jjƒ}|j}|dksg|jdkr€|j r|t dƒ‚|S|j\}}|t |ƒ8}|j }|dkrÄ|j ||ƒS|jƒ}z4t|j|ƒ}d}|t |ƒkst ‚x½|dkrª|jd|fƒt |j|d|…ƒƒ} | |kr“|jƒ\} } | sz| }|| 8}P|t | ƒ8}d}q||8}|d}qWd}|jd|fƒ||} |} |dkrð|j | | ƒSd}d}d}xåt|t |ƒƒD]‘}|d7}|t |j|||d…ƒƒ7}|jƒ\}}| rœ||krœ| |7} ||8}|dd} }}||krPqW|t |jddd ƒƒ7}d}||krêtd ƒ‚|j | | |||ƒSWd|j|ƒXdS) Nz!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr r¢r rüTz'can't reconstruct logical file position)rìrSr*r+r^rAr[r&r)r'r:rr(rIrrr,r rÿÚrange)rGr/rùr>Z next_inputrHÚ saved_stateZ skip_bytesZ skip_backrnrÚdÚ start_posZ start_flagsZ bytes_fedrGZ chars_decodedÚir=rBrBrCr[wsx                  '     zTextIOWrapper.tellcCs2|jƒ|dkr"|jƒ}|jj|ƒS)N)r^r[rAr\)rGrYrBrBrCr\Ús   zTextIOWrapper.truncatecCs;|jdkrtdƒ‚|jƒ|j}d|_|S)Nzbuffer is already detached)rAr r^r™)rGrArBrBrCr�às     zTextIOWrapper.detachc sm‡fdd†}ˆjr'tdƒ‚ˆjs<tdƒ‚|dkrr|dkr`tdƒ‚d}ˆjƒ}|dkrï|dkr–td ƒ‚ˆjƒˆjjddƒ}ˆjd ƒdˆ_ ˆj ráˆj j ƒ||ƒ|S|dkrtd |fƒ‚|dkr-td |fƒ‚ˆjƒˆj |ƒ\}}}}} ˆjj|ƒˆjd ƒdˆ_ |dkr ˆj r ˆj j ƒnRˆj sµ|sµ| ròˆj pLjj ƒˆ_ ˆj jd |fƒ|d fˆ_ | r_ˆjj|ƒ} ˆjˆj j| |ƒƒ|| fˆ_ tˆjƒ| krVtdƒ‚| ˆ_||ƒ|S)Nc sXyˆjpˆjƒ}Wntk r-Yn'X|dkrJ|jdƒn |jƒdS)z9Reset the encoder (merely useful for proper BOM handling)rN)r%r-rr r )r/r2)rGrBrCÚ_reset_encoderés  z*TextIOWrapper.seek.._reset_encoderztell on closed filez!underlying stream is not seekabler rz#can't do nonzero cur-relative seeksr z#can't do nonzero end-relative seeksrzunsupported whence (%r)znegative seek position %rr¢z#can't restore logical file position)rhr rìrSr[r^rArXr7r)r&r rLr5r rsrÿrr'r+r() rGZcookierZrRr/rPr>rFrGrHr?rB)rGrCrXès\                         zTextIOWrapper.seekcCs(|jƒ|dkrd}|jp.|jƒ}y |jWn4tk rr}ztdƒ|‚WYdd}~XnX|dkrÁ|jƒ|j|jj ƒddƒ}|j dƒd|_ |Sd}|j|ƒ}xGt |ƒ|kr| r|j ƒ }||j|t |ƒƒ7}qÙW|SdS) Nr zan integer is requiredrrüTrFr)rer&r5r…r,rr9rÿrArsr7r)rrA)rGrorùr¦r>r@rBrBrCrs3 s(   "     !zTextIOWrapper.readcCs:d|_|jƒ}|s6d|_|j|_t‚|S)NF)r*rvr)rìrx)rGryrBrBrCrzL s    zTextIOWrapper.__next__cCsn|jrtdƒ‚|dkr*d }nt|tƒsEtdƒ‚|jƒ}d}|jsj|jƒd}}x´|jr»|j d|ƒ}|dkr¬|d}Pq¯t |ƒ}nô|j r}|j d|ƒ}|j d|ƒ}|d kr|d krt |ƒ}qz|d}Pq¯|d kr7|d}Pq¯||krQ|d}Pq¯||dkro|d}Pq¯|d}Pn2|j |j ƒ}|dkr¯|t |j ƒ}P|dkrÔt |ƒ|krÔ|}Px|j ƒrð|jr×Pq×W|jr ||jƒ7}qw|jdƒd|_|SqwW|dkrI||krI|}|jt |ƒ|ƒ|d|…S) Nzread from closed filer zsize must be an integerrrþrýr rrrrr)rhr rrrr9r&r5r rlrrr!rAr'r7r)r;)rGroryÚstartrYÚendposZnlposZcrposrBrBrCrvU sp                           zTextIOWrapper.readlinecCs|jr|jjSdS)N)r&ró)rGrBrBrCró­ szTextIOWrapper.newlines)&rKrLrMrFr<r’r—r�r5r6r?rArardrfr^r2rhrVr)r%rr-r5r7r9r;rArIrLr[r\r�rXrsrzrvrórBrBrBrCr0YsH  E             *  c K Xr0csveZdZdZdd‡fdd†Zdd„Zdd „Zed d „ƒZed d „ƒZ dd„Z ‡S)ÚStringIOz»Text I/O implementation using an in-memory buffer. The initial_value argument sets the value of object. The newline argument is like the one of TextIOWrapper's constructor. rrþcs—tt|ƒjtƒddddd|ƒ|dkr@d|_|dk r“t|tƒsytdjt |ƒj ƒƒ‚|j |ƒ|j dƒdS) Nr5zutf-8r6Ú surrogatepassr7Fz*initial_value must be str or None, not {0}r) r¡rUr’r˜r"rrrr“rrKrrX)rGZ initial_valuer7)rUrBrCr’¹ s     zStringIO.__init__c Csj|jƒ|jp|jƒ}|jƒ}|jƒz |j|jjƒddƒSWd|j|ƒXdS)NrüT) r^r&r5rr rÿrAržr )rGrùZ old_staterBrBrCržÉ s    zStringIO.getvaluecCs tj|ƒS)N)Úobjectr—)rGrBrBrCr—Ó szStringIO.__repr__cCsdS)NrB)rGrBrBrCr6Ø szStringIO.errorscCsdS)NrB)rGrBrBrCr5Ü szStringIO.encodingcCs|jdƒdS)Nr�)rW)rGrBrBrCr�à szStringIO.detach) rKrLrMrFr’ržr—r�r6r5r�rBrB)rUrCrU² s  rU)6rFr'Úabcrör¼ÚarrayrÛÚsysÚ_threadrr©rÚ _dummy_threadÚplatformÚmsvcrtrràÚiorrrr r¶rqÚaddr Ú SEEK_DATAr&r»rDrErNrSr,r+r ÚABCMetarTÚregisterrƒÚ_ior$rˆr�r˜r/r.rÁr-rñr÷rôr0rUrBrBrBrCÚsl         "  Ñ   ÿ = giÂZIJÿTAUÿÿ[