Skip to content

Commit

Permalink
Delete unused _request_size
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvillanova committed Sep 26, 2024
1 parent 95e2135 commit 22de57f
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions services/worker/src/worker/job_runners/config/parquet_and_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
from datasets.utils.file_utils import (
ArchiveIterable,
FilesIterable,
get_authentication_headers_for_url,
http_head,
is_relative_path,
url_or_path_join,
)
Expand Down Expand Up @@ -304,14 +302,6 @@ class EmptyFeaturesError(Exception):
pass


def _request_size(url: str, hf_token: Optional[str] = None) -> Optional[int]:
headers = get_authentication_headers_for_url(url, token=hf_token)
response = http_head(url, headers=headers, max_retries=3)
response.raise_for_status()
size = response.headers.get("Content-Length") if response.ok else None
return int(size) if size is not None else size


def _fsspec_request_size(urlpath: str, storage_options: dict[str, Any]) -> Optional[int]:
with fsspec.open(urlpath, **storage_options) as f:
if hasattr(f, "size") and isinstance(f.size, int):
Expand Down

0 comments on commit 22de57f

Please sign in to comment.