Skip to content

Commit 6e36c03

Browse files
authored
Preserve parameters in paths (#65)
* Preserve parameters in paths Fixes #64 * Add test * No glob * Add py3.12
1 parent 784540c commit 6e36c03

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
strategy:
4040
fail-fast: false
4141
matrix:
42-
python-version: ["3.8", "3.9", "3.10", "3.11"]
42+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
4343
runs-on: [ubuntu-latest]
4444
defaults:
4545
run:

src/fsspec_xrootd/xrootd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ErrorCodes(IntEnum):
3535

3636

3737
def _async_wrap(
38-
func: Callable[..., XRootDStatus | tuple[XRootDStatus, T]]
38+
func: Callable[..., XRootDStatus | tuple[XRootDStatus, T]],
3939
) -> Callable[..., Coroutine[Any, Any, tuple[XRootDStatus, T]]]:
4040
"""Wraps pyxrootd functions to run asynchronously. Returns an async callable
4141
@@ -302,7 +302,7 @@ def _get_kwargs_from_urls(u: str) -> dict[Any, Any]:
302302
def _strip_protocol(cls, path: str | list[str]) -> Any:
303303
if isinstance(path, str):
304304
if path.startswith(cls.protocol):
305-
return client.URL(path).path.rstrip("/") or cls.root_marker
305+
return client.URL(path).path_with_params.rstrip("/") or cls.root_marker
306306
# assume already stripped
307307
return path.rstrip("/") or cls.root_marker
308308
elif isinstance(path, list):

tests/test_basicio.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,16 @@ def test_path_parsing():
110110
"root://serv.er//dir/",
111111
]
112112
)
113-
assert paths == ["/blah", "/more", "dir", "/dir"]
113+
assert paths == [
114+
"/blah",
115+
"/more",
116+
"dir",
117+
"/dir",
118+
]
119+
# get_fs_token_paths will expand glob patterns if '*', '?', or '[' are present
120+
# so we need to test parameter parsing using a different method
121+
fs, path = fsspec.url_to_fs("root://server.com//blah?param1=1&param2=2")
122+
assert path == "/blah?param1=1&param2=2"
114123

115124

116125
def test_pickle(localserver, clear_server):

0 commit comments

Comments
 (0)