%PDF- %PDF-
Direktori : /lib64/python2.7/ |
Current File : //lib64/python2.7/gzip.pyo |
� zfc @ s� d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d g Z d d d d d f \ Z Z Z Z Z d d f \ Z Z d � Z d � Z d d d � Z d e j f d � � YZ d � Z e d k r� e � n d S( s� Functions that read and write gzipped files. The user of the file doesn't have to worry about the compression, but random access is not allowed.i����Nt GzipFilet openi i i i i c C s | j t j d | � � d S( Ns <L( t writet structt pack( t outputt value( ( s /usr/lib64/python2.7/gzip.pyt write32u s c C s t j d | j d � � d S( Ns <Ii i ( R t unpackt read( t input( ( s /usr/lib64/python2.7/gzip.pyt read32 s t rbi c C s t | | | � S( s� Shorthand for GzipFile(filename, mode, compresslevel). The filename argument is required; mode defaults to 'rb' and compresslevel defaults to 9. ( R ( t filenamet modet compresslevel( ( s /usr/lib64/python2.7/gzip.pyR s c B s e Z d Z d Z d Z d d d d d d � Z e d � � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d d � Z d � Z d d � Z d � Z d � Z e d � � Z d � Z e j d � Z d � Z d � Z d � Z d � Z d � Z d d � Z d d � Z RS(! s� The GzipFile class simulates most of the methods of a file object with the exception of the readinto() and truncate() methods. i i i c C s� | r | j d d � } n | r: d | k r: | d 7} n | d k rh t j | | pX d � } | _ n | d k r� t | d d � } t | t � s� | d k r� d } q� n | d k r� t | d � r� | j } q� d } n | d d !d k r3t | _ t | _ d | _ d | _ d | _ | | _ d | _ nx | d d !d k sY| d d !d k r�t | _ | j | � t j | t j t j t j d � | _ n t d | d � | | _ d | _ | | _ | j t k r�| j � n d S( sz Constructor for the GzipFile class. At least one of fileobj and filename must be given a non-trivial value. The new class instance is based on fileobj, which can be a regular file, a StringIO object, or any other object which simulates a file. It defaults to None, in which case filename is opened to provide a file object. When fileobj is not None, the filename argument is only used to be included in the gzip file header, which may include the original filename of the uncompressed file. It defaults to the filename of fileobj, if discernible; otherwise, it defaults to the empty string, and in this case the original filename is not included in the header. The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', or 'wb', depending on whether the file will be read or written. The default is the mode of fileobj if discernible; otherwise, the default is 'rb'. Be aware that only the 'rb', 'ab', and 'wb' values should be used for cross-platform portability. The compresslevel argument is an integer from 0 to 9 controlling the level of compression; 1 is fastest and produces the least compression, and 9 is slowest and produces the most compression. 0 is no compression at all. The default is 9. The mtime argument is an optional numeric timestamp to be written to the stream when compressing. All gzip compressed streams are required to contain a timestamp. If omitted or None, the current time is used. This module ignores the timestamp when decompressing; however, some programs, such as gunzip, make use of it. The format of the timestamp is the same as that of the return value of time.time() and of the st_mtime member of the object returned by os.stat(). t Ut t bR t names <fdopen>R i i t rid t wt as Mode s not supportedN( t replacet Nonet __builtin__R t myfileobjt getattrt isinstancet basestringt hasattrR t READt Truet _new_membert extrabuft extrasizet extrastartR t min_readsizet WRITEt _init_writet zlibt compressobjt DEFLATEDt MAX_WBITSt DEF_MEM_LEVELt compresst IOErrort fileobjt offsett mtimet _write_gzip_header( t selfR R R R/ R1 ( ( s /usr/lib64/python2.7/gzip.pyt __init__- sH * " & c C sS d d l } | j d t d � | j t k rL | j d d k rL | j d S| j S( Ni����s use the name attributei i����s .gz( t warningst warnt DeprecationWarningR R&