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

Class FileSystemPathPointer

source code

    object --+    
             |    
   PathPointer --+
                 |
object --+       |
         |       |
basestring --+   |
             |   |
           str --+
                 |
                FileSystemPathPointer
Known Subclasses:

A path pointer that identifies a file which can be accessed directly via a given absolute path. FileSystemPathPointer is a subclass of str for backwards compatibility purposes -- this allows old code that expected nltk.data.find() to expect a string to usually work (assuming the resource is not found in a zipfile).

Instance Methods [hide private]
 
__init__(self, path)
Create a new path pointer for the given absolute path.
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
 
__str__(self)
str(x)
source code

Inherited from str: __add__, __contains__, __eq__, __ge__, __getattribute__, __getitem__, __getnewargs__, __getslice__, __gt__, __hash__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __new__, __rmod__, __rmul__, capitalize, center, count, decode, encode, endswith, expandtabs, find, index, isalnum, isalpha, isdigit, islower, isspace, istitle, isupper, ljust, lower, lstrip, partition, replace, rfind, rindex, rjust, rpartition, rsplit, rstrip, split, splitlines, startswith, strip, swapcase, title, translate, upper, zfill

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]
  path
The absolute path identified by this path pointer.

Inherited from object: __class__

Method Details [hide private]

__init__(self, path)
(Constructor)

source code 

Create a new path pointer for the given absolute path.

Raises:
  • IOError - If the given path does not exist.
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: str.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: str.__str__
(inherited documentation)

Property Details [hide private]

path

The absolute path identified by this path pointer.

Get Method:
unreachable(self)