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

Method open

numpy/lib/_datasource.py:650–680  ·  view source on GitHub ↗

Open and return file-like object prepending Repository base URL. If `path` is a URL, it will be downloaded, stored in the DataSource directory and opened from there. Parameters ---------- path : str or pathlib.Path Local file path or URL

(self, path, mode='r', encoding=None, newline=None)

Source from the content-addressed store, hash-verified

648 return DataSource.exists(self, self._fullpath(path))
649
650 def open(self, path, mode='r', encoding=None, newline=None):
651 """
652 Open and return file-like object prepending Repository base URL.
653
654 If `path` is a URL, it will be downloaded, stored in the
655 DataSource directory and opened from there.
656
657 Parameters
658 ----------
659 path : str or pathlib.Path
660 Local file path or URL to open. This may, but does not have to,
661 include the `baseurl` with which the `Repository` was
662 initialized.
663 mode : {'r', 'w', 'a'}, optional
664 Mode to open `path`. Mode 'r' for reading, 'w' for writing,
665 'a' to append. Available modes depend on the type of object
666 specified by `path`. Default is 'r'.
667 encoding : {None, str}, optional
668 Open text file with given encoding. The default encoding will be
669 what `open` uses.
670 newline : {None, str}, optional
671 Newline to use when reading text file.
672
673 Returns
674 -------
675 out : file object
676 File object.
677
678 """
679 return DataSource.open(self, self._fullpath(path), mode,
680 encoding=encoding, newline=newline)
681
682 def listdir(self):
683 """

Callers

nothing calls this directly

Calls 2

_fullpathMethod · 0.95
openMethod · 0.45

Tested by

no test coverage detected