numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
DataSource(destpath='.')

DataSources can be local files or remote files/URLs. The files may also be compressed or uncompressed. DataSource hides some of the low-level details of downloading the file, allowing you to simply pass in a valid file path (or URL) and obtain a file object.

Notes

URLs require a scheme string ( http:// ) to be used, without it they will fail:

>>> repos = np.DataSource()
>>> repos.exists('www.google.com/index.html')
False
>>> repos.exists('http://www.google.com/index.html')
True

Temporary directories are deleted when the DataSource is deleted.

Parameters

destpath : str or None, optional

Path to the directory where the source file gets downloaded to for use. If :None:None:`destpath` is None, a temporary directory will be created. The default path is the current directory.

A generic data source file (file, http, ftp, ...).

Examples

>>> ds = np.DataSource('/home/guido')
>>> urlname = 'http://www.google.com/'
>>> gfile = ds.open('http://www.google.com/')
>>> ds.abspath(urlname)
'/home/guido/www.google.com/index.html'
>>> ds = np.DataSource(None)  # use with temporary file
>>> ds.open('/home/guido/foobar.txt')
<open file '/home/guido.foobar.txt', mode 'r' at 0x91d4430>
>>> ds.abspath('/home/guido/foobar.txt')
'/tmp/.../home/guido/foobar.txt'
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.lib._datasource.Repository.exists numpy.lib._datasource.Repository.abspath numpy.lib._datasource.Repository numpy.lib._datasource.DataSource.exists numpy.lib._datasource.DataSource.abspath numpy.lib._datasource.DataSource.open numpy.lib._datasource.open

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/__init__.py#None
type: <class 'type'>
Commit: