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
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
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
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
def cacheFilePath(self): filePath = common.getMetadataCacheFilePath() / 'core.p.gz' return filePath
def cacheFilePath(self): filePath = os.path.join( common.getMetadataCacheFilePath(), 'core.json', ) return filePath
def cacheFilePath(self): filePath = common.getMetadataCacheFilePath() / 'core.p.gz' return filePath