Skip to content

Commit 981c086

Browse files
committed
chore: apply pre-commit (ruff/format) fixes
1 parent a117244 commit 981c086

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

malariagen_data/util.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,14 @@ def _init_filesystem(url, **kwargs):
503503
else:
504504
protocols = set()
505505

506-
is_local = bool(protocols.intersection({"file", "local"})) or fs.__class__.__name__ == "LocalFileSystem"
507-
506+
is_local = (
507+
bool(protocols.intersection({"file", "local"}))
508+
or fs.__class__.__name__ == "LocalFileSystem"
509+
)
510+
508511
if is_local:
509512
from urllib.parse import unquote
513+
510514
path = unquote(path)
511515

512516
# Path compatibility, fsspec/gcsfs behaviour varies between versions.

tests/test_util_filesystem.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import os
2-
import pytest
3-
from pathlib import Path
42
from malariagen_data.util import _init_filesystem
53

4+
65
def test_init_filesystem_decodes_file_uri_escaped_path(tmp_path):
76
dir_with_space = tmp_path / "dir with space's"
87
dir_with_space.mkdir()
98
file_path = dir_with_space / "v3-config.json"
109
file_path.write_text('{"foo": "bar"}')
1110

1211
uri = dir_with_space.as_uri()
13-
12+
1413
fs, path = _init_filesystem(uri)
15-
14+
1615
assert "%20" in uri
1716
assert "%20" not in path
1817
assert "%27" not in path
@@ -27,10 +26,10 @@ def test_init_filesystem_plain_local_path_unchanged(tmp_path):
2726
dir_with_space.mkdir()
2827
file_path = dir_with_space / "v3-config.json"
2928
file_path.write_text('{"foo": "bar"}')
30-
29+
3130
uri = str(dir_with_space)
32-
31+
3332
fs, path = _init_filesystem(uri)
34-
33+
3534
with fs.open(os.path.join(path, "v3-config.json"), "r") as f:
3635
assert f.read() == '{"foo": "bar"}'

0 commit comments

Comments
 (0)