-
-
Notifications
You must be signed in to change notification settings - Fork 350
Add exception for swift in fsspec path handling #3302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3302 +/- ##
=======================================
Coverage 60.68% 60.69%
=======================================
Files 78 78
Lines 9356 9355 -1
=======================================
Hits 5678 5678
+ Misses 3678 3677 -1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR - could you also add a test to make sure this is working as intended? Just constructing a FsspecStore
with a valid swift URL should be good enough.
http(s) and swift filesystems need the scheme in the path. This commit adds a special case for the swift filesystem, when checking for the scheme presence. Also remove one if for the http(s) schemes. Here all schemes can call fs._strip_protocol(path). For the filesystems that need the scheme in the path, this function will not remove it.
0378530
to
e9a9b12
Compare
I tried adding a test, but I don't really know what I'm doing here.
|
I think you could just not do any assignment at all, and it would fix this.
Yes, that's fine.
This is a bit of a pain. In order to avoid us having to test different protocols, could we just get rid of the two blocks of code that read: # fsspec is not consistent about removing the scheme from the path, so check and strip it here
# https://github.com/fsspec/filesystem_spec/issues/1722
if "://" in path and not path.startswith("http"):
# `not path.startswith("http")` is a special case for the http filesystem (¯\_(ツ)_/¯)
path = fs._strip_protocol(path) and instead rely on I've tried removing them from my local copy of zarr and running the tests, and they all seem to pass. I don't know if @jhamman has anything to add as the author of these blocks of code - is there a reason we shouldn't remove them and depend on fsspec to error on invalid paths? |
@dstansby sounds good to me. However, I think in the case of On the other hand the error checking, e.g. generate an exception when there is a protocol in the path and the file system doesn't want it, seems fine to leave for the individual file systems. |
Proposed as fix for #3201.
http(s) and swift filesystems need the scheme in the path. This commit adds a special case for the swift filesystem, when checking for the scheme presence and generating an exception if the scheme is present.
Also remove one if for the http(s) schemes. Here all schemes can call fs._strip_protocol(path). For the filesystems that need the scheme in the path, this function will not remove it.
TODO:
docs/user-guide/*.rst
changes/