MCPcopy Index your code
hub / github.com/dmlc/dgl / download

Function download

python/dgl/data/utils.py:110–216  ·  view source on GitHub ↗

Download a given URL. Codes borrowed from mxnet/gluon/utils.py Parameters ---------- url : str URL to download. path : str, optional Destination path to store downloaded file. By default stores to the current directory with the same name as in url. o

(
    url,
    path=None,
    overwrite=True,
    sha1_hash=None,
    retries=5,
    verify_ssl=True,
    log=True,
)

Source from the content-addressed store, hash-verified

108
109
110def download(
111 url,
112 path=None,
113 overwrite=True,
114 sha1_hash=None,
115 retries=5,
116 verify_ssl=True,
117 log=True,
118):
119 """Download a given URL.
120
121 Codes borrowed from mxnet/gluon/utils.py
122
123 Parameters
124 ----------
125 url : str
126 URL to download.
127 path : str, optional
128 Destination path to store downloaded file. By default stores to the
129 current directory with the same name as in url.
130 overwrite : bool, optional
131 Whether to overwrite the destination file if it already exists.
132 By default always overwrites the downloaded file.
133 sha1_hash : str, optional
134 Expected sha1 hash in hexadecimal digits. Will ignore existing file when hash is specified
135 but doesn't match.
136 retries : integer, default 5
137 The number of times to attempt downloading in case of failure or non 200 return codes.
138 verify_ssl : bool, default True
139 Verify SSL certificates.
140 log : bool, default True
141 Whether to print the progress for download
142
143 Returns
144 -------
145 str
146 The file path of the downloaded file.
147 """
148 if path is None:
149 fname = url.split("/")[-1]
150 # Empty filenames are invalid
151 assert fname, (
152 "Can't construct file-name from this URL. "
153 "Please set the `path` option manually."
154 )
155 else:
156 path = os.path.expanduser(path)
157 if os.path.isdir(path):
158 fname = os.path.join(path, url.split("/")[-1])
159 else:
160 fname = path
161 assert retries >= 0, "Number of retries should be at least 0"
162
163 if not verify_ssl:
164 warnings.warn(
165 "Unverified HTTPS request is being made (verify_ssl=False). "
166 "Adding certificate verification is strongly advised."
167 )

Callers 15

han.pyFile · 0.90
download_vgFunction · 0.90
download_jsonFunction · 0.90
download_datasetsFunction · 0.90
train_cls.pyFile · 0.90
main.pyFile · 0.90
__init__Method · 0.90
train_cls.pyFile · 0.90
__init__Method · 0.90
train_cls.pyFile · 0.90
__init__Method · 0.90
train_cls.pyFile · 0.90

Calls 6

formatMethod · 0.80
check_sha1Function · 0.70
joinMethod · 0.45
getMethod · 0.45
writeMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected