[pygccxml-commit] source/pygccxml/parser directory_cache.py,1.1,1.2
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <mb...@us...> - 2006-03-08 08:37:36
|
Update of /cvsroot/pygccxml/source/pygccxml/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18921 Modified Files: directory_cache.py Log Message: Switched to epytext markup for the main class Index: directory_cache.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/directory_cache.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** directory_cache.py 6 Mar 2006 14:31:41 -0000 1.1 --- directory_cache.py 8 Mar 2006 08:37:20 -0000 1.2 *************** *** 7,10 **** --- 7,18 ---- # by Matthias Baas (ba...@ir...). + """Directory cache implementation. + + This module contains the implementation of a cache that uses individual + files stored in a dedicated cache directory to store the cached contents. + The cache class is L{directory_cache_t} which can be passed to the C{cache} + argument of the L{parse()} function. + """ + import os, os.path, gzip, md5 import cPickle *************** *** 101,104 **** --- 109,121 ---- def update(self, source_file, configuration, declarations, included_files): """Replace a cache entry by a new value. + + @param source_file: Header file name. + @type source_file: str + @param configuration: Configuration object. + @type configuration: L{config_t} + @param declarations: Declarations contained in the header file. + @type declarations: picklable object + @param included_files: Dependent files + @type included_files: list of str """ # Normlize all paths... *************** *** 139,142 **** --- 156,165 ---- def cached_value(self, source_file, configuration): """Return the cached declarations or None. + + @param source_file: Header file name + @type source_file: str + @param configuration: Configuration object + @type configuration: L{config_t} + @return: Cached declarations or None """ *************** *** 180,184 **** """Load the cache. ! This method is called in the constructor. """ --- 203,210 ---- """Load the cache. ! Loads the file index.dat which contains the index table and ! the file name repository. ! ! This method is called by the constructor. """ *************** *** 200,203 **** --- 226,232 ---- def _save(self): """Save the cache index if it was modified. + + Saves the index table and the file name repository in the file + index.dat. """ if self.__modified_flag: *************** *** 211,214 **** --- 240,247 ---- Reads a pickled object from disk and returns it. + + @param filename: Name of the file that should be read. + @type filename: str + @returns: Unpickled file contents """ if self.__compression: *************** *** 224,227 **** --- 257,265 ---- The data object is written to a file using the pickle mechanism. + + @param filename: Output file name + @type filename: str + @param data: A Python object that will be pickled + @type data: picklable object """ if self.__compression: *************** *** 236,240 **** source_file is the name of the header and key is its corresponding ! cache key (obtained by a call to _create_cache_key()). The entry is removed from the index table, any referenced file name is released and the cache file is deleted. --- 274,278 ---- source_file is the name of the header and key is its corresponding ! cache key (obtained by a call to L{_create_cache_key()}). The entry is removed from the index table, any referenced file name is released and the cache file is deleted. *************** *** 242,245 **** --- 280,288 ---- If key references a non-existing entry, the method returns immediately. + + @param source_file: Header file name + @type source_file: str + @param key: Key value for the specified header file + @type key: hashable object """ *************** *** 265,269 **** def _create_cache_key(self, source_file): ! """Return the cache key for a header file.""" path, name = os.path.split(source_file) return name+str(hash(path)) --- 308,318 ---- def _create_cache_key(self, source_file): ! """Return the cache key for a header file. ! ! @param source_file: Header file name ! @type source_file: str ! @returns: Key for the given header file ! @rtype: str ! """ path, name = os.path.split(source_file) return name+str(hash(path)) *************** *** 271,274 **** --- 320,328 ---- def _create_cache_filename(self, source_file): """Return the cache file name for a header file. + + @param source_file: Header file name + @type source_file: str + @returns: Cache file name (*.cache) + @rtype: str """ res = self._create_cache_key(source_file)+".cache" *************** *** 277,280 **** --- 331,343 ---- def _create_config_signature(self, config): """Return the signature for a config object. + + The signature is computed as md5 digest of the contents of + working_directory, include_paths, define_symbols and + undefine_symbols. + + @param config: Configuration object + @type config: L{config_t} + @returns: Signature + @rtype: str """ m = md5.new() |