Package nltk :: Module data :: Class ZipFilePathPointer
[hide private]
[frames] | no frames]

Class ZipFilePathPointer

source code

 object --+    
          |    
PathPointer --+
              |
             ZipFilePathPointer

A path pointer that identifies a file contained within a zipfile, which can be accessed by reading that zipfile.

Instance Methods [hide private]
 
__init__(self, zipfile, entry='')
Create a new path pointer pointing at the specified entry in the given zipfile.
source code
 
open(self, encoding=None)
Return a seekable read-only stream that can be used to read the contents of the file identified by this path pointer.
source code
 
file_size(self)
Return the size of the file pointed to by this path pointer, in bytes.
source code
 
join(self, fileid)
Return a new path pointer formed by starting at the path identified by this pointer, and then following the relative path given by fileid.
source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]
  zipfile
The zipfile.ZipFile object used to access the zip file containing the entry identified by this path pointer.
  entry
The name of the file within zipfile that this path pointer points to.

Inherited from object: __class__

Method Details [hide private]

__init__(self, zipfile, entry='')
(Constructor)

source code 

Create a new path pointer pointing at the specified entry in the given zipfile.

Raises:
  • IOError - If the given zipfile does not exist, or if it does not contain the specified entry.
Overrides: object.__init__

open(self, encoding=None)

source code 

Return a seekable read-only stream that can be used to read the contents of the file identified by this path pointer.

Raises:
  • IOError - If the path specified by this pointer does not contain a readable file.
Overrides: PathPointer.open
(inherited documentation)

file_size(self)

source code 

Return the size of the file pointed to by this path pointer, in bytes.

Raises:
  • IOError - If the path specified by this pointer does not contain a readable file.
Overrides: PathPointer.file_size
(inherited documentation)

join(self, fileid)

source code 

Return a new path pointer formed by starting at the path identified by this pointer, and then following the relative path given by fileid. The path components of fileid should be seperated by forward slashes (/), regardless of the underlying file system's path seperator character.

Overrides: PathPointer.join
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

Property Details [hide private]

zipfile

The zipfile.ZipFile object used to access the zip file containing the entry identified by this path pointer.

Get Method:
unreachable(self)

entry

The name of the file within zipfile that this path pointer points to.

Get Method:
unreachable(self)