Repository: huggingface/datasets
File: src/datasets/utils/file_utils.py (Python)

Code before:
            if tries > max_retries:
                raise err
            else:
                logger.info(f"{method} request to {url} timed out, retrying... [{tries/max_retries}]")
                sleep_time = min(max_wait_time, base_wait_time * 2 ** (tries - 1))  # Exponential backoff
                time.sleep(sleep_time)
    return response


def fsspec_head(url, timeout=10.0):
    _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    fs, _, paths = fsspec.get_fs_token_paths(url, storage_options={"requests_timeout": timeout})
    if len(paths) > 1:
        raise ValueError(f"HEAD can be called with at most one path but was called with {paths}")
    return fs.info(paths[0])


def fsspec_get(url, temp_file, timeout=10.0, desc=None):
    _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    fs, _, paths = fsspec.get_fs_token_paths(url, storage_options={"requests_timeout": timeout})
    if len(paths) > 1:
        raise ValueError(f"GET can be called with at most one path but was called with {paths}")
    callback = fsspec.callbacks.TqdmCallback(
        tqdm_kwargs={
            "desc": desc or "Downloading",
            "disable": logging.is_progress_bar_enabled(),
        }
    )
    fs.get_file(paths[0], temp_file.name, callback=callback)


def ftp_head(url, timeout=10.0):
    _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    try:
        with closing(urllib.request.urlopen(url, timeout=timeout)) as r:
            r.read(1)
    except Exception:
        return False
    return True


def ftp_get(url, temp_file, timeout=10.0):
    _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    try:
        logger.info(f"Getting through FTP {url} into {temp_file.name}")
        with closing(urllib.request.urlopen(url, timeout=timeout)) as r:
            shutil.copyfileobj(r, temp_file)
    except urllib.error.URLError as e:
        raise ConnectionError(e) from None



Review comment (suggestion):
```suggestion
            "disable": not logging.is_progress_bar_enabled(),
```

Code after:
            if tries > max_retries:
                raise err
            else:
                logger.info(f"{method} request to {url} timed out, retrying... [{tries/max_retries}]")
                sleep_time = min(max_wait_time, base_wait_time * 2 ** (tries - 1))  # Exponential backoff
                time.sleep(sleep_time)
    return response


def fsspec_head(url, timeout=10.0):
    _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    fs, _, paths = fsspec.get_fs_token_paths(url, storage_options={"requests_timeout": timeout})
    if len(paths) > 1:
        raise ValueError(f"HEAD can be called with at most one path but was called with {paths}")
    return fs.info(paths[0])


def fsspec_get(url, temp_file, timeout=10.0, desc=None):
    _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    fs, _, paths = fsspec.get_fs_token_paths(url, storage_options={"requests_timeout": timeout})
    if len(paths) > 1:
        raise ValueError(f"GET can be called with at most one path but was called with {paths}")
    callback = fsspec.callbacks.TqdmCallback(
        tqdm_kwargs={
            "desc": desc or "Downloading",
            "disable": not logging.is_progress_bar_enabled(),
        }
    )
    fs.get_file(paths[0], temp_file.name, callback=callback)


def ftp_head(url, timeout=10.0):
    _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    try:
        with closing(urllib.request.urlopen(url, timeout=timeout)) as r:
            r.read(1)
    except Exception:
        return False
    return True


def ftp_get(url, temp_file, timeout=10.0):
    _raise_if_offline_mode_is_enabled(f"Tried to reach {url}")
    try:
        logger.info(f"Getting through FTP {url} into {temp_file.name}")
        with closing(urllib.request.urlopen(url, timeout=timeout)) as r:
            shutil.copyfileobj(r, temp_file)
    except urllib.error.URLError as e:
        raise ConnectionError(e) from None