Skip to content

Commit bb4a627

Browse files
committed
Format code
1 parent 6adcdf1 commit bb4a627

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/huggingface_hub/hf_api.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ def repo_type_and_id_from_hf_id(hf_id: str, hub_url: Optional[str] = None) -> tu
244244
is_hf_url = hf_id_no_proto.startswith(hub_url_no_proto) and "@" not in hf_id
245245

246246
if is_hf_url:
247-
hf_id = hf_id_no_proto[len(hub_url_no_proto):].lstrip("/")
247+
hf_id = hf_id_no_proto[len(hub_url_no_proto) :].lstrip("/")
248248

249249
HFFS_PREFIX = "hf://"
250250
if hf_id.startswith(HFFS_PREFIX): # Remove "hf://" prefix if exists
251-
hf_id = hf_id[len(HFFS_PREFIX):]
251+
hf_id = hf_id[len(HFFS_PREFIX) :]
252252

253253
url_segments = [s for s in hf_id.split("/") if s]
254254
seg_len = len(url_segments)
@@ -292,9 +292,7 @@ def repo_type_and_id_from_hf_id(hf_id: str, hub_url: Optional[str] = None) -> tu
292292
namespace = None
293293
repo_type = None
294294
else:
295-
raise ValueError(
296-
f"Unable to retrieve user and repo ID from the passed HF ID: {hf_id}"
297-
)
295+
raise ValueError(f"Unable to retrieve user and repo ID from the passed HF ID: {hf_id}")
298296

299297
# Check if repo type is known (mapping "spaces" => "space" + empty value => `None`)
300298
if repo_type in constants.REPO_TYPES_MAPPING:

tests/test_hf_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2772,7 +2772,7 @@ def test_repo_type_and_id_from_hf_id_on_correct_values(self):
27722772
"hf://id": [None, None, "id"],
27732773
"hf://user/id": [None, "user", "id"],
27742774
"hf://model/user/name": ["model", "user", "name"], # 's' is optional
2775-
"hf://models/user/name": ["model", "user", "name"]
2775+
"hf://models/user/name": ["model", "user", "name"],
27762776
},
27772777
"self-hosted": {
27782778
"http://localhost:8080/hf/user/id": [None, "user", "id"],

0 commit comments

Comments
 (0)