o ckF[K@s*dZddlZddlmZGdddZdS)z Wrapper class to expose a Key being read via a partial implementaiton of the Python file interface. The only functions supported are those needed for seeking in a Key open for reading. N)StorageResponseErrorc@seZdZddZddZejfddZddZd d Z d d Z d dZ ddZ ddZ ddZddZddZddZddZddZdd Zd!d"Zd#S)$KeyFilecCsF||_|jd|_d|_d|_d|_d|_d|_d|_|j |_ dS)NrFrzUndefined in KeyFile) key open_readlocationclosed softspacemodeencodingerrorsnewlinesname)selfrr1/usr/lib/python3/dist-packages/boto/s3/keyfile.py__init__"s  zKeyFile.__init__cCs|jdur td|jS)NzI/O operation on closed file)r ValueErrorrrrrtell.s z KeyFile.tellc Cs |jjdd|tjkr<|jjdkrdS|jj|d}|dkr$td|jjdd|id|jd|d|_dS|tj krJ|dkrItdn|tj krU||j7}ntd |z |jjdd|idWnt y}z |j d krvWYd}~nd}~ww||_dS) NT)fastrzInvalid argumentRangez bytes=%d-)headersz(Invalid whence param (%d) passed to seeki) rcloseosSEEK_ENDsizeIOErrorrreadrSEEK_SETSEEK_CURrstatus)rposwhenceerrrseek3s6           z KeyFile.seekcCs|j|7_|j|SN)rrr )rrrrrr Ws z KeyFile.readcCs|jd|_d|_dS)NT)rrrr rrrrr  z KeyFile.closecCsdS)NFrrrrrisatty`szKeyFile.isattycCs|jSr()rrrrrgetkeyeszKeyFile.getkeycCtd)Nz write not implemented in KeyFileNotImplementedError)rbufrrrwritejz KeyFile.writecCr+)Nz!fileno not implemented in KeyFiler,rrrrfilenomr0zKeyFile.filenocCr+)Nz flush not implemented in KeyFiler,rrrrflushpr0z KeyFile.flushcCr+)Nznext not implemented in KeyFiler,rrrrnextsr0z KeyFile.nextcCr+)Nz#readinto not implemented in KeyFiler,rrrrreadintovr0zKeyFile.readintocCr+)Nz#readline not implemented in KeyFiler,rrrrreadlineyr0zKeyFile.readlinecCr+)Nz$readlines not implemented in KeyFiler,rrrr readlines|r0zKeyFile.readlinescCr+)Nz#truncate not implemented in KeyFiler,rrrrtruncater0zKeyFile.truncatecCr+)Nz%writelines not implemented in KeyFiler,rrrr writelinesr0zKeyFile.writelinescCr+)Nz%xreadlines not implemented in KeyFiler,rrrr xreadlinesr0zKeyFile.xreadlinesN)__name__ __module__ __qualname__rrrr!r'r rr)r*r/r1r2r3r4r5r6r7r8r9rrrrr s$ $ r)__doc__rboto.exceptionrrrrrrs