Package Yab :: Module Util :: Class File
[show private | hide private]
[frames | no frames]

Class File


This class is used to store information about a file or directory on the file system.

They are stored out to the cache, so *never* store transient information on them without clearing it through clear_transient.

Never construct these with File(). Use get_file_info, parse_file, or parse_files instead. That guarantees that there is only one File instance for each file in the filesystem.
Method Summary
  __init__(self, normpath)
Normpath *must* be absolute and have been returned from os.path.normpath.
  __repr__(self)
  __str__(self)
Return the name of the file as a relative path from the current working directory.
  clear_transient(self)
Clear any transient attributes that were saved to the cache
  dirname(self)
Return the File object that represents the directory that this File resides in.
  extract_uncommon_components(self, files)
  file_contains(self, contains, compiled_contains)
Does the file contain the regexp 'contains'.
  flush_mtime(self)
Flush the cache used in mtime()
  get_includes(self, include_path)
Given an include path (as a tuple of Files), return the Files that this file includes.
  get_java_package(self)
Get the java package for the file.
  mtime(self)
Return the files modification time.
  relative_to(self, file)
Return the pathname for the file as a relative path from 'path'
  remove(self)
Remove the file from the filesystem
  set_includes(self, include_path, includes)
Sets the value that is retrieved by get_includes.
  set_java_package(self, package)
Set the java package for this file.
  subdir(self, name)
Return a File object that represents the given sub-directory of this one.

Method Details

__init__(self, normpath)
(Constructor)

Normpath *must* be absolute and have been returned from os.path.normpath.

__str__(self)
(Informal representation operator)

Return the name of the file as a relative path from the current working directory. Will also quote the filename if it has spaces in it.

clear_transient(self)

Clear any transient attributes that were saved to the cache

dirname(self)

Return the File object that represents the directory that this File resides in.

file_contains(self, contains, compiled_contains)

Does the file contain the regexp 'contains'. 'compiled_contains' *must* be re.compile(contains).

flush_mtime(self)

Flush the cache used in mtime()

get_includes(self, include_path)

Given an include path (as a tuple of Files), return the Files that this file includes. If this was never set with set_includes(), or the file has changed on disk, raise KeyError

get_java_package(self)

Get the java package for the file. Returns None if the package was never set with set_java_package, or the file has changed since the last call to set_java_package.

mtime(self)

Return the files modification time. Stored in a cache for speed. If you modify the file, you are responsible for calling flush_mtime to flush this cache.

relative_to(self, file)

Return the pathname for the file as a relative path from 'path'

remove(self)

Remove the file from the filesystem

set_includes(self, include_path, includes)

Sets the value that is retrieved by get_includes.

set_java_package(self, package)

Set the java package for this file.

subdir(self, name)

Return a File object that represents the given sub-directory of this one.

Generated by Epydoc 2.0 on Fri Aug 15 16:30:52 2003 http://epydoc.sf.net