Ejemplo n.º 1
0
    def filePath(self):
        r'''
        The filesystem name of the cached metadata bundle, if the metadata
        bundle's name is not None.
        
        >>> ccPath = corpus.corpora.CoreCorpus().metadataBundle.filePath
        >>> ccPath.endswith('core.json')
        True
        >>> '_metadataCache' in ccPath
        True
        
        >>> localPath = corpus.corpora.LocalCorpus().metadataBundle.filePath
        >>> localPath.endswith('local.json')
        True
        
        Local corpora metadata is stored in the scratch dir, not the
        corpus directory
        
        >>> '_metadataCache' in localPath
        False
        
        >>> funkPath = corpus.corpora.LocalCorpus('funk').metadataBundle.filePath
        >>> funkPath.endswith('local-funk.json')
        True       
        '''
        #         >>> virPath = corpus.corpora.VirtualCorpus().metadataBundle.filePath
        #         >>> virPath.endswith('virtual.json')
        #         True
        #         >>> '_metadataCache' in virPath
        #         True

        if self.name is None:
            return None
        if self.name in ('virtual', 'core'):
            filePath = os.path.join(
                common.getMetadataCacheFilePath(),
                self.name + '.json',
            )
        elif self.name.startswith('local'):
            # write in temporary dir
            filePath = os.path.join(
                environLocal.getRootTempDir(),
                self.name + '.json',
            )
        else:  # pragma: no cover
            filePath = os.path.join(
                environLocal.getRootTempDir(),
                'unnamed-corpus.json',
            )
        return filePath
Ejemplo n.º 2
0
 def filePath(self):
     r"""
     The filesystem name of the cached metadata bundle, if the metadata
     bundle's name is not None.
     """
     if self.name is None:
         return None
     if self.name in ("virtual", "core"):
         filePath = os.path.join(common.getMetadataCacheFilePath(), self.name + ".json")
     elif self.name == "local":
         # write in temporary dir
         filePath = os.path.join(environLocal.getRootTempDir(), self.name + ".json")
     else:
         filePath = os.path.join(environLocal.getRootTempDir(), "local-{0}.json".format(self.name))
     return filePath
Ejemplo n.º 3
0
 def filePath(self):
     r'''
     The filesystem name of the cached metadata bundle, if the metadata
     bundle's name is not None.
     '''
     if self.name is None:
         return None
     if self.name in ('virtual', 'core'):
         filePath = os.path.join(
             common.getMetadataCacheFilePath(),
             self.name + '.json',
         )
     elif self.name == 'local':
         # write in temporary dir
         filePath = os.path.join(
             environLocal.getRootTempDir(),
             self.name + '.json',
         )
     else:
         filePath = os.path.join(
             environLocal.getRootTempDir(),
             'local-{0}.json'.format(self.name),
         )
     return filePath
Ejemplo n.º 4
0
 def filePath(self):
     r'''
     The filesystem name of the cached metadata bundle, if the metadata
     bundle's name is not None.
     '''
     if self.name is None:
         return None
     if self.name in ('virtual', 'core'):
         filePath = os.path.join(
             common.getMetadataCacheFilePath(),
             self.name + '.json',
             )
     elif self.name == 'local':
         # write in temporary dir
         filePath = os.path.join(
             environLocal.getRootTempDir(),
             self.name + '.json',
             )
     else:
         filePath = os.path.join(
             environLocal.getRootTempDir(),
             'local-{0}.json'.format(self.name),
             )
     return filePath
Ejemplo n.º 5
0
 def cacheFilePath(self):
     filePath = common.getMetadataCacheFilePath() / 'core.p.gz'
     return filePath
Ejemplo n.º 6
0
 def cacheFilePath(self):
     filePath = os.path.join(
         common.getMetadataCacheFilePath(),
         'core.json',
     )
     return filePath
Ejemplo n.º 7
0
 def cacheFilePath(self):
     filePath = common.getMetadataCacheFilePath() / 'core.p.gz'
     return filePath