Skip to content

Commit

Permalink
Preserve parameters in paths (#65)
Browse files Browse the repository at this point in the history
* Preserve parameters in paths

Fixes #64

* Add test

* No glob

* Add py3.12
  • Loading branch information
nsmith- authored Sep 3, 2024
1 parent 784540c commit 6e36c03
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/fsspec_xrootd/xrootd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
11 changes: 10 additions & 1 deletion tests/test_basicio.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,16 @@ def test_path_parsing():
"root://serv.er//dir/",
]
)
assert paths == ["/blah", "/more", "dir", "/dir"]
assert paths == [
"/blah",
"/more",
"dir",
"/dir",
]
# 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&param2=2")
assert path == "/blah?param1=1&param2=2"


def test_pickle(localserver, clear_server):
Expand Down

0 comments on commit 6e36c03

Please sign in to comment.