\dTodZddlZddlZddlZddlZddlZddlZddlmZ ej dvrddl m Z ndZ ddlZddlmZmZmZmZhdZeedr4eejeejd ZeZeed p ejjZeZd3d Ze d4dZ dZ! ej"Z"n #e#$re!Z"YnwxYwdZ$ ej%Z%n#e#$rGdde&e'Z%YnwxYwGddej(Z)ej)*e)Gdde)Z+ej+*e+ddl,m-Z-e+*e-Gdde)Z.ej.*e.Gdde.Z/Gdd e.Z0Gd!d"e/Z1Gd#d$e/Z2Gd%d&e.Z3Gd'd(e2e1Z4Gd)d*e+Z-Gd+d,e)Z5ej5*e5Gd-d.ej6Z7Gd/d0e5Z8Gd1d2e8Z9dS)5z) Python implementation of the io module. N) allocate_lock>win32cygwin)setmode)__all__SEEK_SETSEEK_CURSEEK_END>r SEEK_HOLEi gettotalrefcountr c|Jtjjrd}nd}tjjr#ddl}|dt |dz|S)a A helper function to choose the text encoding. When encoding is not None, this function returns it. Otherwise, this function returns the default text encoding (i.e. "locale" or "utf-8" depends on UTF-8 mode). This function emits an EncodingWarning if *encoding* is None and sys.flags.warn_default_encoding is true. This can be used in APIs with an encoding=None parameter that pass it to TextIOWrapper or open. However, please consider using encoding="utf-8" for new APIs. Nutf-8localerz"'encoding' argument not specified.r )sysflags utf8_modewarn_default_encodingwarningswarnEncodingWarning)encoding stacklevelrs ..\python\lib\_pyio.py text_encodingr+s` 9  HHH 9 * ; OOO MM>):> ; ; ; OrTc*t|tstj|}t|tt tfst d|zt|tst d|zt|tst d|z|'t|tst d|z|'t|tst d|zt|}|tdz s t|t|krtd|zd|v} d |v} d |v} d |v} d |v} d |v}d|v}|r|rtd| | z| z| zdkrtd| s| s| s| std|r|td|r|td|r|td|r&|dkr ddl }| dtdt|| rdpd| rd pdz| rd pdz| rd pdz| rd pdz||}|} d}|dks|dkr|rd}d}|dkrSt} tj|j}|dkr|}n#t&t(f$rYnwxYw|dkrtd|dkr|r|Std| rt+||}n<| s| s| rt-||}n%| rt/||}ntd |z|}|r|St1|}t3|||||}|}||_|S#|xYw)!aOpen 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) ========= =============================================================== 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. 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: %rNinvalid encoding: %rinvalid errors: %rzaxrwb+txrwa+tbz'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 argumentrzaline buffering (buffering=1) isn't supported in binary mode, the default buffer size will be usedr )openerFrTzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r) isinstanceintosfspathstrbytes TypeErrorsetlen ValueErrorrrRuntimeWarningFileIOisattyDEFAULT_BUFFER_SIZEfstatfileno st_blksizeOSErrorAttributeErrorBufferedRandomBufferedWriterBufferedReaderr TextIOWrappermodeclose)filerB bufferingrerrorsnewlineclosefdr*modescreatingreadingwriting appendingupdatingtextbinaryrrawresultline_bufferingbsbuffers ropenrVLsn dC y dS%- . .3*T1222 dC 3*T1222 i % %=/);<<<Jx$=$=.9::: *VS"9"9,v5666 IIE s9~~4TSZZ!7!7+d2333e|HUlGUlGu Ie|H %>Y]]szz||]I!N q==+I #Xcjjll++666 "I ^,     q==566 6 >>  =>> >  8#C33FF  8 8I 8#C33FF  8#C33FF/$677 7  M **VXvwOO    s= 3M;+J4+ M;4KM;K!M;*A#M;,M;;Ncbddl}|dtdt|dS)azOpens the provided file with mode ``'rb'``. This function should be used when the intent is to treat the contents as executable code. ``path`` should be an absolute path. When supported by the runtime, this function can be hooked in order to allow embedders more control over code files. This functionality is not supported on the current runtime. rNz(_pyio.open_code() may not be using hooksr rb)rrr5rV)pathrs r_open_code_with_warningrZs;OOO MM< !%%% d  rc|dkr/ddl}|dtdtatSt dt d|)N OpenWrapperrz+OpenWrapper is deprecated, use open insteadr )rzmodule z has no attribute )rrDeprecationWarningrVr\r=__name__)namers r __getattr__r`2sg }  C(Q  8 8 8  I8IIII J JJrceZdZdS)UnsupportedOperationN)r^ __module__ __qualname__rrrbrbGs rrbceZdZdZdZddZdZddZdZd Z d Z d Z d Z dd Z dZddZdZddZedZddZdZdZdZdZd dZdZdZddZdZdS)!IOBaseaThe abstract base class for all I/O classes. 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 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. 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!') c@t|jjd|d)z@Internal: raise an OSError exception for unsupported operations..z() not supported)rb __class__r^)selfr_s r _unsupportedzIOBase._unsupportedms1"$(N$;$;$;TTT$CDD Drrc0|ddS)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. seekNrlrkposwhences rrnz IOBase.seekts &!!!!!rc.|ddS)z5Return an int indicating the current stream position.rr )rnrks rtellz IOBase.tellsyyArNc0|ddS)zTruncate file to size bytes. Size defaults to the current IO position as reported by tell(). Return the new size. truncateNrorkrqs rrwzIOBase.truncate *%%%%%rc.|dS)zuFlush write buffers, if applicable. This is not implemented for read-only and non-blocking streams. N _checkClosedrts rflushz IOBase.flushs rFch|js* |d|_dS#d|_wxYwdS)ziFlush and close the IO object. This method has no effect if the file is already closed. TN)_IOBase__closedr}rts rrCz IOBase.closesH } % % $  $$$$  % %s& /c |j}n#t$rYdSwxYw|rdStr|dS |dS#YdSxYw)zDestructor. Calls close().N)closedr=_IOBASE_EMITS_UNRAISABLErC)rkrs r__del__zIOBase.__del__s [FF    FF    F #  JJLLLLL   s AAcdS)zReturn 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(). Frerts rseekablezIOBase.seekables urcT|st|dn|dS)zEInternal: raise UnsupportedOperation if file is not seekable NzFile or stream is not seekable.)rrbrkmsgs r_checkSeekablezIOBase._checkSeekableG}} @&*-+(I'H;>@@ @ @ @rcdS)zvReturn a bool indicating whether object was opened for reading. If False, read() will raise OSError. Frerts rreadablezIOBase.readable urcT|st|dn|dS)zEInternal: raise UnsupportedOperation if file is not readable NzFile or stream is not readable.)rrbrs r_checkReadablezIOBase._checkReadablerrcdS)zReturn a bool indicating whether object was opened for writing. If False, write() and truncate() will raise OSError. Frerts rwritablezIOBase.writablerrcT|st|dn|dS)zEInternal: raise UnsupportedOperation if file is not writable NzFile or stream is not writable.)rrbrs r_checkWritablezIOBase._checkWritablerrc|jS)zclosed: bool. True iff the file has been closed. For backwards compatibility, this is a property, not a predicate. )rrts rrz IOBase.closeds }rc:|jrt|dn|dS)z7Internal: raise a ValueError if file is closed NI/O operation on closed file.rr4rs rr|zIOBase._checkCloseds: ; 6 # =<1466 6 6 6rc.||S)zCContext management protocol. Returns self (an instance of IOBase).r{rts r __enter__zIOBase.__enter__s  rc.|dS)z+Context management protocol. Calls close()N)rC)rkargss r__exit__zIOBase.__exit__s rc0|ddS)zReturns underlying file descriptor (an int) if one exists. An OSError is raised if the IO object does not use a file descriptor. r:Nrorts rr:z IOBase.fileno s (#####rc.|dS)z{Return a bool indicating whether this is an 'interactive' stream. Return False if it can't be determined. Fr{rts rr7z IOBase.isattys urrctdrfd}nd}dn3 j}|n #t$rtdwxYwt }dkst |krT|}|sn4||z }|drndkAt |kTt|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. peekcd}|sdS|ddzpt|}dkrt|}|S)Nr  r)rfindr3min) readaheadnrksizes r nreadaheadz#IOBase.readline..nreadahead(s[ IIaLL  1^^E**Q.A3y>>199At ArcdSNr rererrrz#IOBase.readline..nreadahead1sqrNr is not an integerrr) hasattr __index__r=r1 bytearrayr3readendswithr0)rkrr size_indexresr(s`` rreadlinezIOBase.readlines0 4            <DD $!^ "z||" ? ? ?4 = = =>>> ?kkQhh#c((T// **,,''A  1HC||E""  Qhh#c((T//Szzs 5Ac.||SNr{rts r__iter__zIOBase.__iter__Fs  rc@|}|st|Sr)r StopIterationrklines r__next__zIOBase.__next__Js"}}   rc||dkrt|Sd}g}|D]1}|||t|z }||krn2|S)zReturn 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)listappendr3)rkhintrlinesrs r readlineszIOBase.readlinesPso <4199::    D LL    TNADyy rcb||D]}||dS)zWrite a list of lines to the stream. Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end. N)r|write)rkrrs r writelineszIOBase.writelinesbsD   D JJt      rrrr)r^rcrd__doc__rlrnrurwr}rrCrrrrrrrpropertyrr|rrr:r7rrrrrrerrrgrgKs@DDD"""" &&&&H % % %6@@@@@@@@@@@@X6666 $$$((((T $rrg) metaclassc,eZdZdZddZdZdZdZdS) RawIOBasezBase class for raw binary I/O.rc|d}|dkr|St|}||}|dS||d=t |S)zRead 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. Nrr)readallrrreadintor0)rkrr(rs rrzRawIOBase.read}sm <D !88<<>> ! dnn&& ' ' MM!   94 abbEQxxrct} |t}|sn||z }#|rt|S|S)z+Read until EOF, using multiple read() call.)rrr8r0)rkrdatas rrzRawIOBase.readallsXkk 99011D  4KC    :: Krc0|ddS)zRead 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. rNrorkr(s rrzRawIOBase.readintoryrc0|ddS)zWrite the given buffer to the IO stream. Returns the number of bytes written, which may be less than the length of b in bytes. rNrors rrzRawIOBase.writes '"""""rNr)r^rcrdrrrrrrerrrros[(("   &&&#####rr)r6c@eZdZdZd dZd dZdZdZdZdZ d Z d S) 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. rc0|ddS)aRead 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. rNrorkrs rrzBufferedIOBase.reads$ &!!!!!rc0|ddS)zaRead up to size bytes with at most one read() system call, where size is an int. read1Nrors rrzBufferedIOBase.read1s '"""""rc0||dS)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. Fr _readintors rrzBufferedIOBase.readintos~~au~---rc0||dS)zRead 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. Trrrs r readinto1zBufferedIOBase.readinto1s~~at~,,,rc2t|tst|}|d}|r#|t |}n"|t |}t |}||d|<|S)NB)r+ memoryviewcastrr3r)rkr(rrrs rrzBufferedIOBase._readintos!Z(( 1 A FF3KK  %::c!ff%%DD99SVV$$D II"1"rc0|ddS)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. rNrors rrzBufferedIOBase.writes '"""""rc0|ddS)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. detachNrorts rrzBufferedIOBase.detach (#####rNr) r^rcrdrrrrrrrrrerrrrs  """"(#### . . . - - -    # # #$$$$$rrceZdZdZdZddZdZddZdZd Z d Z d Z e d Z e d Ze dZe dZdZdZdZdZdS)_BufferedIOMixinzA 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(). c||_dSr_rawrkrQs r__init__z_BufferedIOMixin.__init__$s  rrcf|j||}|dkrtd|S)Nrz#seek() returned an invalid position)rQrnr<)rkrqrr new_positions rrnz_BufferedIOMixin.seek)s7x}}S&11 !  ?@@ @rcb|j}|dkrtd|S)Nrz#tell() returned an invalid position)rQrur<rxs rruz_BufferedIOMixin.tell/s.hmmoo 77?@@ @ rNc|||||}|j|Sr)r|rr}rurQrwrxs rrwz_BufferedIOMixin.truncate5s_   ;))++Cx  %%%rcd|jrtd|jdS)Nflush on closed file)rr4rQr}rts rr}z_BufferedIOMixin.flushFs3 ; 5344 4 rc|jU|jsP ||jdS#|jwxYwdSdSr)rQrr}rCrts rrCz_BufferedIOMixin.closeKsa 8   !             ?Acv|jtd||j}d|_|S)Nzraw stream already detached)rQr4r}rrs rrz_BufferedIOMixin.detachSs9 8 :;; ; i  rc4|jSr)rQrrts rrz_BufferedIOMixin.seekable]x  """rc|jSrrrts rrQz_BufferedIOMixin.raw`s yrc|jjSr)rQrrts rrz_BufferedIOMixin.closedds xrc|jjSr)rQr_rts rr_z_BufferedIOMixin.nameh x}rc|jjSr)rQrBrts rrBz_BufferedIOMixin.modelrrc<td|jjdNzcannot pickle z objectr1rjr^rts r __getstate__z_BufferedIOMixin.__getstate__p!K)@KKKLLLrc|jj}|jj} |j}d|||S#t $rd||cYSwxYw)Nz<{}.{} name={!r}>z<{}.{}>)rjrcrdr_formatr=)rkmodnameclsnamer_s r__repr__z_BufferedIOMixin.__repr__ssv.+.- F9D'--gwEE E 6 6 6##GW55 5 5 5 6s8 AAc4|jSr)rQr:rts rr:z_BufferedIOMixin.filenox   rc4|jSr)rQr7rts rr7z_BufferedIOMixin.isattyr rrr)r^rcrdrrrnrurwr}rCrrrrQrr_rBrrr:r7rerrrrsN   & & & &" !!!###XXXXMMMFFF!!!!!!!!rrc~eZdZdZdZddZdZdZdZfdZ dd Z dd Z d Z dd Z dZddZdZdZdZxZS)BytesIOz>> ? !88t|$$D t|   ) )3S&& D(899 LV+ , Qxx /A c,||S)z"This is the same as read. )rrs rrz BytesIO.read1syyrc|jrtdt|trt dt |5}|j}dddn #1swxYwY|dkrdS|j}|t|j kr*d|t|j z z}|xj |z c_ ||j |||z<|xj|z c_|S)Nwrite to closed file can't write str to binary streamr) rr4r+r/r1rnbytesrr3r)rkr(viewrrqpaddings rrz BytesIO.writes ; 5344 4 a   @>?? ? ]] d A                661i T\"" " "s4<'8'8!89G LLG #LL$% Sq[! Q s AA"%A"rc|jrtd |j}|}n #t$rt |dwxYw|dkr |dkrtd|||_nd|dkrt d|j|z|_n@|dkr+t dt|j|z|_ntd|jS)Nzseek on closed filerrnegative seek position r r zunsupported whence value) rr4rr=r1rmaxr3r)rkrqrr pos_indexs rrnz BytesIO.seeks ; 4233 3  I)++CC : : :s88899 9 : Q;;Qww j!EFFFDII q[[Aty3//DII q[[As4<003677DII788 8ys *Ac<|jrtd|jS)Ntell on closed file)rr4rrts rruz BytesIO.tells# ; 4233 3yrc|jrtd||j}nK |j}|}n #t$rt |dwxYw|dkrtd||j|d=|S)Nztruncate on closed filerrznegative truncate position )rr4rrr=r1r)rkrqr.s rrwzBytesIO.truncates ; 8677 7 ;)CC "M  ikk" > > >3 < < <=== >Qww jCC!IJJJ L  s 4Ac2|jrtddSNrTrrts rrzBytesIO.readable ; ><== =trc2|jrtddSr3rrts rrzBytesIO.writable r4rc2|jrtddSr3rrts rrzBytesIO.seekabler4rrrr)r^rcrdrrrrrrrCrrrrnrurwrrr __classcell__rjs@rr r s!FFG$$$ ###((( * &* "  rr cdeZdZdZefdZdZdZddZddZ dd Z dd Z dd Z d Z dZddZdS)r@aBufferedReader(raw[, buffer_size]) A buffer for a readable, sequential BaseRawIO object. The constructor creates a BufferedReader for the given readable raw stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE is used. c|stdt|||dkrt d||_|t|_dS)zMCreate a new buffered reader using the given readable raw IO object. z "raw" argument must be readable.rinvalid buffer sizeN) rr<rrr4 buffer_size_reset_read_bufLock _read_lockrkrQr<s rrzBufferedReader.__init__ s|||~~ ><== =!!$,,, !  233 3& &&rc4|jSr)rQrrts rrzBufferedReader.readable-rrc"d|_d|_dS)Nrr) _read_buf _read_posrts rr=zBufferedReader._reset_read_buf0srNc||dkrtd|j5||cdddS#1swxYwYdS)zRead size bytes. Returns exactly size bytes of data unless the underlying raw IO stream reaches EOF or if the call would block in non-blocking mode. If size is negative, read until EOF or until read() would block. Nrzinvalid number of bytes to read)r4r?_read_unlockedrs rrzBufferedReader.read4s  r >?? ? _ - -&&t,, - - - - - - - - - - - - - - - - - -sAAAcd}d}|j}|j}||dkr|t|jdr4|j}| ||dpdS||d|zS||dg}d} |j}||vr|}n(|t|z }||Hd |p|St||z } || kr|xj|z c_||||zS||dg}t|j |} | |krN|j| }||vr|}n-| t|z } ||| |kNt|| }d |} | |d|_d|_| r | d|n|S)Nr)rNrrr) rCrDr=rrQrrr3rjoinr-r<r) rkr nodata_val empty_valuesrrqchunkchunks current_sizeavailwantedouts rrFzBufferedReader._read_unlockedAs " nn 9R  " " "tx++ -((**=stt9,,stt9u,,#$$i[FL % L((!&JE *  e$$$ %88F##1z 1C3 :: NNa NNs3q5y> !cdd)T%q))aiiHMM&))E $$"  SZZ E MM% aii 5MMhhvQRR-s2A2ww:-rrcn|j5||cdddS#1swxYwYdS)zReturns buffered bytes without advancing the position. The argument indicates a desired minimal number of bytes; we do at most one raw read to satisfy it. We never return more than self.buffer_size. N)r?_peek_unlockedrs rrzBufferedReader.peekus_ - -&&t,, - - - - - - - - - - - - - - - - - - *..c6t||j}t|j|jz }||ks|dkrI|j|z }|j|}|r#|j|jd|z|_d|_|j|jdSr)rr<r3rCrDrQr)rkrwanthaveto_readcurrents rrRzBufferedReader._peek_unlockeds1d&''4>""T^3 $;;$!))&-GhmmG,,G #!%!@7!J!"~dnoo..rrc |dkr|j}|dkrdS|j5|d|t |t |j|jz cdddS#1swxYwYdS)z??AA A A A A A A A A A A A A A A A A A AsAA<<BBct|tst|}|jdkrdS|d}d}|j5|t |krt t |j|jz t |}|rM|j|j|j|z||||z<|xj|z c_||z }|t |krnxt ||z |j kr+|j ||d}|sn8||z }n|r|s| dsn|r|rn|t |kdddn #1swxYwY|S)z2Read data into *buf* with at most one system call.rrNr ) r+rr(rr?r3rrCrDr<rQrrR)rkrrwrittenrNrs rrzBufferedReader._readintos #z** "S//C :??1hhsmm _  CHH$$C//$.@#c((KKt~dnU6J'JK -.NNe+NNu$G#c((**s88g%(888))#ghh-88AqLGG G..q11W9CHH$$               >sDE..E25E2cpt|t|jz |jzSr)rrur3rCrDrts rruzBufferedReader.tells,$$T**S-@-@@4>QQrc"|tvrtd|j5|dkr|t|j|jz z}t |||}||cdddS#1swxYwYdS)Ninvalid whence valuer ) valid_seek_flagsr4r?r3rCrDrrnr=rps rrnzBufferedReader.seeks ) ) )344 4 _  {{s4>**T^;;"''c6::C  " " "                   sABB Brrr)r^rcrdrr8rrr=rrFrrRrrrurnrerrr@r@s)< ! ! ! !### - - - -2.2.2.2.h---- / / / / A A A A$,,,\RRRrr@cPeZdZdZefdZdZdZd dZdZ dZ d Z dd Z d Z dS)r?zA buffer for a writeable sequential RawIO object. The constructor creates a BufferedWriter for the given writeable raw stream. If the buffer_size is not given, it defaults to DEFAULT_BUFFER_SIZE. c|stdt|||dkrt d||_t |_t|_ dS)Nz "raw" argument must be writable.rr;) rr<rrr4r<r _write_bufr> _write_lockr@s rrzBufferedWriter.__init__sv||~~ ><== =!!$,,, !  233 3&#++66rc4|jSr)rQrrts rrzBufferedWriter.writablerrc t|trtd|j5|jrt dt |j|jkr| t |j}|j |t |j|z }t |j|jkr | n#t$r|}t |j|jkrUt |j|jz }||z}|jd|j|_t|j |j |Yd}~nd}~wwxYw|cdddS#1swxYwYdS)Nr&r%)r+r/r1rcrr4r3rbr<_flush_unlockedextendBlockingIOErrorerrnostrerror)rkr(beforer[eoverages rrzBufferedWriter.writes a   @>?? ?    { 9 !78884?##d&666$$&&&))F O " "1 % % %$/**V3G4?##d&666 L((****&LLL4?++d.>>>#&do"6"69I"I7**./:K4;K:K*L-agqz7KKK ?>>>>L/                  s=B*FC,+F, E26A2E-(F-E22FF FNc|j5|||j}|j|cdddS#1swxYwYdSr)rcrfrQrurwrxs rrwzBufferedWriter.truncate s   * *  " " "{hmmoo8$$S))  * * * * * * * * * * * * * * * * * *sA AA"%A"cn|j5|ddddS#1swxYwYdSr)rcrfrts rr}zBufferedWriter.flushs   # #  " " " # # # # # # # # # # # # # # # # # #rScv|jrtd|jr |j|j}n#t $rt dwxYw|t tjdd|t|jks|dkrtd|jd|=|jdSdS)NrzHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes) rr4rbrQrrh RuntimeErrorriEAGAINr3r<rkrs rrfzBufferedWriter._flush_unlockeds ; 5344 4o $ GHNN4?33" G G G"$FGGG Gy%L?DDD3t''''1q55JKKK#o $ $ $ $ $s ?Ac`t|t|jzSr)rrur3rbrts rruzBufferedWriter.tell&s%$$T**S-A-AAArrc|tvrtd|j5|t|||cdddS#1swxYwYdS)Nr^)r_r4rcrfrrnrps rrnzBufferedWriter.seek)s ) ) )344 4   < <  " " "#((sF;; < < < < < < < < < < < < < < < < < |d}|j|SNr)rzrrs rrzBufferedRWPair.read^s" <D{%%%rc6|j|Sr)rzrrs rrzBufferedRWPair.readintocs{##A&&&rc6|j|Sr)r{rrs rrzBufferedRWPair.writefs{  ###rrc6|j|Sr)rzrrs rrzBufferedRWPair.peekis{%%%rc6|j|Sr)rzrrs rrzBufferedRWPair.read1ls{  &&&rc6|j|Sr)rzrrs rrzBufferedRWPair.readinto1os{$$Q'''rc4|jSr)rzrrts rrzBufferedRWPair.readabler{##%%%rc4|jSr)r{rrts rrzBufferedRWPair.writableurrc4|jSr)r{r}rts rr}zBufferedRWPair.flushxs{  """rc |j|jdS#|jwxYwr)r{rCrzrts rrCzBufferedRWPair.close{sO K      K       DK      s 6Acf|jp|jSr)rzr7r{rts rr7zBufferedRWPair.isattys){!!##;t{'9'9';';;rc|jjSr)r{rrts rrzBufferedRWPair.closed {!!rNrr)r^rcrdrr8rrrrrrrrrr}rCr7rrrerrrxrx@s  4G : : : :&&&& '''$$$&&&&''''(((&&&&&&###   <<<""X"""rrxc\eZdZdZefdZddZdZddZddZ d Z dd Z dd Z d Z dZdS)r>zA buffered interface to random access streams. The constructor creates a reader and writer for a seekable stream, raw, given in the first argument. If the buffer_size is omitted it defaults to DEFAULT_BUFFER_SIZE. c|t|||t|||dSr)rr@rr?r@s rrzBufferedRandom.__init__sJ c;777c;77777rrc|tvrtd||jrT|j5|j|jt|jz ddddn #1swxYwY|j||}|j5| dddn #1swxYwY|dkrtd|S)Nr^r rz seek() returned invalid position) r_r4r}rCr?rQrnrDr3r=r<rps rrnzBufferedRandom.seeksm ) ) )344 4 > G G G dns4>/B/BBAFFF G G G G G G G G G G G G G G GhmmC(( _ # #  " " " # # # # # # # # # # # # # # # 77<== = s#6A==BB*C  CCcx|jrt|St|Sr)rbr?rur@rts rruzBufferedRandom.tells4 ? -!&&t,, ,!&&t,, ,rNcd||}t||Sr)rur?rwrxs rrwzBufferedRandom.truncates* ;))++C&&tS111rch|d}|t||Sr})r}r@rrs rrzBufferedRandom.reads/ <D ""4...rc`|t||Sr)r}r@rrs rrzBufferedRandom.readintos% &&tQ///rc`|t||Sr)r}r@rrs rrzBufferedRandom.peeks% ""4...rrc`|t||Sr)r}r@rrs rrzBufferedRandom.read1s% ##D$///rc`|t||Sr)r}r@rrs rrzBufferedRandom.readinto1s% ''a000rc|jrh|j5|j|jt |jz d|dddn #1swxYwYt||Sr) rCr?rQrnrDr3r=r?rrs rrzBufferedRandom.writes > ' ' ' dns4>/B/BBAFFF$$&&& ' ' ' ' ' ' ' ' ' ' ' ' ' ' '##D!,,,sA A%%A),A)rrr)r^rcrdrr8rrnrurwrrrrrrrerrr>r>s)<8888 "--- 2222 //// 000////0000111-----rr>ceZdZdZdZdZdZdZdZdZ ddZ dZ dZ d Z d Zdd Zdd Zd ZdZdZefdZdZddZfdZdZdZdZdZdZedZedZ xZ!S)r6rFNTrcl|jdkr5 |jrtj|jd|_n #d|_wxYwt |t rt dt |tr|}|dkrtdnd}t |tst d|t|tdkstd|td|Ddks| d dkrtd d |vr(d |_ d |_tjtjz}n^d |vr d |_d}nPd|vr!d |_tjtjz}n+d|vr'd |_d |_tjtjz}d |vrd |_d |_|jr|jr|tjz}n&|jr|tjz}n|tjz}|t1tddz}t1tddpt1tdd}||z}d} |dkr|std|tj||d}nE|||}t |tst d|dkrt5d|}|stj|d||_tj|} t;j| jr7tAtBj"tj#tBj"|n#tH$rYnwxYwt1| dd|_%|j%dkr tL|_%tNrtO|tj(||_)|jrJ tj*|dtVn-#t4$r } | j!tBj,krYd} ~ nd} ~ wwxYwn#|tj|xYw||_dS)adOpen a file. The mode can be 'r' (default), 'w', 'x' or 'a' for reading, writing, exclusive creation or appending. The file will be created if it doesn't exist when opened for writing or appending; it will be truncated when opened for writing. A FileExistsError will be raised if it already exists when opened for creating. Opening a file for creating implies writing so this mode behaves in a similar way to 'w'. Add a '+' to the mode to allow simultaneous reading and writing. 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 (*name*, *flags*). *opener* must return an open file descriptor (passing os.open as *opener* results in functionality similar to passing None). rrz$integer argument expected, got floatznegative file descriptorzinvalid mode: zxrwab+c3K|]}|dvV dS)rwaxNre).0cs r z"FileIO.__init__..s&))qqF{))))))rr r&zKMust have exactly one of create/read/write/append mode and at most one plusr#Trr$r%O_BINARY O_NOINHERIT O_CLOEXECNz'Cannot use closefd=False with file nameizexpected integer from openerzNegative file descriptorFr;)-_fd_closefdr-rCr+floatr1r,r4r/r2sumcount_created _writableO_EXCLO_CREAT _readableO_TRUNC _appendingO_APPENDO_RDWRO_RDONLYO_WRONLYgetattrrVr<set_inheritabler9statS_ISDIRst_modeIsADirectoryErrorriEISDIRrjr=_blksizer8_setmoderr_lseekr ESPIPE) rkrDrBrHr*fdrnoinherit_flagowned_fdfdfstatrls rrzFileIO.__init__s 8q== ='HTX&&&2 dE " " DBCC C dC  BAvv !;<<<B$$$ :)$$899 94yyCMM))*449:: : ))D))) ) )Q . .$**S//A2E2E9:: : $;; DM!DNI *EE D[[!DNEE D[[!DNJ+EE D[[!DN"DOK"*,E $;;!DN!DN > !dn ! RY EE ^ ! R[ EE R[ E Z+++!"mQ776!"k155  / AvvP$%NOOO>ue44BBe,,B%b#..H'(FGGGAvv%&@AAA%2&r5111#DMhrllG <00M+EL,.K ,E,EtMMMM"    $G\1==DM}!! 3  *R[)))DI HRH----w%,../.... #""" se 5 >B)P AMP M'$P&M''APO#"P# P -PPP  PP*c|jdkrI|jrD|js?ddl}|d|t d||dSdSdSdS)Nrzunclosed file r )rsource)rrrrrResourceWarningrC)rkrs rrzFileIO.__del__Usm 8q==T]=4;= OOO MMM6%&t  5 5 5 JJLLLLL =====rc<td|jjdrrrts rrzFileIO.__getstate__\rrc |jjd|jj}|jrd|zS |j}d|d|d|jd|jd S#t$rd||j|j|jfzcYSwxYw) Nriz <%s [closed]>z<%s fd=%d mode=%r closefd=%r>) rjrcrdrr_rBrr=r)rk class_namer_s rrzFileIO.__repr___s $ 9 9 9 $ ; ;= ; 0"Z/ / B9DD  ZZtyyy$---A B  F F F349dmDE F F F FsA "A.-A.c2|jstddS)NzFile not open for reading)rrbrts rrzFileIO._checkReadablem(~ D&'BCC C D Drc2|jstddS)NzFile not open for writing)rrbrs rrzFileIO._checkWritableqrrc||||dkr|S tj|j|S#t $rYdSwxYw)zRead 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|rrr-rrrhrs rrz FileIO.readus~   <4!88<<>> ! 748T** *   44 sA A.-A.cd||t} tj|jdt }tj|jj}||kr||z dz}n#t$rYnwxYwt} t||kr't|}|t|tz }|t|z } tj |j|}n#t$r|rYnYdSwxYw|sn||z }t|S)zRead 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 TN)r|rr8r-rrr r9st_sizer<rr3r-rrhr0)rkbufsizerqendrRrrKs rrzFileIO.readallsU  % (48Q11C(48$$,Cczz)a-    D  6{{g%%f++3w(;<<<#f++%A !,,"   Ett   eOF V}}s$A A>> B  B *D DDct|d}|t|}t|}||d|<|S)zSame as RawIOBase.readinto().rN)rrrr3)rkr(mrrs rrzFileIO.readintosO qMM  s # #yyQ   II"1"rc|| tj|j|S#t $rYdSwxYw)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|rr-rrrhrs rrz FileIO.writesc   8DHa(( (   44 sA AAct|trtd|t j|j||S)aMove 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)r+rr1r|r-rrrps rrnz FileIO.seeksM c5 ! ! 6455 5 x#v...rcj|tj|jdtS)zYtell() -> int. Current file position. Can raise OSError for non seekable files.r)r|r-rrr rts rruz FileIO.tells, x!X...rc||||}tj|j||S)zTruncate 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. )r|rrur- ftruncaterrs rrwzFileIO.truncatesS   <99;;D TXt$$$ rc|jsh |jrtj|jt dS#t wxYwdS)zClose the file. A closed file cannot be used for further I/O operations. close() may be called more than once without error. N)rrr-rCrrrs rrCz FileIO.closese {  ='HTX&&&     s A "A.c||j4 |d|_n#t$r d|_YnwxYw|jS)z$True if file supports random-access.NTF)r| _seekablerur<rts rrzFileIO.seekablesk  > ! & "& ' ' '!& '~s9A  A c8||jS)z'True if file was opened in a read mode.)r|rrts rrzFileIO.readable ~rc8||jS)z(True if file was opened in a write mode.)r|rrts rrzFileIO.writablerrc8||jS)z3Return the underlying file descriptor (an integer).)r|rrts rr:z FileIO.filenos xrc\|tj|jS)z.True if the file is connected to a TTY device.)r|r-r7rrts rr7z FileIO.isatty s& y"""rc|jS)z6True if the file descriptor will be closed by close().)rrts rrHzFileIO.closefds }rcr|jr |jrdSdS|jr |jrdSdS|jr |jrdSdSdS)zString giving the file modezxb+xbzab+abzrb+rXwb)rrrrrts rrBz FileIO.modesc = ~ ut _ ~ ut ^ ~ ut4r)rTNr)"r^rcrdrrrrrrrrrrrrrrrrrrrnrurwrCrrrr:r7rrHrBr7r8s@rr6r6s CHIIJIHwwwwrMMM B B BDDDDDDD !!!F    (//// ///                ### XXrr6cveZdZdZd dZdZd dZdZdZe d Z e d Z e d Z dS) TextIOBaseznBase class for text I/O. This class provides a character and line based interface to stream I/O. rc0|ddS)zRead 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. rNrors rrzTextIOBase.read2s &!!!!!rc0|ddS)z.Write string s to stream and returning an int.rNro)rkss rrzTextIOBase.write<s '"""""rNc0|ddS)z*Truncate size to pos, where pos is an int.rwNrorxs rrwzTextIOBase.truncate@s *%%%%%rc0|ddS)z_Read until newline or EOF. Returns an empty string if EOF is hit immediately. rNrorts rrzTextIOBase.readlineDs *%%%%%rc0|ddS)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. rNrorts rrzTextIOBase.detachKrrcdS)zSubclasses should override.Nrerts rrzTextIOBase.encodingTs trcdS)zLine endings translated so far. Only line endings translated during reading are considered. Subclasses should override. Nrerts rnewlineszTextIOBase.newlinesYs trcdS)zMError setting of the decoder or encoder. Subclasses should override.Nrerts rrFzTextIOBase.errorscs trrr) r^rcrdrrrrwrrrrrrFrerrrr*s """"###&&&&&&&$$$XXXrrcVeZdZdZddZddZdZdZdZd Z d Z d Z e d Z d S)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. strictctj||||_||_d|_d|_dS)N)rFrF)codecsIncrementalDecoderr translatedecoderseennl pendingcr)rkrrrFs rrz"IncrementalNewlineDecoder.__init__ts>!**4*???"  rFc|j|}n|j||}|jr|s|r d|z}d|_|dr|s|dd}d|_|d}|d|z }|d|z }|xj|o|j|o|jz|o|jzzc_|j r0|r| dd}|r| dd}|S)Nfinal FrT  ) rdecoderrrr_LF_CR_CRLFrreplace)rkinputroutputcrlfcrlfs rrz IncrementalNewlineDecoder.decode{s< < FF\((e(< #v # #F]F"DN ??4  " "CRC[F!DN||F## \\$  $ & \\$  $ & txBO48<* , ,  > 4 655 4d33 rc||jd}d}n|j\}}|dz}|jr|dz}||fS)Nrrr )rgetstater)rkrflags rr z"IncrementalNewlineDecoder.getstatesS < CDD --//IC   >  AIDDyrc|\}}t|dz|_|j!|j||dz fdSdSr)boolrrsetstate)rkstaterr s rrz"IncrementalNewlineDecoder.setstatesQ TdQh < # L ! !3 "2 3 3 3 3 3 $ #rcfd|_d|_|j|jdSdS)NrF)rrrresetrts rrzIncrementalNewlineDecoder.resets:  < # L    $ #rr r cd|jS)N)Nrr)rrr)rr)rr)rrr)rrts rrz"IncrementalNewlineDecoder.newliness rN)r)F)r^rcrdrrrr rrrrrrrrerrrrms >   444 !!! C C E   X   rrceZdZdZdZdZ d,dZdZ d,dZdZ e d Z e d Z e d Z e d Ze d ZddeddddZdZdZdZdZdZe dZe dZdZdZdZdZdZdZd-dZdZ dZ!d Z" d.d"Z#d#Z$d$Z%d-d%Z&d&Z'd/d'Z(d-d(Z)d)Z*d-d*Z+e d+Z,dS)0rAaCharacter 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.getencoding(). 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||t|}|dkr|}t|tst d|zt j|jsd}t||z|d}nBt|tst d|ztrt j |||_ d|_ d|_d|_|jx|_|_t)|jd|_||||||dS) Nrr!zG%r is not a text encoding; use codecs.open() to handle arbitrary codecsrr"r)rr)_check_newliner_get_locale_encodingr+r/r4rlookup_is_text_encoding LookupError _CHECK_ERRORS lookup_errorr_decoded_chars_decoded_chars_used _snapshotrUrr_tellingr _has_read1 _configure)rkrUrrFrGrS write_throughrs rrzTextIOWrapper.__init__sY G$$$ ** x  0022H(C(( @3h>?? ?}X&&8 .BCcHn-- - >FFfc** @ !5!>??? ,#F+++  #$ )-)=)=)?)??!$+w77 &'&  7 7 7 7 7rc|4t|tstdt||dvrt d|dS)Nzillegal newline type: )Nr)rrrzillegal newline value: )r+r/r1typer4)rkrGs rrzTextIOWrapper._check_newlines[  z'3'?'? )$w---IJJ J 8 8 8*GGEFF F 9 8rc||_||_d|_d|_d|_| |_|du|_||_|dk|_|p tj |_ ||_ ||_ |jrn|r\|j}|dkr? |ddS#t($rYdSwxYwdSdSdS)Nr)r) _encoding_errors_encoder_decoder _b2cratio_readuniversal_readtranslate_readnl_writetranslater-linesep_writenl_line_buffering_write_throughrrrUru _get_encoderrr)rkrrFrGrSr#positions rr"zTextIOWrapper._configure s !   ")k%o &"}-2: -+ > dmmoo {''))H1}}%%''0033333"DD     }s#'C CCcTd|jj|jj} |j}|d|z }n#t $rYnwxYw |j}|d|z }n#t $rYnwxYw|d|jzS)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)rrjrcrdr_r=rBr)rkrRr_rBs rrzTextIOWrapper.__repr__.s!:!%!<>> 19D m**400 0FF    D  19D m**400 0FF    D *11$-@@@@s#A AAA== B  B c|jSr)r(rts rrzTextIOWrapper.encoding?s ~rc|jSr)r)rts rrFzTextIOWrapper.errorsC |rc|jSr)r3rts rrSzTextIOWrapper.line_bufferingGs ##rc|jSr)r4rts rr#zTextIOWrapper.write_throughKs ""rc|jSr)rrts rrUzTextIOWrapper.bufferOr:r)rrFrGrSr#c|j| | |turtd| ||j}n*d}n't |t st d|z||j}nAt |t st d|z|dkr|}|tur|j }| |||j }||j }| ||||||dS)z`Reconfigure the text stream with new parameters. This also flushes the stream. NzPIt is not possible to set the encoding or newline of stream after the first readrr"r!r)r+Ellipsisrbr)r+r/r1r(rr/rrSr#r}r")rkrrFrGrSr#s r reconfigurezTextIOWrapper.reconfigureSsH M %)V-?x//&'(( ( >!FC(( ;069:: :  ~HHh,, C 6 ABBB8##4466 h  lG G$$$  !!0N   .M  &'&  7 7 7 7 7rc<|jrtd|jS)Nr)rr4rrts rrzTextIOWrapper.seekable~s# ; ><== =~rc4|jSr)rUrrts rrzTextIOWrapper.readablerrc4|jSr)rUrrts rrzTextIOWrapper.writablerrcP|j|j|_dSr)rUr}rr rts rr}zTextIOWrapper.flushs#  rc|jU|jsP ||jdS#|jwxYwdSdSr)rUrr}rCrts rrCzTextIOWrapper.closese ; "4; " $  !!##### !!#### # " " "rc|jjSr)rUrrts rrzTextIOWrapper.closedrrc|jjSr)rUr_rts rr_zTextIOWrapper.names {rc4|jSr)rUr:rts rr:zTextIOWrapper.fileno{!!###rc4|jSr)rUr7rts rr7zTextIOWrapper.isattyrIrc|jrtdt|tst d|jjzt|}|js|j od|v}|r-|jr&|j dkr| d|j }|j p| }||}|j||j r|sd|vr||dd|_|jr|j|S)zWrite data, where s is a strr%zcan't write %s to text streamrrr)N)rr4r+r/r1rjr^r3r0r3r2rr*r5encoderUrr}_set_decoded_charsrr+r)rkrlengthhaslfencoderr(s rrzTextIOWrapper.writesJ ; 5344 4!S!! 2;K0122 2Q%=)=L419  /T) /dmt.C.C $ ..A-64#4#4#6#6 NN1   !   U daii JJLLL ### = " M   ! ! ! rcltj|j}||j|_|jSr)rgetincrementalencoderr(r)r*)rk make_encoders rr5zTextIOWrapper._get_encoders/3DNCC $ T\22 }rctj|j}||j}|jrt ||j}||_|Sr)rgetincrementaldecoderr(r)r-rr.r+)rk make_decoderrs r _get_decoderzTextIOWrapper._get_decodersO3DNCC ,t|,,   N/9LMMG rc"||_d|_dS)zSet the _decoded_chars buffer.rN)rr)rkcharss rrMz TextIOWrapper._set_decoded_charss##$   rc|j}||j|d}n|j|||z}|xjt|z c_|S)z'Advance into the _decoded_chars buffer.N)rrr3)rkroffsetrYs r_get_decoded_charsz TextIOWrapper._get_decoded_charssW) 9'0EE'vz(9:E   CJJ.   rcV ddl}|S#t$rYdSwxYw)Nrr)r getencoding ImportError)rkrs rrz"TextIOWrapper._get_locale_encodingsH ( MMM %%'' '    77 s  ((cZ|j|krtd|xj|zc_dS)z!Rewind the _decoded_chars buffer.z"rewind decoded_chars out of boundsN)rAssertionErrorrss r_rewind_decoded_charsz#TextIOWrapper._rewind_decoded_charss9  #a ' ' !EFF F   A%    rc|jtd|jr|j\}}|jr |j|j}n|j|j}| }|j ||}| ||r*t|t|j z |_ nd|_ |jr |||zf|_| S)zQ Read and decode the next chunk of data from the BufferedReader. Nz no decoderr')r+r4r r r!rUr _CHUNK_SIZErrrMr3rr,r)rk dec_buffer dec_flags input_chunkeof decoded_charss r _read_chunkzTextIOWrapper._read_chunks = \** * = =%)M$:$:$<$< !J ? =+++D,<==KK+**4+;<>   ...  ! --D4G0H0HHDNN DN = C(k)ABDNwrrcP||dzz|dzz|dzzt|dzzS)N@)r )rkr6rf bytes_to_feedneed_eof chars_to_skips r _pack_cookiezTextIOWrapper._pack_cookie s?IrM*mS.@As"$&*8nnc&9: ;rct|d\}}t|d\}}t|d\}}t|d\}}|||t||fS)Nl)divmodr )rkbigintrestr6rfrprqrrs r_unpack_cookiezTextIOWrapper._unpack_cookie sg..h u--i$T511m"(u"5"5-M4>>=PPrc |jstd|jstd||j}|j}||j|j rtd|S|j\}}|t|z}|j }|dkr| ||S|} t|j|z}d}|t|ksJ|dkr|d|ft||d|} | |kr6|\} } | s| }|| z}n>|t| z}d}n ||z}|dz}|dkd}|d|f||z} |} |dkr+| | | ||Sd}d}d}t'|t|D]n}|dz }|t||||dzz }|\}}|s||kr| |z } ||z}|dd}}} ||krn?o|t|dd z }d }||krtd | | | |||||S#||wxYw) N!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr rr FTrz'can't reconstruct logical file position)rrbr r<r}rUrur+rrrar3rrsr r,r,rrrange)rkr6rrf next_inputrr saved_state skip_bytes skip_backrr(d start_pos start_flags bytes_fedrq chars_decodedires rruzTextIOWrapper.tell" s~ L&'JKK K} FDEE E ;##%%- ?dn4" =$%;<<<O!% :C OO#0 A  $$Xy99 9&&(( F *T^m;<??@@ %%"++--DAq$% %* #a&&(J !II)+J )A I#q..&   #y!1222!:-I#K!!((K@@@   [ ) ) ) )5IHM:s:77 M MQ W^^Jq1u4E%F%F!G!GG (/(8(8(:(:% I!Lm}&D&D*I!]2M._reset_encoder sz $->4+<+<+>+> q==$$Q'''''MMOOOOO    sA AAr0rzrz#can't do nonzero cur-relative seeksz#can't do nonzero end-relative seeksr)zunsupported whence ()r,rz#can't restore logical file position)rr4rrbr rur r}rUrnrMrr+rrxrWrrrr3rr<r) rkcookierrrr6rrfrprqrrrgs ` rrnzTextIOWrapper.seek s $ $ $ $ $ ; 4233 3~ L&'JKK K X  {{*+PQQQFYY[[FF x  {{*+PQQQ JJLLL{''622H  # #B ' ' '!DN} & ##%%% N8 $ $ $O Q;;*&&&BCC C A::*FFDEE E    ' ' E 9mX} ### ### Q;;4=; M   ! ! ! ! ] .i .= . M@T->->-@-@DM M " "C#3 4 4 4'-DN  5+**=99K  # # $$[(;; = = ='5DN4&''-77CDDD'4D $v rc||d}n3 |j}|}n #t$rt|dwxYw|jp|}|dkra|||j dz}| dd|_ |Sd}||}t||krT|sR| }|||t|z z }t||kr|R|S)NrrrTrr)F)rrr=r1r+rWr\rrUrrMrr3rj)rkrrrrRrhs rrzTextIOWrapper.read sp  <DD $!^ "z||" ? ? ?4 = = =>>> ?-64#4#4#6#6 !88--//nnT[%5%5%7%7tnDDEF  # #B ' ' '!DNMC,,T22Ff++$$S$**,,,$11$V2DEEEf++$$S$Ms -A ctd|_|}|sd|_|j|_t|S)NF)r rrrrrs rrzTextIOWrapper.__next__ s9 }} !DN NDM  rc|jrtd|d}n3 |j}|}n #t$rt |dwxYw|}d}|js|dx}} |jr3| d|}|dkr|dz}nUt|}n|j r{| d|}| d|}|dkr|dkrt|}nk|dz}n|dkr|dz}n||kr|dz}n||dzkr|d z}n|dz}n| |j }|dkr|t|j z}n|dkrt||kr|}no| r|jrn| |jr||z }n|d d|_|S|dkr||kr|}|t||z |d|S) Nr rrrTrr rr r))rr4rr=r1r\r+rWr.rr3r-r/rjrrMrrb) rkrrrstartrqendposnlposcrposs rrzTextIOWrapper.readline s ; 6455 5 <DD $!^ "z||" ? ? ?4 = = =>>> ? &&((}      f> "- iie,,!88 1WFIIEE$$   $.. $..B;;{{ #D "'b[["QYFU]]"QYFeai''"QYF#QYFii --!88 3t|#4#44FqyySYY$..""$$ &""$$ " //111''+++!% }> @ 199$F ""3t99v#5666GVG}r"c,|jr |jjndSr)r+rrts rrzTextIOWrapper.newlines` s)-@t}%%D@r)NNNFFr)rrFrr)-r^rcrdrrdrrrr"rrrrFrSr#rUr?r@rrrr}rCrr_r:r7rr5rWrMr\rrbrjrsrxrurwrrnrrrrrerrrArAs2,KG DH5:7777BGGG >B7<HAAA"XX$$X$##X#X"$#'t)7)7)7)7)7V &&&&&&'''$$$""X"  X $$$$$$. %%% (((&&& (((T01JK;;;;QQQa*a*a*F)))) IIIIV8[[[[zAAXAAArrAcbeZdZdZd fd ZdZdZedZedZ d Z xZ S) StringIOzText 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. r)rcxtt|tdd||d|_|ut |t s4tdt|j | || ddSdS)Nr surrogatepass)rrFrGFz*initial_value must be str or None, not {0}r) rrrr r0r+r/r1rr%r^rrn)rk initial_valuerGrjs rrzStringIO.__init__l s h&&wyy07.=/6 ' 8 8 8 ?#(D  $mS11 G L!'](;(;(D!E!EGGG JJ} % % % IIaLLLLL % $rcl||jp|}|}| ||jd||S#||wxYw)NTr) r}r+rWr rrrUrr)rkr old_states rrzStringIO.getvalue| s -64#4#4#6#6$$&&   (>>$+"6"6"8"8>EE   Y ' ' ' 'G  Y ' ' ' 's -BB3c6t|Sr)objectrrts rrzStringIO.__repr__ st$$$rcdSrrerts rrFzStringIO.errors trcdSrrerts rrzStringIO.encoding rrc0|ddS)Nrrorts rrzStringIO.detach s (#####r)r)r) r^rcrdrrrrrrFrrr7r8s@rrre s  (((%%% XX$$$$$$$rr)r )rrNNNTN):rr-abcrrirr_threadrr>platformmsvcrtrriorrr r r_raddr SEEK_DATAr8rhrdev_moderrr staticmethodrVrZ open_coder=r`rbr<r4ABCMetargregisterr_ior6rrr r@r?rxr>rrrrArrerrrsy ))))))<&&&*******H 66666666666699 72{'&&&&&&"$GC);<<R @R( B=A,0KKKK^ ( II((('III( K K K$ 2        w       _____s{____B  6;#;#;#;#;#;#;#;#z i  6e$e$e$e$e$Ve$e$e$N>***h!h!h!h!h!~h!h!h!VLLLLLnLLL^@@@@@%@@@Df!f!f!f!f!%f!f!f!RF"F"F"F"F"^F"F"F"RG-G-G-G-G-^^G-G-G-TTTTTTYTTTn >>>>>>>>@ z"""RRRRR 9RRRj` A` A` A` A` AJ` A` A` AF0$0$0$0$0$}0$0$0$0$0$s$;CC  C CC32C3