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

Method exists

numpy/lib/_datasource.py:620–652  ·  view source on GitHub ↗

Test if path exists prepending Repository base URL to path. Test if `path` exists as (and in this order): - a local file. - a remote URL that has been downloaded and stored locally in the `DataSource` directory. - a remote URL that has not been do

(self, path)

Source from the content-addressed store, hash-verified

618 return DataSource.abspath(self, self._fullpath(path))
619
620 def exists(self, path):
621 """
622 Test if path exists prepending Repository base URL to path.
623
624 Test if `path` exists as (and in this order):
625
626 - a local file.
627 - a remote URL that has been downloaded and stored locally in the
628 `DataSource` directory.
629 - a remote URL that has not been downloaded, but is valid and
630 accessible.
631
632 Parameters
633 ----------
634 path : str
635 Can be a local file or a remote URL. This may, but does not
636 have to, include the `baseurl` with which the `Repository` was
637 initialized.
638
639 Returns
640 -------
641 out : bool
642 True if `path` exists.
643
644 Notes
645 -----
646 When `path` is an URL, `exists` will return True if it's either
647 stored locally in the `DataSource` directory, or is a valid remote
648 URL. `DataSource` does not discriminate between the two, the file
649 is accessible if it exists in either location.
650
651 """
652 return DataSource.exists(self, self._fullpath(path))
653
654 def open(self, path, mode='r', encoding=None, newline=None):
655 """

Callers

nothing calls this directly

Calls 2

_fullpathMethod · 0.95
existsMethod · 0.45

Tested by

no test coverage detected