20
20
from hashlib import sha256
21
21
from pathlib import Path
22
22
from typing import List , Optional , Type , TypeVar , Union
23
- from urllib .parse import urljoin , urlparse
23
+ from urllib .parse import urlparse
24
24
25
25
import requests
26
26
from datasets import DownloadConfig
@@ -183,7 +183,6 @@ def cached_path(
183
183
use_etag = download_config .use_etag ,
184
184
max_retries = download_config .max_retries ,
185
185
token = download_config .token ,
186
- ignore_url_params = download_config .ignore_url_params ,
187
186
download_desc = download_config .download_desc ,
188
187
)
189
188
elif os .path .exists (url_or_filename ):
@@ -409,7 +408,6 @@ def get_from_cache(
409
408
use_etag = True ,
410
409
max_retries = 0 ,
411
410
token = None ,
412
- ignore_url_params = False ,
413
411
download_desc = None ,
414
412
) -> str :
415
413
"""
@@ -432,12 +430,6 @@ def get_from_cache(
432
430
433
431
os .makedirs (cache_dir , exist_ok = True )
434
432
435
- if ignore_url_params :
436
- # strip all query parameters and #fragments from the URL
437
- cached_url = urljoin (url , urlparse (url ).path )
438
- else :
439
- cached_url = url # additional parameters may be added to the given URL
440
-
441
433
connected = False
442
434
response = None
443
435
cookies = None
@@ -446,7 +438,7 @@ def get_from_cache(
446
438
447
439
# Try a first time to file the file on the local file system without eTag (None)
448
440
# if we don't ask for 'force_download' then we spare a request
449
- filename = hash_url_to_filename (cached_url , etag = None )
441
+ filename = hash_url_to_filename (url , etag = None )
450
442
cache_path = os .path .join (cache_dir , filename )
451
443
452
444
if os .path .exists (cache_path ) and not force_download and not use_etag :
@@ -526,7 +518,7 @@ def get_from_cache(
526
518
raise ConnectionError (f"Couldn't reach { url } " )
527
519
528
520
# Try a second time
529
- filename = hash_url_to_filename (cached_url , etag )
521
+ filename = hash_url_to_filename (url , etag )
530
522
cache_path = os .path .join (cache_dir , filename )
531
523
532
524
if os .path .exists (cache_path ) and not force_download :
0 commit comments