Example #1
0
 def getFilename(self, args):
     """Return a filename for a cached object corresponding to the provided args
        and this data type. This combines a hash of args with the name of this class.
        We create the cache directory if necessary.
        """
     hash = hashlib.md5(repr(args)).hexdigest()
     return Files.getCacheFile(self.__class__.__name__, hash)
Example #2
0
    def getDiskPath(self):
        """Every target gets a directory on disk. This returns it, without any
           guarantee that it exists yet.
           """
        # XXX - Bear hack: store as stats/author/f/foobar for filesystem sanity
        segmentsLower = map(string.lower, self.pathSegments)
	if len(segmentsLower) > 0:
        	if len(segmentsLower) > 0 and segmentsLower[0] == 'author' or segmentsLower[0] == 'project':
            		target = segmentsLower[1]
            		segmentsLower.insert(1, target[0])
        return Files.tryGetDir(Files.dbDir, 'stats', *segmentsLower)
Example #3
0
 def getTempFilename(self):
     """Return a suggested temporary file name for miss() to use"""
     return Files.getTempFile()