Package obitools :: Module gzip
[hide private]
[frames] | no frames]

Module gzip

source code

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.

This consisted on a patched version of of standard gzip python module based on Andrew Kuchling's minigzip.py distributed with the zlib module

Classes [hide private]
  GzipFile
The GzipFile class simulates most of the methods of a file object with the exception of the readinto() and truncate() methods.
Functions [hide private]
 
U32(i)
Return i as an unsigned integer, assuming it fits in 32 bits.
source code
 
LOWU32(i)
Return the low-order 32 bits of an int, as a non-negative int.
source code
 
write32(output, value) source code
 
write32u(output, value) source code
 
read32(input) source code
 
unpack32(buf) source code
 
open(filename, mode='rb', compresslevel=9)
Shorthand for GzipFile(filename, mode, compresslevel).
source code
 
_test() source code
Variables [hide private]
  FCOMMENT = 16
  FEXTRA = 4
  FHCRC = 2
  FNAME = 8
  FTEXT = 1
  READ = 1
  WRITE = 2
  __package__ = 'obitools'

Imports: struct, sys, time, zlib, __builtin__


Function Details [hide private]

U32(i)

source code 

Return i as an unsigned integer, assuming it fits in 32 bits.

If it's >= 2GB when viewed as a 32-bit unsigned int, return a long.

open(filename, mode='rb', compresslevel=9)

source code 

Shorthand for GzipFile(filename, mode, compresslevel).

The filename argument is required; mode defaults to 'rb' and compresslevel defaults to 9.