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

Method exists

numpy/lib/_datasource.py:616–648  ·  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

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

Callers 4

test_ValidFileMethod · 0.95
test_InvalidFileMethod · 0.95
test_RemoveHTTPFileMethod · 0.95
test_CachedHTTPFileMethod · 0.95

Calls 2

_fullpathMethod · 0.95
existsMethod · 0.45

Tested by 4

test_ValidFileMethod · 0.76
test_InvalidFileMethod · 0.76
test_RemoveHTTPFileMethod · 0.76
test_CachedHTTPFileMethod · 0.76