QfmpdZddlZddlZddlZddlZddlZddlZddlmZ ejdvrddl m Z ndZ ddlZddlmZmZmZmZhdZeedr6ej+ej,ej+ej.d ZeZeed xsej4j6ZeZd.d Ze d/d Z d Z! ejDZ" ejHZ$GddejNZ(ejPjSe(Gdde(Z*ejTjSe*ddl+m,Z,e*jSe,Gdde(Z-ejZjSe-Gdde-Z.Gdde-Z/Gdde.Z0Gdde.Z1Gd d!e-Z2Gd"d#e1e0Z3Gd$d%e*Z,Gd&d'e(Z4ejhjSe4Gd(d)ejjZ6Gd*d+e4Z7Gd,d-e7Z8y#e#$re!Z"YKwxYw#e#$rGdde%e&Z$YVwxYw)0z) Python implementation of the io module. N) allocate_lock>win32cygwin)setmode)__all__SEEK_SETSEEK_CURSEEK_END>r SEEK_HOLEi gettotalrefcountc|Wtjjrd}nd}tjjrddl}|j 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 ,/opt/alt/python312/lib64/python3.12/_pyio.py text_encodingr+sN 99  HH 99 * *  MM>):> ; Oct|tstj|}t|tt tfst d|zt|tst d|zt|tst d|z|t|tst d|z|t|tst d|zt|}|tdz st|t|kDrtd|zd|v} d |v} d |v} d |v} d |v} d |v}d|v}|r |r td| | z| z| zdkDr td| s| s| s | s td|r | td|r | td|r | td|r |dk(rddl }|jdtdt|| xrdxsd| xrd xsdz| xrd xsdz| xrd xsdz| xrd xsdz||}|} d}|dk(s|dkr|jrd}d}|dkr 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 )openerFTzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r) isinstanceintosfspathstrbytes TypeErrorsetlen ValueErrorrrRuntimeWarningFileIOisattyDEFAULT_BUFFER_SIZEfstatfileno st_blksizeOSErrorAttributeErrorBufferedRandomBufferedWriterBufferedReaderr TextIOWrappermodeclose)filerB bufferingrerrorsnewlineclosefdr)modescreatingreadingwriting appendingupdatingtextbinaryrrawresultline_bufferingbsbuffers ropenrVLszn dC yy dS%- .*T122 dC *T122 i %/);<<Jx$=.9:: *VS"9,v566 IE s9~TSZ!7+d233e|HUlGUlGu Ie|H %Y]szz|I!N q=+I #XXcjjl+666 "I q=56 6 > => > #C3F I#C3F #C3F/$67 7 M *VXvwO  5^,  6  s=5+K9!-K$ K9/AK9?$K9$K63K95K66K99L cPddl}|jdtdt|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( MM< !% d rc eZdZy)UnsupportedOperationN)__name__ __module__ __qualname__rrr\r\7s rr\ceZdZdZdZddZdZddZdZdZ d Z d Z d Z dd Z d ZddZdZddZedZddZdZdZdZdZddZdZdZddZdZy)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!') cLt|jjd|d)z@Internal: raise an OSError exception for unsupported operations..z() not supported)r\ __class__r])selfnames r _unsupportedzIOBase._unsupported]s&"$(NN$;$;T$CD Drc&|jdy)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. seekNrhrfposwhences rrjz IOBase.seekds &!rc&|jddS)z5Return an int indicating the current stream position.rr )rjrfs rtellz IOBase.telltsyyArNc&|jdy)zTruncate file to size bytes. Size defaults to the current IO position as reported by tell(). Return the new size. truncateNrkrfrms rrszIOBase.truncatex *%rc$|jy)zuFlush write buffers, if applicable. This is not implemented for read-only and non-blocking streams. N _checkClosedrps rflushz IOBase.flushs rFcf|js |jd|_yy#d|_wxYw)ziFlush and close the IO object. This method has no effect if the file is already closed. TN)_IOBase__closedryrps rrCz IOBase.closes0 }} % $ !% s' 0c |j}|rytr|jy |jy#t$rYywxYw#YyxYw)zDestructor. Calls close().N)closedr=_IOBASE_EMITS_UNRAISABLErC)rfr}s r__del__zIOBase.__del__sQ [[F   # JJL  #   $ s :A AA A cy)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(). Fr`rps rseekablezIOBase.seekables rcJ|jst|d|y)zEInternal: raise UnsupportedOperation if file is not seekable NzFile or stream is not seekable.)rr\rfmsgs r_checkSeekablezIOBase._checkSeekable;}}&*-+(I@ @;>@ @rcy)zvReturn a bool indicating whether object was opened for reading. If False, read() will raise OSError. Fr`rps rreadablezIOBase.readable rcJ|jst|d|y)zEInternal: raise UnsupportedOperation if file is not readable NzFile or stream is not readable.)rr\rs r_checkReadablezIOBase._checkReadablerrcy)zReturn a bool indicating whether object was opened for writing. If False, write() and truncate() will raise OSError. Fr`rps rwritablezIOBase.writablerrcJ|jst|d|y)zEInternal: raise UnsupportedOperation if file is not writable NzFile or stream is not writable.)rr\rs r_checkWritablezIOBase._checkWritablerrc|jS)zclosed: bool. True iff the file has been closed. For backwards compatibility, this is a property, not a predicate. )r{rps rr}z IOBase.closeds }}rcB|jrt|d|y)z7Internal: raise a ValueError if file is closed NI/O operation on closed file.r}r4rs rrxzIOBase._checkCloseds4 ;; # =6 6146 6 rc&|j|S)zCContext management protocol. Returns self (an instance of IOBase).rwrps r __enter__zIOBase.__enter__s  rc$|jy)z+Context management protocol. Calls close()N)rC)rfargss r__exit__zIOBase.__exit__s  rc&|jdy)zReturns underlying file descriptor (an int) if one exists. An OSError is raised if the IO object does not use a file descriptor. r:Nrkrps rr:z IOBase.filenos (#rc$|jy)z{Return a bool indicating whether this is an 'interactive' stream. Return False if it can't be determined. Frwrps rr7z IOBase.isattys rctdrfd}nd}dn j}|t }dkst |kr[j |}|s t|S||z }|jdr t|SdkrLt |kr[t|S#t$rtdwxYw)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. peekcjd}|sy|jddzxs t|}dk\r t|}|S)Nr  r)rfindr3min) readaheadnrfsizes r nreadaheadz#IOBase.readline..nreadaheadsI IIaL  ^^E*Q.A3y>19At ArcyNr r`r`rrrz#IOBase.readline..nreadahead!srr* is not an integerrr) hasattr __index__r=r1 bytearrayr3readendswithr0)rfrr size_indexresr's`` rreadlinezIOBase.readline s 4    <D $!^^ "|kQh#c(T/ *,'ASz 1HC||E"SzQh#c(T/Sz" ?4(*< =>> ?s B55C c&|j|SNrwrps r__iter__zIOBase.__iter__6s  rc6|j}|st|Sr)r StopIterationrflines r__next__zIOBase.__next__:s}}  rc||dkr t|Sd}g}|D])}|j||t|z }||k\s(|S|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. r)listappendr3)rfhintrlinesrs r readlineszIOBase.readlines@s\ <419:  D LL  TNADy   rcT|j|D]}|j|y)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)rxwrite)rfrrs r writelineszIOBase.writelinesRs& D JJt rrrr*)r]r^r___doc__rhrjrqrsryr{rCrrrrrrrpropertyr}rxrrr:r7rrrrrr`rrrbrb;s@D" &H %6@@@6 $(T $rrb) metaclassc*eZdZdZddZdZdZdZy) RawIOBasezBase class for raw binary I/O.c|d}|dkr|jSt|j}|j|}|y||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. Nr*r)readallrrreadintor0)rfrr'rs rrzRawIOBase.readmsZ <D !8<<> ! dnn& ' MM!  9 abEQxrct}|jtx}r||z }|jtx}r|r t|S|S)z+Read until EOF, using multiple read() call.)rrr8r0)rfrdatas rrzRawIOBase.readall~sRkii 344d4 4KCii 344d4 : Krc&|jdy)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. rNrkrfr's rrzRawIOBase.readintorurc&|jdy)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. rNrkrs rrzRawIOBase.writes '"rNr)r]r^r_rrrrrr`rrrr_s(" &#rr)r6c>eZdZdZd dZd dZdZdZdZdZ dZ y ) 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. c&|jdy)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. rNrkrfrs rrzBufferedIOBase.reads$ &!rc&|jdy)zaRead up to size bytes with at most one read() system call, where size is an int. read1Nrkrs rrzBufferedIOBase.read1s '"rc(|j|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~--rc(|j|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~,,rct|ts t|}|jd}|r|jt |}n|j t |}t |}||d||S)NB)r+ memoryviewcastrr3r)rfr'rrrs rrzBufferedIOBase._readintosb!Z(1 A FF3K ::c!f%D99SV$D I"1rc&|jdy)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. rNrkrs rrzBufferedIOBase.writes '"rc&|jdy)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. detachNrkrps rrzBufferedIOBase.detach (#rNr) r]r^r_rrrrrrrrr`rrrrs* "(# . -  #$rrceZdZdZdZddZdZddZdZdZ d Z d Z e d Z e d Ze d Ze dZdZdZdZdZy)_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||_yr_rawrfrQs r__init__z_BufferedIOMixin.__init__s  rc^|jj||}|dkr td|S)Nrz#seek() returned an invalid position)rQrjr<)rfrmrn new_positions rrjz_BufferedIOMixin.seeks0xx}}S&1 ! ?@ @rcZ|jj}|dkr td|S)Nrz#tell() returned an invalid position)rQrqr<rts rrqz_BufferedIOMixin.tells)hhmmo 7?@ @ rNc|j|j|j||j}|jj |Sr)rxrryrqrQrsrts rrsz_BufferedIOMixin.truncate"sL   ;))+Cxx  %%rcf|jr td|jjy)Nflush on closed file)r}r4rQryrps rryz_BufferedIOMixin.flush3s# ;;34 4 rc|j9|js, |j|jjyyy#|jjwxYwr)rQr}ryrCrps rrCz_BufferedIOMixin.close8sH 88   !  )4   AA#cz|j td|j|j}d|_|S)Nzraw stream already detached)rQr4ryrrs rrz_BufferedIOMixin.detach@s6 88 :; ; ii  rc6|jjSr)rQrrps rrz_BufferedIOMixin.seekableJxx  ""rc|jSrrrps rrQz_BufferedIOMixin.rawMs yyrc.|jjSr)rQr}rps rr}z_BufferedIOMixin.closedQsxxrc.|jjSr)rQrgrps rrgz_BufferedIOMixin.nameUxx}}rc.|jjSr)rQrBrps rrBz_BufferedIOMixin.modeYrrcHtd|jjdNzcannot pickle z objectr1rer]rps r __getstate__z_BufferedIOMixin.__getstate__]!.)@)@(C7KLLrc|jj}|jj} |j}dj |||S#t $rdj ||cYSwxYw)Nz<{}.{} name={!r}>z<{}.{}>)rer^r_rgformatr=)rfmodnameclsnamergs r__repr__z_BufferedIOMixin.__repr__`sj..++..-- F99D'--gwE E 6##GW5 5 6s A A+*A+c6|jjSr)rQr:rps rr:z_BufferedIOMixin.filenolxx  rc6|jjSr)rQr7rps rr7z_BufferedIOMixin.isattyorrrr)r]r^r_rrrjrqrsryrCrrrrQr}rgrBrrr:r7r`rrrrs   &" !#MF!!rrc~eZdZdZdZddZdZdZdZfdZ ddZ dd Z d Z dd Z d Zdd ZdZdZdZxZS)BytesIOz> ?s CCc$|j|S)z"This is the same as read. )rrs rrz BytesIO.read1syyrc|jr tdt|tr t dt |5}|j }ddddk(ry|j}|t|jkDr0d|t|jz z}|xj|z c_ ||j|||z|xj|z c_|S#1swYxYw)Nwrite to closed file can't write str to binary streamr) r}r4r+r/r1rnbytesr r3r )rfr'viewrrmpaddings rrz BytesIO.writes ;;34 4 a >? ? ]d A 6ii T\\" "s4<<'8!89G LLG #L$% Sq! Q ]s CCc|jr td |j}|}|dk(r&|dkrtd|||_|j S|dk(r*t d|j |z|_|j S|dk(r3t dt|j|z|_|j Std#t$rt |dwxYw)Nzseek on closed filerrnegative seek position r r zunsupported whence value) r}r4rr=r1r maxr3r )rfrmrn pos_indexs rrjz BytesIO.seeks ;;23 3  I+C Q;Qw !EFFDIyy q[Atyy3/DI yy q[As4<<0367DIyy78 8 :sg%789 9 :s C C!cH|jr td|jS)Ntell on closed file)r}r4r rps rrqz BytesIO.tells ;;23 3yyrc|jr td| |j}n' |j}|}|dkrtd||j |d=|S#t$rt |dwxYw)Nztruncate on closed filerrznegative truncate position )r}r4r rr=r1r )rfrmr)s rrszBytesIO.truncates ;;67 7 ;))C "MM  kQw C!IJJ LL  " >3'); <== >s AA7c2|jr tdyNrTrrps rrzBytesIO.readable ;;<= =rc2|jr tdyr.rrps rrzBytesIO.writabler/rc2|jr tdyr.rrps rrzBytesIO.seekabler/rrrr)r]r^r_rr rrrrrCrrrrjrqrsrrr __classcell__res@rr r ssSFG$ #( * &* "  rr cbeZdZdZefdZdZdZddZddZ ddZ dd Z dd Z d Z d Zdd Zy)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|js tdtj|||dkr t d||_|j t|_y)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_lockrfrQr7s rrzBufferedReader.__init__ sZ||~<= =!!$, ! 23 3& &rc6|jjSr)rQrrps rrzBufferedReader.readablerrc d|_d|_y)Nrr) _read_buf _read_posrps rr8zBufferedReader._reset_read_bufsrNc||dkr td|j5|j|cdddS#1swYyxYw)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. Nr*zinvalid number of bytes to read)r4r:_read_unlockedrs rrzBufferedReader.read!s@  r >? ? __&&t, - -__s :AcJd}d}|j}|j}||dk(r|jt|jdr-|jj }| ||dxsdS||d|zS||dg}d} |jj }||vr|}n |t|z }|j|Adj|xs|St||z } || kr|xj|z c_||||zS||dg}t|j|} | |krG|jj | }||vr|}n%| t|z } |j|| |krGt|| }dj|} | |d|_d|_| r| d|S|S)Nr)rNr*rr) r>r?r8rrQrrr3rjoinr(r7r) rfr nodata_val empty_valuesrrmchunkchunks current_sizeavailwantedouts rrAzBufferedReader._read_unlocked.s " nnnn 9R  "txx+((*=st9,,st9u,,#$i[FL L(!&JE *  e$88F#1z 1C3 : NNa Ns3q5> !cd)T%%q)aiHHMM&)E $"  SZ E MM% ai 5MhhvQRs2Aw-:-rc|jd|j5|j|cdddS#1swYyxYw)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. zpeek of closed fileN)rxr:_peek_unlockedrs rrzBufferedReader.peekbs7 /0 __&&t, - -__s 9Ac`t||j}t|j|jz }||ks|dkrT|j|z }|j j |}|r(|j|jd|z|_d|_|j|jdSr )rr7r3r>r?rQr)rfrwanthaveto_readcurrents rrMzBufferedReader._peek_unlockedms1d&&'4>>"T^^3 $;$!)&&-GhhmmG,G!%!@7!J!"~~dnno..rc .|jd|dkr |j}|dk(ry|j5|jd|j t |t |j|jz cdddS#1swYyxYw)zr?rs rrzBufferedReader.read1xs /0 !8##D 19 __    "&&D#dnn->?A A A__s A B  Bc|jdt|ts t|}|jdk(ry|j d}d}|j 5|t |krtt |j|jz t |}|rU|j|j|j|z||||z|xj|z c_ ||z }|t |k(rnlt ||z |jkDr'|jj||d}|sn0||z }n|r|s|jdsn|r|rn|t |krddd|S#1swY|SxYw)z2Read data into *buf* with at most one system call.zreadinto of closed filerrNr )rxr+rr#rr:r3rr>r?r7rQrrM)rfrrwrittenrIrs rrzBufferedReader._readintos_ 34 #z*S/C ::?hhsm __CH$C/$..@#c(Kt~~dnnU6JK .NNe+Nu$G#c(*s8g%(8(88))#gh-8AqLG G..q1W9CH$>?>s DE--E7cttj|t|jz |j zdSr )r(rrqr3r>r?rps rrqzBufferedReader.tells3#((.T^^1DDt~~UWXYYrc4|tvr td|jd|j5|dk(r%|t |j |j z z}tj|||}|j|cdddS#1swYyxYw)Ninvalid whence valuezseek of closed filer ) valid_seek_flagsr4rxr:r3r>r?rrjr8rls rrjzBufferedReader.seeks ) )34 4 /0 __{s4>>*T^^;;"''c6:C  "   __s ABBrrr)r]r^r_rr8rrr8rrArrMrrrqrjr`rrr@r@sG)< !# -2.h - / A&.`Z rr@cNeZdZdZefdZdZdZd dZdZ dZ d Z d d Z d Z y)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|js tdtj|||dkr t d||_t |_t|_ y)Nz "raw" argument must be writable.rr6) rr<rrr4r7r _write_bufr9 _write_lockr;s rrzBufferedWriter.__init__sV||~<= =!!$, ! 23 3&#+6rc6|jjSr)rQrrps rrzBufferedWriter.writablerrcDt|tr td|j5|jr t dt |j|jkDr|jt |j}|jj|t |j|z }t |j|jkDr |j|cdddS#t$r}t |j|jkDrft |j|jz }||z}|jd|j|_t|j|j|Yd}~d}~wwxYw#1swYyxYw)Nr!r )r+r/r1r]r}r4r3r\r7_flush_unlockedextendBlockingIOErrorerrnostrerror)rfr'beforerUeoverages rrzBufferedWriter.writesT a >? ?   {{ !7884??#d&6&66$$&)F OO " "1 %$//*V3G4??#d&6&66 L((*/  'L4??+d.>.>>#&doo"69I9I"I7**.//:K4;K;K*L-aggqzz7KK ?L s7B4FC8-F8 FBF FFFFNc|j5|j||jj}|jj |cdddS#1swYyxYwr)r]r`rQrqrsrts rrszBufferedWriter.truncatesN     "{hhmmo88$$S)  * *  s AAA'cf|j5|jdddy#1swYyxYwr)r]r`rps rryzBufferedWriter.flushs#     "  s'0c|jr td|jr |jj |j}|t tjdd|t|jkDs|dkr td|jd|=|jryy#t $r t dwxYw)NrzHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes) r}r4r\rQrrb RuntimeErrorrcEAGAINr3r<rfrs rr`zBufferedWriter._flush_unlockeds ;;34 4oo GHHNN4??3y%LL?DD3t''1q5JKK#oo# G"$FGG Gs %B--CcXtj|t|jzSr)rrqr3r\rps rrqzBufferedWriter.tells!$$T*S-AAArc|tvr td|j5|jtj |||cdddS#1swYyxYw)NrX)rYr4r]r`rrjrls rrjzBufferedWriter.seeksO ) )34 4     "#((sF; < <  s 'AAc|j5|j |jr dddy ddd |j|j5|jj dddy#1swYJxYw#1swYyxYw#|j5|jj dddw#1swYwxYwxYwr)r]rQr}ryrCrps rrCzBufferedWriter.close#s   xx4;;  #. ! JJL!! "! "!!! "!!s:A:BB:BB CC: CC Crr)r]r^r_rr8rrrrsryr`rqrjrCr`rrr?r?s:)< "#8*#$"B< !rr?creZdZdZefdZddZdZdZddZ ddZ dZ d Z d Z d Zd Zd ZedZy)BufferedRWPairaA buffered reader and writer object together. A buffered reader object and buffered writer object put together to form a sequential IO object that can read and write. This is typically used with a socket or two-way pipe. reader and writer are RawIOBase objects that are readable and writeable respectively. If the buffer_size is omitted it defaults to DEFAULT_BUFFER_SIZE. c|js td|js tdt|||_t |||_y)zEConstructor. The arguments are two RawIO instances. z#"reader" argument must be readable.z#"writer" argument must be writable.N)rr<rr@readerr?writer)rfrtrur7s rrzBufferedRWPair.__init__CsL  ?@ @ ?@ @$V[9 $V[9 rc@|d}|jj|SNr*)rtrrs rrzBufferedRWPair.readQs! <D{{%%rc8|jj|Sr)rtrrs rrzBufferedRWPair.readintoVs{{##A&&rc8|jj|Sr)rurrs rrzBufferedRWPair.writeYs{{  ##rc8|jj|Sr)rtrrs rrzBufferedRWPair.peek\s{{%%rc8|jj|Sr)rtrrs rrzBufferedRWPair.read1_s{{  &&rc8|jj|Sr)rtrrs rrzBufferedRWPair.readinto1bs{{$$Q''rc6|jjSr)rtrrps rrzBufferedRWPair.readablee{{##%%rc6|jjSr)rurrps rrzBufferedRWPair.writablehr~rc6|jjSr)ruryrps rryzBufferedRWPair.flushks{{  ""rc |jj|jjy#|jjwxYwr)rurCrtrps rrCzBufferedRWPair.closens8 KK    KK   DKK   s 7Acn|jjxs|jjSr)rtr7rurps rr7zBufferedRWPair.isattyts'{{!!#;t{{'9'9';;rc.|jjSr)rur}rps rr}zBufferedRWPair.closedw{{!!!rNrr)r]r^r_rr8rrrrrrrrrryrCr7rr}r`rrrrrr3s] 4G :& '$&'(&&# <""rrrcZeZdZdZefdZd dZdZddZddZ dZ d d Z dd Z d Z d Zy)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|jtj|||tj|||yr)rr@rr?r;s rrzBufferedRandom.__init__s2 c;7c;7rc|tvr td|j|jrQ|j5|j j |jt|jz dddd|j j ||}|j5|jddd|dkr td|S#1swY\xYw#1swY'xYw)NrXr rz seek() returned invalid position) rYr4ryr>r:rQrjr?r3r8r<rls rrjzBufferedRandom.seeks ) )34 4 >> dnns4>>/BBAF!hhmmC( __  " 7<= = ! _s=C)C C C)cn|jrtj|Stj|Sr)r\r?rqr@rps rrqzBufferedRandom.tells+ ??!&&t, ,!&&t, ,rNcR||j}tj||Sr)rqr?rsrts rrszBufferedRandom.truncates% ;))+C&&tS11rcV|d}|jtj||Srw)ryr@rrs rrzBufferedRandom.reads( <D ""4..rcN|jtj||Sr)ryr@rrs rrzBufferedRandom.readintos &&tQ//rcN|jtj||Sr)ryr@rrs rrzBufferedRandom.peeks ""4..rcN|jtj||Sr)ryr@rrs rrzBufferedRandom.read1s ##D$//rcN|jtj||Sr)ryr@rrs rrzBufferedRandom.readinto1s ''a00rc |jra|j5|jj|jt |jz d|j dddtj||S#1swYxYwr) r>r:rQrjr?r3r8r?rrs rrzBufferedRandom.writesb >> dnns4>>/BBAF$$&!##D!,,!s A BB rrr)r]r^r_rr8rrjrqrsrrrrrrr`rrr>r>|s>)<8 "- 2 / 0/01-rr>ceZdZdZdZdZdZdZdZdZ ddZ dZ dZ dZ d Zdd Zdd Zd Zd ZdZefdZdZddZfdZdZdZdZdZdZedZedZ xZ!S)r6r*FNTc\|jdk\r3 |jrtj|jd|_t |t r t dt |tr|}|dkr tdd}t |tst d|t|tdkstd|td|Ddk7s|jd dkDr td d |vr0d |_ d |_tjtj z}nnd |vr d |_d}n`d|vr)d |_tj tj$z}n3d|vr/d |_d |_tj(tj z}d |vrd |_d |_|j"r |jrtj*z}n3|j"rtj,z}ntj.z}|t1tddz}t1tddxst1tdd}||z}d} |dkru|s td|tj2||d}n4|||}t |ts t d|dkr t5d|}|stj6|d||_tj8|} t;j<| j>rz"FileIO.__init__..s)DqqF{Dsr r%zKMust have exactly one of create/read/write/append mode and at most one plusr!Tr"r#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_modeIsADirectoryErrorrcEISDIRrdr=_blksizer8_setmoderrglseekr ESPIPE) rfrDrBrHr)fdrnoinherit_flagowned_fdfdfstatrfs rrzFileIO.__init__s 88q= ==HHTXX& dE "BC C dC BAv !;<<B$$$89 94yCM)49: : )D) )Q .$**S/A2E9: : $; DM!DNII *E D[!DNE D[!DNJJ+E D[!DN"DOKK"**,E $;!DN!DN >>dnn RYY E ^^ R[[ E R[[ E Z++!"mQ76!"k15  / Av$%NOO>ue4Be,B%b#.'(FGGAv%&@AA%&&r51#DMhhrlG <<0+ELL,.KK ,EtMM1$G\1=DM}}! 3 R[[)DIHHRH-IT"  &ww%,,./ #" sb+O BP#AO>A PO O  OPOP P&P P PPP+c|jdk\rK|jr>|js1ddl}|j d|t d||j yyyy)Nrzunclosed file r )rsource)rrr}rrResourceWarningrC)rfrs rrzFileIO.__del__HsK 88q=T]]4;;  MM6%&t  5 JJL 4?]=rcHtd|jjdrrrps rrzFileIO.__getstate__Orrc N|jjd|jj}|jrd|zS |j}d|d|d|j d|j d S#t$r*d||j|j |j fzcYSwxYw) Nrdz <%s [closed]>z<%s fd=%d mode=%r closefd=%r>) rer^r_r}rgrBrr=r)rf class_namergs rrzFileIO.__repr__Rs $ 9 9 $ ; ;= ;;"Z/ / B99D  tyy$--A B  F3499dmmDE F Fs A110B$#B$c2|js tdy)NzFile not open for reading)rr\rps rrzFileIO._checkReadable`~~&'BC Crc2|js tdy)NzFile not open for writing)rr\rs rrzFileIO._checkWritabledrrc|j|j||dkr|jS tj|j |S#t $rYywxYw)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)rxrrr-rrrbrs rrz FileIO.readhs_   <4!8<<> ! 77488T* *  sA A%$A%cR|j|jt} tj|j dt }tj|j j}||k\r||z dz}t} t||k\rt|}|t|tz }|t|z } tj|j |}|s t|S||z }o#t$rYwxYw#t$r|r Yt|SYywxYw)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 N)rxrr8r-rrr r9st_sizer<rr3r(rrbr0)rfbufsizermendrRrrFs rrzFileIO.readallxs!  % ((488Q1C((488$,,Ccz)a-6{g%f+3w(;<<#f+%A !, V} eOF    #  V}  s$AC= D = D D  D&%D&ct|jd}|jt|}t|}||d||S)zSame as RawIOBase.readinto().rN)rrrr3)rfr'mrrs rrzFileIO.readintosA qM  s #yyQ  I"1rc|j|j tj|j|S#t $rYywxYw)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)rxrr-rrrbrs rrz FileIO.writesH   88DHHa( (  sA A Act|tr td|jt 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+rr1rxr-rrrls rrjz FileIO.seeks= c5 !45 5 xx#v..rcl|jtj|jdtS)zYtell() -> int. Current file position. Can raise OSError for non seekable files.r)rxr-rrr rps rrqz FileIO.tells' xx!X..rc|j|j||j}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. )rxrrqr- ftruncaterrs rrszFileIO.truncatesC   <99;D TXXt$ rc|js; |jrtj|jt | yy#t | wxYw)zClose the file. A closed file cannot be used for further I/O operations. close() may be called more than once without error. N)r}rr-rCrrrs rrCz FileIO.closesC {{ ==HHTXX&    s +A Ac|j|j$ |jd|_|jS|jS#t$rd|_Y|jSwxYw)z$True if file supports random-access.TF)rx _seekablerqr<rps rrzFileIO.seekablesf  >> ! & "&~~t~~  '!&~~  'sA A+*A+c:|j|jS)z'True if file was opened in a read mode.)rxrrps rrzFileIO.readable ~~rc:|j|jS)z(True if file was opened in a write mode.)rxrrps rrzFileIO.writablerrc:|j|jS)z3Return the underlying file descriptor (an integer).)rxrrps rr:z FileIO.filenos xxrc`|jtj|jS)z.True if the file is connected to a TTY device.)rxr-r7rrps rr7z FileIO.isattys! yy""rc|jS)z6True if the file descriptor will be closed by close().)rrps rrHzFileIO.closefds}}rc|jr|jryy|jr|jryy|jr|jryyy)zString giving the file modezxb+xbzab+abzrb+rXwb)rrrrrps rrBz FileIO.modesC ==~~ __~~ ^^~~r)r"TNr)"r]r^r_rrrrrrrrrrrrrrrrrrrjrqrsrCrrrr:r7rrHrBr2r3s@rr6r6s CHIIJIHwrM BDD !F  (/ /       # rr6cbeZdZdZd dZdZd dZdZdZe dZ e d Z e d Z y) TextIOBaseznBase class for text I/O. This class provides a character and line based interface to stream I/O. c&|jdy)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. rNrkrs rrzTextIOBase.read%s &!rc&|jdy)z.Write string s to stream and returning an int.rNrk)rfss rrzTextIOBase.write/s '"rNc&|jdy)z*Truncate size to pos, where pos is an int.rsNrkrts rrszTextIOBase.truncate3s *%rc&|jdy)z_Read until newline or EOF. Returns an empty string if EOF is hit immediately. rNrkrps rrzTextIOBase.readline7s *%rc&|jdy)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. rNrkrps rrzTextIOBase.detach>rrcy)zSubclasses should override.Nr`rps rrzTextIOBase.encodingGsrcy)zLine endings translated so far. Only line endings translated during reading are considered. Subclasses should override. Nr`rps rnewlineszTextIOBase.newlinesLsrcy)zMError setting of the decoder or encoder. Subclasses should override.Nr`rps rrFzTextIOBase.errorsVs rrr) r]r^r_rrrrsrrrrrrFr`rrrrs\ "#&&$rrcNeZdZdZd dZd dZdZdZdZdZ dZ d Z e d Z y )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. c~tjj||||_||_d|_d|_y)N)rFrF)codecsIncrementalDecoderr translatedecoderseennl pendingcr)rfrrrFs rrz"IncrementalNewlineDecoder.__init__gs7!!**4*?"  rc8|j|}n|jj||}|jr|s|r d|z}d|_|jdr|s |dd}d|_|j d}|j d|z }|j d|z }|xj |xr |j |xr |jz|xr |jzzc_|jr(|r|jdd}|r|jdd}|S)Nfinal Fr*T  ) rdecoderrrr_LF_CR_CRLFrreplace)rfinputroutputcrlfcrlfs rrz IncrementalNewlineDecoder.decodens << F\\((e(>vF]F"DN ??4 CR[F!DN||F# \\$ $ & \\$ $ & txxBO488<* , ,  >>5d3 rc|jd}d}n|jj\}}|dz}|jr|dz}||fS)Nrrr )rgetstater)rfrflags rrz"IncrementalNewlineDecoder.getstatesO << CD --/IC   >> AIDDyrc|\}}t|dz|_|j!|jj||dz fyyr)boolrrsetstate)rfstaterrs rrz"IncrementalNewlineDecoder.setstatesD TdQh << # LL ! !3 "2 3 $rcnd|_d|_|j|jjyy)NrF)rrrresetrps rr zIncrementalNewlineDecoder.resets/  << # LL    $rr r c d|jS)N)Nrr)rrr)rr)rr)rrr)rrps rrz"IncrementalNewlineDecoder.newliness rN)strict)F)r]r^r_rrrrrr rrrrrr`rrrr`sC > 4 ! C C E   rrcpeZdZdZdZdZ d*dZdZ d*dZdZ e dZ e d Z e d Z e d Ze d Zddeddd dZdZdZdZdZdZe dZe dZdZdZdZdZdZdZd+dZdZ dZ!dZ" 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,y).rAaCharacter 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. iNc`|j|t|}|dk(r|j}t|tst d|zt j|jsd}t||z|d}n9t|tst d|ztrt j|||_ d|_ d|_d|_|j j#x|_|_t)|j d|_|j-|||||y) NrrzG%r is not a text encoding; use codecs.open() to handle arbitrary codecsr r 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)rfrUrrFrGrS write_throughrs rrzTextIOWrapper.__init__s  G$ * x 002H(C(3h>? ?}}X&88BCcHn- - >Ffc* !5!>??##F+  #$ )-)=)=)??!$++w7 &'&  7rcz|'t|tstdt||dvrt d|y)Nzillegal newline type: )Nr(rrrzillegal newline value: )r+r/r1typer4)rfrGs rrzTextIOWrapper._check_newlines?  z'3'?$w-IJ J 8 8GEF F 9rc||_||_d|_d|_d|_| |_|du|_||_|dk7|_|xstj|_ ||_ ||_ |jrR|jrA|j j#}|dk7r! |j%j'dyyyy#t($rYywxYw)Nr(r) _encoding_errors_encoder_decoder _b2cratio_readuniversal_readtranslate_readnl_writetranslater-linesep_writenl_line_buffering_write_throughrrrUrq _get_encoderrr)rfrrFrGrSrpositions rrzTextIOWrapper._configures!   ")k%o &"}-2:: -+ >>dmmo{{'')H1}%%'003.> #s)C CCcrdj|jj|jj} |j}|dj|z } |j }|dj|z }|dj|jzS#t $rYJwxYw#t $rY8wxYw)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)rrer^r_rgr=rBr)rfrRrgrBs rrzTextIOWrapper.__repr__!s!:!:!%! 199D m**40 0F 199D m**40 0F*11$--@@@       s# B B* B'&B'* B65B6c|jSr)r"rps rrzTextIOWrapper.encoding2s ~~rc|jSr)r#rps rrFzTextIOWrapper.errors6 ||rc|jSr)r-rps rrSzTextIOWrapper.line_buffering:s###rc|jSr)r.rps rrzTextIOWrapper.write_through>s"""rc|jSr)r rps rrUzTextIOWrapper.bufferBr4r)rrFrGrSrc|j| ||tur td|| |j}n!d}nt |t st d|z| |j}n3t |t st d|z|dk(r|j}|tur |j}|j|| |j}| |j}|j|j|||||y)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 readr r rr)r%Ellipsisr\r#r+r/r1r"rr)rrSrryr)rfrrFrGrSrs r reconfigurezTextIOWrapper.reconfigureFs  MM %)V-?x/&'( ( >!FC(069: :  ~~Hh, 6 ABB8#446 h llG G$  !!00N   ..M  &'&  7rcH|jr td|jS)Nr)r}r4rrps rrzTextIOWrapper.seekableqs ;;<= =~~rc6|jjSr)rUrrps rrzTextIOWrapper.readablevr~rc6|jjSr)rUrrps rrzTextIOWrapper.writableyr~rcZ|jj|j|_yr)rUryrrrps rryzTextIOWrapper.flush|s  rc|j9|js, |j|jjyyy#|jjwxYwr)rUr}ryrCrps rrCzTextIOWrapper.closesL ;; "4;; $  !!# ,7 " !!#rc.|jjSr)rUr}rps rr}zTextIOWrapper.closedrrc.|jjSr)rUrgrps rrgzTextIOWrapper.names{{rc6|jjSr)rUr:rps rr:zTextIOWrapper.fileno{{!!##rc6|jjSr)rUr7rps rr7zTextIOWrapper.isattyrCrc|jr tdt|ts"t d|j j zt|}|jxs |jxrd|v}|r7|jr+|jdk7r|jd|j}|jxs|j}|j|}|jj!||jr|sd|vr|j#|j$|j'dd|_|j(r|j(j+|S)zWrite data, where s is a strr zcan't write %s to text streamrrNr()r}r4r+r/r1rer]r3r*r-r,rr$r/encoderUrryr_set_decoded_charsr%r )rfrlengthhaslfencoderr's rrzTextIOWrapper.writes ;;34 4!S!;KK0012 2Q%%=)=)=L419 T))dmmt.C $ .A--64#4#4#6 NN1  !   Udai JJL >> %  # #B '!DN == MM   ! rctj|j}||j|_|jSr)rgetincrementalencoderr"r#r$)rf make_encoders rr/zTextIOWrapper._get_encoders033DNNC $T\\2 }}rctj|j}||j}|jrt ||j }||_|Sr)rgetincrementaldecoderr"r#r'rr(r%)rf make_decoderrs r _get_decoderzTextIOWrapper._get_decodersK33DNNC t||,   /9L9LMG rc ||_d|_y)zSet the _decoded_chars buffer.rN)rr)rfcharss rrGz TextIOWrapper._set_decoded_charss##$ rc|j}||j|d}n|j|||z}|xjt|z c_|S)z'Advance into the _decoded_chars buffer.N)rrr3)rfroffsetrSs r_get_decoded_charsz TextIOWrapper._get_decoded_charssT)) 9''0E''vz:E   CJ.  rcJ ddl}|jS#t$rYywxYw)Nrr)r getencoding ImportError)rfrs rrz"TextIOWrapper._get_locale_encodings/ (  %%' '   s  ""cb|j|kr td|xj|zc_y)z!Rewind the _decoded_chars buffer.z"rewind decoded_chars out of boundsN)rAssertionErrorrms r_rewind_decoded_charsz#TextIOWrapper._rewind_decoded_charss-  # #a ' !EF F   A% rc&|j td|jr|jj\}}|jr&|j j |j}n%|j j|j}| }|jj||}|j||r't|t|jz |_ nd|_ |jr |zf|_| S)zQ Read and decode the next chunk of data from the BufferedReader. z no decoderr!)r%r4rrrrUr _CHUNK_SIZErrrGr3rr&r)rf dec_buffer dec_flags input_chunkeof decoded_charss r _read_chunkzTextIOWrapper._read_chunks == \* * ==%)MM$:$:$< !J ??++++D,<,<=K++**4+;+;   .  -D4G4G0HHDN DN ==(k)ABDNwrcH||dzz|dzz|dzzt|dzzS)N@)r)rfr0r` bytes_to_feedneed_eof chars_to_skips r _pack_cookiezTextIOWrapper._pack_cookie s=IrM*mS.@As"$&*8nc&9: ;rct|d\}}t|d\}}t|d\}}t|d\}}|||t||fS)Nl)divmodr)rfbigintrestr0r`rjrkrls r_unpack_cookiezTextIOWrapper._unpack_cookie sY.h u-i$T51m"(u"5-M4>=PPrc R|js td|js td|j |j j }|j}| |j|jr td|S|j\}}|t|z}|j}|dk(r|j||S|j} t|j |z}d}|t|ksJ|dkDrs|j#d|ft|j%|d|} | |kr.|j\} } | s| }|| z}n6|t| z}d}n ||z}|dz}|dkDrsd}|j#d|f||z} |} |dk(r#|j| | |j#|Sd}d}d}t'|t|D][}|dz }|t|j%|||dzz }|j\}}|s||kr| |z } ||z}|dd}}} ||k\s[n2|t|j%dd z }d }||kr td |j| | ||||j#|S#|j#|wxYw) N!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr rr FTrz'can't reconstruct logical file position)rr\rr<ryrUrqr%rrr[r3rrmrr,r&rrrange)rfr0rr` next_inputrl saved_state skip_bytes skip_backrr'd start_pos start_flags bytes_fedrk chars_decodedir_s rrqzTextIOWrapper.tell s~~&'JK K}}DE E ;;##%-- ?dnn4""$%;<<O!% :C O#00 A $$Xy9 9&&( F *T^^m;?@ %"++-DAq$% %* #a&(J !I)+J )A I#q.&   #y!12!:-I#K!((K@@   [ )5IHM:s:7Q W^^Jq14E%F!GG (/(8(8(:% I!m}&D*I!]2M._reset_encoder sS $-->4+<+<+> q=$$Q'MMO  sA AAr+rtrz#can't do nonzero cur-relative seeksz#can't do nonzero end-relative seeksr(zunsupported whence ()r'rz#can't restore logical file position)r}r4rr\r rqr ryrUrjrGrr%r rrrQrrrr3rr<r) rfcookiernrr0r{r`rjrkrlras ` rrjzTextIOWrapper.seek s- $ ;;23 3~~&'JK K X {*+PQQFYY[F x {*+PQQ JJL{{''62H  # #B '!DN}} ##% 8 $O Q;&BC C A:FDE E    ' E 9mX} # # Q;4== MM   ! ]]i= MM@T->->-@DM MM " "C#3 4'-DN ++**=9K  # # $$[(; ='5DN4&&'-7CDD'4D $v rcb|j|d}n |j}|}|jxs|j }|dkrb|j |j|jjdz}|j|jdd|_ |Sd}|j |}t||krD|sB|j }||j |t|z z }t||kr|sB|S#t$rt|dwxYw)Nr*rrTrr(F)rrr=r1r%rQrVrrUrrrGr3rd)rfrrrrRrbs rrzTextIOWrapper.read s1  <D $!^^ "|--64#4#4#6 !8--/nnT[[%5%5%7tnDEF~~)''+!%MC,,T2Ff+$S**,,$11$V2DEEf+$SM)" ?4(*< =>> ?s DD.ctd|_|j}|sd|_|j|_t|S)NF)rrrrrrs rrzTextIOWrapper.__next__ s4 }}!DN NNDM  rc$|jr td|d}n |j}|}|j }d}|j s|jdx}} |jr*|jd|}|dk\r|dz}n;t|}n|jrj|jd|}|jd|}|dk(r|dk(r t|}ni|dz}n|dk(r|dz}n||kr|dz}n||dzk(r|dz}n|dz}n|j|j}|dk\r|t|jz}n|dk\rt||k\r|}nj|jr|jrn|jr|jr||j z }n|jd d|_|Se|dk\r||kDr|}|j#t||z |d|S#t$rt |dwxYw) Nrr*rrrr rr r()r}r4rr=r1rVr%rQr(rr3r'r)rdrrGrr\) rfrrrstartrmendposnlposcrposs rrzTextIOWrapper.readline sN ;;45 5 <D $!^^ "|&&(}}    f""iie,!8 1WFIE$$  $. $.B;{ #D "'b["QYFU]"QYFeai'"QYF#QYFii -!8 3t||#44FqySY$.""$&&""$""//11''+!% }@ 19$F ""3t9v#56GV}g" ?4(*< =>> ?s G77HcJ|jr|jjSdSr)r%rrps rrzTextIOWrapper.newlinesU s)-t}}%%@D@r)NNNFFr)rrFrr)-r]r^r_rr^r rrrrrrrFrSrrUr9r:rrrryrCr}rgr:r7rr/rQrGrVrr\rdrmrrrqrsrrjrrrrr`rrrArAs~,KG DH5:7BG >B7<HA"$$##"$#'t)7V &&'$""  $$0 % (& (T01JK;Qa*F) IV:[zAArrAcVeZdZdZdfd ZdZdZedZedZ dZ 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. ctt| tdd||d|_|`t |t s-tdjt|j|j||jdyy)Nr surrogatepass)rrFrGFz*initial_value must be str or None, not {0}r) rrrr r*r+r/r1rrr]rrj)rf initial_valuerGres rrzStringIO.__init__a s h&wy07.=/6 ' 8 ?#(D  $mS1 L!'](;(D(D!EGG JJ} % IIaL %rcD|j|jxs|j}|j}|j  |j |j jd|j|S#|j|wxYw)NTr) ryr%rQrr rrUrr)rfr old_states rrzStringIO.getvalueq sx --64#4#4#6$$&   (>>$++"6"6"8>E   Y 'G  Y 's *B Bc,tj|Sr)objectrrps rrzStringIO.__repr__{ st$$rcyrr`rps rrFzStringIO.errors rcyrr`rps rrzStringIO.encoding rrc&|jdy)Nrrkrps rrzStringIO.detach s (#r)r(r) r]r^r_rrrrrrFrrr2r3s@rrrZ sD  (% $rr)r )r"r*NNNTN)9rr-abcrrcrr_threadrr9platformmsvcrtrriorrr r rYraddr SEEK_DATAr8rbrdev_moder~rr staticmethodrVrZ open_coder=r\r<r4ABCMetarbregisterr_ior6rrr r@r?rrr>rrrrArr`rrrsa )<<&&*H 66 2{&&"$C);<R @R@R( B=A,0KK^ ( I 22 _s{{_B  68#8#t i  6e$Ve$N>*h!~h!VLnL^F%FPf!%f!RF"^F"RG-^^G-TTYTn >>@ z"R 9 9Rjb AJb AJ0$}0$YI('I(  w   s$ H H HH H54H5