Skip to content

Commit 28866c5

Browse files
committed
style
1 parent e4046d4 commit 28866c5

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

src/datasets/features/audio.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,10 @@ def embed_storage(self, storage: pa.StructArray, token_per_repo_id=None) -> pa.S
259259
def path_to_bytes(path):
260260
source_url = path.split("::")[-1]
261261
pattern = (
262-
config.HUB_DATASETS_URL
263-
if source_url.startswith(config.HF_ENDPOINT)
264-
else config.HUB_DATASETS_HFFS_URL
262+
config.HUB_DATASETS_URL if source_url.startswith(config.HF_ENDPOINT) else config.HUB_DATASETS_HFFS_URL
265263
)
266264
source_url_fields = string_to_dict(source_url, pattern)
267-
token = (
268-
token_per_repo_id.get(source_url_fields["repo_id"]) if source_url_fields is not None else None
269-
)
265+
token = token_per_repo_id.get(source_url_fields["repo_id"]) if source_url_fields is not None else None
270266
download_config = DownloadConfig(token=token)
271267
with xopen(path, "rb", download_config=download_config) as f:
272268
return f.read()

src/datasets/features/image.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,10 @@ def embed_storage(self, storage: pa.StructArray, token_per_repo_id=None) -> pa.S
268268
def path_to_bytes(path):
269269
source_url = path.split("::")[-1]
270270
pattern = (
271-
config.HUB_DATASETS_URL
272-
if source_url.startswith(config.HF_ENDPOINT)
273-
else config.HUB_DATASETS_HFFS_URL
271+
config.HUB_DATASETS_URL if source_url.startswith(config.HF_ENDPOINT) else config.HUB_DATASETS_HFFS_URL
274272
)
275273
source_url_fields = string_to_dict(source_url, pattern)
276-
token = (
277-
token_per_repo_id.get(source_url_fields["repo_id"]) if source_url_fields is not None else None
278-
)
274+
token = token_per_repo_id.get(source_url_fields["repo_id"]) if source_url_fields is not None else None
279275
download_config = DownloadConfig(token=token)
280276
with xopen(path, "rb", download_config=download_config) as f:
281277
return f.read()

src/datasets/features/pdf.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,10 @@ def embed_storage(self, storage: pa.StructArray, token_per_repo_id=None) -> pa.S
234234
def path_to_bytes(path):
235235
source_url = path.split("::")[-1]
236236
pattern = (
237-
config.HUB_DATASETS_URL
238-
if source_url.startswith(config.HF_ENDPOINT)
239-
else config.HUB_DATASETS_HFFS_URL
237+
config.HUB_DATASETS_URL if source_url.startswith(config.HF_ENDPOINT) else config.HUB_DATASETS_HFFS_URL
240238
)
241239
source_url_fields = string_to_dict(source_url, pattern)
242-
token = (
243-
token_per_repo_id.get(source_url_fields["repo_id"]) if source_url_fields is not None else None
244-
)
240+
token = token_per_repo_id.get(source_url_fields["repo_id"]) if source_url_fields is not None else None
245241
download_config = DownloadConfig(token=token)
246242
with xopen(path, "rb", download_config=download_config) as f:
247243
return f.read()

0 commit comments

Comments
 (0)