MCPcopy Create free account
hub / github.com/numpy/numpy / _findfile

Method _findfile

numpy/lib/_datasource.py:344–373  ·  view source on GitHub ↗

Searches for ``path`` and returns full path if found. If path is an URL, _findfile will cache a local copy and return the path to the cached file. If path is a local file, _findfile will return a path to that local file. The search will include possible compressed

(self, path)

Source from the content-addressed store, hash-verified

342 return upath
343
344 def _findfile(self, path):
345 """Searches for ``path`` and returns full path if found.
346
347 If path is an URL, _findfile will cache a local copy and return the
348 path to the cached file. If path is a local file, _findfile will
349 return a path to that local file.
350
351 The search will include possible compressed versions of the file
352 and return the first occurrence found.
353
354 """
355
356 # Build list of possible local file paths
357 if not self._isurl(path):
358 # Valid local paths
359 filelist = self._possible_names(path)
360 # Paths in self._destpath
361 filelist += self._possible_names(self.abspath(path))
362 else:
363 # Cached URLs in self._destpath
364 filelist = self._possible_names(self.abspath(path))
365 # Remote URLs
366 filelist = filelist + self._possible_names(path)
367
368 for name in filelist:
369 if self.exists(name):
370 if self._isurl(name):
371 name = self._cache(name)
372 return name
373 return None
374
375 def abspath(self, path):
376 """

Callers 2

openMethod · 0.95
_findfileMethod · 0.45

Calls 5

_isurlMethod · 0.95
_possible_namesMethod · 0.95
abspathMethod · 0.95
existsMethod · 0.95
_cacheMethod · 0.95

Tested by

no test coverage detected