Exemplo n.º 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 = md5.md5(repr(args)).hexdigest()
     return Files.getCacheFile(self.__class__.__name__, hash)
Exemplo n.º 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 segmentsLower[0] == 'author' or segmentsLower[0] == 'project':
         target = segmentsLower[1]
         segmentsLower.insert(1, target[0])
     return Files.tryGetDir(Files.dbDir, 'stats', *segmentsLower)
Exemplo n.º 3
0
 def getTempFilename(self):
     """Return a suggested temporary file name for miss() to use"""
     return Files.getTempFile()