)EjbddlmZddlZddlmZddlmZmZmZGddeeZ dS)) annotationsN)Iterable)IOAnyStrNoReturnceZdZdZd-d Zd.d Zd.d Zejfd/dZ d0dZ d.dZ d1d2dZ d1d2dZ d1d3dZd.dZd4dZd5dZd6d7d"Zd8d$Zd9d'Zd8d(Zd:d)Zd0d*Zd;d+Zd;d,Zd S)< ContainerIOzm A file object that provides read access to a part of an existing file (for example a TAR file). file IO[AnyStr]offsetintlengthreturnNonecr||_d|_||_||_|j|dS)z Create file object. :param file: Existing file. :param offset: Start of region, in bytes. :param length: Size of region, in bytes. rN)fhposr rseek)selfr r rs AC:\PYTHON\MyICR_Suite\python\Lib\site-packages\PIL/ContainerIO.py__init__zContainerIO.__init__s:#    VboolcdSNFrs risattyzContainerIO.isatty.urcdSNTrrs rseekablezContainerIO.seekable1trmodec|dkr|j|z|_n|dkr|j|z|_n||_tdt|j|j|_|j|j|jz|jS)aK Move file pointer. :param offset: Offset in bytes. :param mode: Starting position. Use 0 for beginning of region, 1 for current offset, and 2 for end of region. You cannot move the pointer outside the defined region. :returns: Offset from start of region, in bytes. r)rrmaxminrrr )rr r$s rrzContainerIO.seek4s 199x&(DHH QYY{V+DHHDHq#dh 4455  T[48+,,,xrc|jS)ze Get current file pointer. :returns: Offset from start of region, in bytes. )rrs rtellzContainerIO.tellIs xrcdSr!rrs rreadablezContainerIO.readableQr#rnrc|dkrt||j|jz }n|j|jz }|dkrd|jjvrdndS|j|z|_|j|S)z Read data. :param n: Number of bytes to read. If omitted, zero or negative, read until end of region. :returns: An 8-bit string. rbr)r)rrrr$read)rr/s rr3zContainerIO.readTsu q55At{TX-..AA dh&A 66--332 58a<w||Arcd|jjvrdnd}d|jjvrdnd} |d}|sn ||z}||kst||krn8|S)z Read a line of text. :param n: Number of bytes to read. If omitted, zero or negative, read until end of line. :returns: An 8-bit string. r1rr2  Tr&)rr$r3len)rr/snewline_charactercs rreadlinezContainerIO.readlinees$',..CCB%(DGL%8%8EEd  ! A AA%%%Q1  r int | None list[AnyStr]cg} |}|sn*||t||krnA|S)z Read multiple lines of text. :param n: Number of lines to read. If omitted, zero, negative or None, read until end of region. :returns: A list of 8-bit strings. )r;appendr7)rr/linesr8s r readlineszContainerIO.readlinesxsS  A  LLOOO5zzQ   rcdSrrrs rwritablezContainerIO.writablerrr1rctNNotImplementedError)rr1s rwritezContainerIO.write!###rr@Iterable[AnyStr]ctrErF)rr@s r writelineszContainerIO.writelinesrIrNsizectrErF)rrMs rtruncatezContainerIO.truncaterIrContainerIO[AnyStr]c|SrErrs r __enter__zContainerIO.__enter__ rargsobjectc.|dSrE)close)rrTs r__exit__zContainerIO.__exit__s rc|SrErrs r__iter__zContainerIO.__iter__rSrcT|}|sd}t||S)Nz end of region)r; StopIteration)rlinemsgs r__next__zContainerIO.__next__s/}} %!C$$ $ rc4|jSrE)rfilenors rrazContainerIO.filenosw~~rc8|jdSrE)rflushrs rrczContainerIO.flush  rc8|jdSrE)rrWrs rrWzContainerIO.closerdr)r r r r rr rr)rr)r r r$r rr )rr )r.)r/r rr)r/r<rr=)r1rrr)r@rJrrrE)rMr<rr )rrP)rTrUrr)rr)rr)__name__ __module__ __qualname____doc__rrr"ioSEEK_SETrr+r-r3r;rArCrHrLrOrRrXrZr_rarcrWrrrr r s    "-/K*"&$$$$$$$$$$$$$$    rr ) __future__rrjcollections.abcrtypingrrrr rrrros #""""" $$$$$$''''''''''VVVVV"V*VVVVVr