MCPcopy Index your code
hub / github.com/numpy/numpy / _findfile

Method _findfile

numpy/lib/_datasource.py:340–369  ·  view source on GitHub ↗

Searches for ``path`` and returns full path if found. If path is a 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 v

(self, path)

Source from the content-addressed store, hash-verified

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

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