UnRAR2 (version 0.99.2) | index /home/rainman/dev/py-unrar2/UnRAR2/__init__.py

`pyUnRAR2 is a ctypes based wrapper around the free UnRAR.dll.
It is an modified version of Jimmy Retzlaff's pyUnRAR - more simple,
stable and foolproof.
Notice that it has INCOMPATIBLE interface.
It enables reading and unpacking of archives created with the
RAR/WinRAR archivers. There is a low-level interface which is very
similar to the C interface provided by UnRAR. There is also a
higher level interface which makes some common operations easier.`

Package Contents

``

UnRAR2 (package) rar_exceptions | setup test_UnRAR2 | unix windows |

Classes

``

UnRAR2.unix.RarFileImplementation(__builtin__.object)
  RarFile
__builtin__.object
  RarInfo

class RarFile(UnRAR2.unix.RarFileImplementation)

``

Method resolution order:
  RarFile
  UnRAR2.unix.RarFileImplementation
  __builtin__.object

Methods defined here:

__del__(self)

__init__(self, archiveName, password=None)
  `Instantiate the archive.
  archiveName is the name of the RAR file.
  password is used to decrypt the files in the archive.
  Properties:
  comment - comment associated with the archive
  >>> print RarFile('test.rar').comment
  This is a test.`

extract(self, condition='*', path='.', withSubpath=True, overwrite=True)
  `Extract specific files from archive to disk.
  If "condition" is a list of numbers, then extract files which have those positions in infolist.
  If "condition" is a string, then it is treated as a wildcard for names of files to extract.
  If "condition" is a function, it is treated as a callback function, which accepts a RarInfo object
  and returns either boolean True (extract) or boolean False (skip).
  DEPRECATED: If "condition" callback returns string (only supported for Windows) -
  that string will be used as a new name to save the file under.
  If "condition" is omitted, all files are extracted.
  "path" is a directory to extract to
  "withSubpath" flag denotes whether files are extracted with their full path in the archive.
  "overwrite" flag denotes whether extracted files will overwrite old ones. Defaults to true.
  Returns list of RarInfos for extracted files.`

infoiter(self)
  `Iterate over all the files in the archive, generating RarInfos.
  >>> import os
  >>> for fileInArchive in RarFile('test.rar').infoiter():
  ... print os.path.split(fileInArchive.filename)[-1],
  ... print fileInArchive.isdir,
  ... print fileInArchive.size,
  ... print fileInArchive.comment,
  ... print tuple(fileInArchive.datetime)[0:5],
  ... print time.strftime('%a, %d %b %Y %H:%M', fileInArchive.datetime)
  test True 0 None (2003, 6, 30, 1, 59) Mon, 30 Jun 2003 01:59
  test.txt False 20 None (2003, 6, 30, 2, 1) Mon, 30 Jun 2003 02:01
  this.py False 1030 None (2002, 2, 8, 16, 47) Fri, 08 Feb 2002 16:47`

infolist(self)
  `Return a list of RarInfos, descripting the contents of the archive.`

read_files(self, condition='*')
  `Read specific files from archive into memory.
  If "condition" is a list of numbers, then return files which have those positions in infolist.
  If "condition" is a string, then it is treated as a wildcard for names of files to extract.
  If "condition" is a function, it is treated as a callback function, which accepts a RarInfo object
  and returns boolean True (extract) or False (skip).
  If "condition" is omitted, all files are returned.
  Returns list of tuples (RarInfo info, str contents)`

Methods inherited from UnRAR2.unix.RarFileImplementation:

call(self, cmd, options=[], files=[])

destruct(self)

escaped_password(self)

init(self, password=None)

Data descriptors inherited from UnRAR2.unix.RarFileImplementation:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class RarInfo(__builtin__.object)

``

`Represents a file header in an archive. Don't instantiate directly.
Use only to obtain information about file.
YOU CANNOT EXTRACT FILE CONTENTS USING THIS OBJECT.
USE METHODS OF RarFile CLASS INSTEAD.
Properties:
index - index of file within the archive
filename - name of the file in the archive including path (if any)
datetime - file date/time as a struct_time suitable for time.strftime
isdir - True if the file is a directory
size - size in bytes of the uncompressed file
comment - comment associated with the file
Note - this is not currently intended to be a Python file-like object.
`

Methods defined here:

__init__(self, rarfile, data)

__str__(self)

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Functions

``

condition2checker(condition)
  `Converts different condition types to callback`

Data
`` |  | __version__ = '0.99.2' in_windows = False