From 4328b9131a9d1f43de4a0093cff98789675ea1d8 Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Mon, 5 Aug 2024 21:47:33 -0500 Subject: [PATCH 1/4] Preserve parameters in paths Fixes #64 --- src/fsspec_xrootd/xrootd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsspec_xrootd/xrootd.py b/src/fsspec_xrootd/xrootd.py index 4090d3f..c578e68 100644 --- a/src/fsspec_xrootd/xrootd.py +++ b/src/fsspec_xrootd/xrootd.py @@ -35,7 +35,7 @@ class ErrorCodes(IntEnum): def _async_wrap( - func: Callable[..., XRootDStatus | tuple[XRootDStatus, T]] + func: Callable[..., XRootDStatus | tuple[XRootDStatus, T]], ) -> Callable[..., Coroutine[Any, Any, tuple[XRootDStatus, T]]]: """Wraps pyxrootd functions to run asynchronously. Returns an async callable @@ -302,7 +302,7 @@ def _get_kwargs_from_urls(u: str) -> dict[Any, Any]: def _strip_protocol(cls, path: str | list[str]) -> Any: if isinstance(path, str): if path.startswith(cls.protocol): - return client.URL(path).path.rstrip("/") or cls.root_marker + return client.URL(path).path_with_params.rstrip("/") or cls.root_marker # assume already stripped return path.rstrip("/") or cls.root_marker elif isinstance(path, list): From 0142e555cfe70e8a1fbcebbaff7b04cc1ad44255 Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Tue, 3 Sep 2024 16:49:50 -0500 Subject: [PATCH 2/4] Add test --- tests/test_basicio.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_basicio.py b/tests/test_basicio.py index d257575..f60e229 100644 --- a/tests/test_basicio.py +++ b/tests/test_basicio.py @@ -108,9 +108,18 @@ def test_path_parsing(): "root://server.com//more", "root://server.com/dir/", "root://serv.er//dir/", + "root://serv.er//dir?param=foo", + "root://serv.er//dir/?param=foo", ] ) - assert paths == ["/blah", "/more", "dir", "/dir"] + assert paths == [ + "/blah", + "/more", + "dir", + "/dir", + "/dir?param=foo", + "/dir/?param=foo", + ] def test_pickle(localserver, clear_server): From 1bb09a250a10fed70dcc9228f102f5e4160fe8a5 Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Tue, 3 Sep 2024 17:31:50 -0500 Subject: [PATCH 3/4] No glob --- tests/test_basicio.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_basicio.py b/tests/test_basicio.py index f60e229..db8dec8 100644 --- a/tests/test_basicio.py +++ b/tests/test_basicio.py @@ -108,8 +108,6 @@ def test_path_parsing(): "root://server.com//more", "root://server.com/dir/", "root://serv.er//dir/", - "root://serv.er//dir?param=foo", - "root://serv.er//dir/?param=foo", ] ) assert paths == [ @@ -117,9 +115,11 @@ def test_path_parsing(): "/more", "dir", "/dir", - "/dir?param=foo", - "/dir/?param=foo", ] + # get_fs_token_paths will expand glob patterns if '*', '?', or '[' are present + # so we need to test parameter parsing using a different method + fs, path = fsspec.url_to_fs("root://server.com//blah?param1=1¶m2=2") + assert path == "/blah?param1=1¶m2=2" def test_pickle(localserver, clear_server): From b61eb8d1eaa90d688f647c91436b74a4bbdb879d Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Tue, 3 Sep 2024 17:32:28 -0500 Subject: [PATCH 4/4] Add py3.12 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffe273f..a2da66f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] runs-on: [ubuntu-latest] defaults: run: