Skip to content
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

Implementation of 'local://' URI Scheme Support #1381

Merged
merged 5 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion fsspec/implementations/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LocalFileSystem(AbstractFileSystem):
"""

root_marker = "/"
protocol = "file"
protocol = "file", "local"
local_file = True

def __init__(self, auto_mkdir=False, **kwargs):
Expand Down Expand Up @@ -215,6 +215,10 @@ def _strip_protocol(cls, path):
path = path[7:]
elif path.startswith("file:"):
path = path[5:]
elif path.startswith("local://"):
path = path[8:]
elif path.startswith("local:"):
path = path[6:]
return make_path_posix(path).rstrip("/") or cls.root_marker

def _isfilestore(self):
Expand Down
2 changes: 1 addition & 1 deletion fsspec/implementations/tests/test_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def test_fss_has_defaults(m):

fs = fsspec.filesystem("reference", fs={"memory": m}, fo={})
assert fs.fss["memory"] is m
assert fs.fss[None].protocol == "file"
assert fs.fss[None].protocol == ("file", "local")

fs = fsspec.filesystem("reference", fs={None: m}, fo={})
assert fs.fss[None] is m
Expand Down
1 change: 1 addition & 0 deletions fsspec/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def register_implementation(name, cls, clobber=False, errtxt=None):
# updated with register_implementation
known_implementations = {
"file": {"class": "fsspec.implementations.local.LocalFileSystem"},
"local": {"class": "fsspec.implementations.local.LocalFileSystem"},
"memory": {"class": "fsspec.implementations.memory.MemoryFileSystem"},
"dropbox": {
"class": "dropboxdrivefs.DropboxDriveFileSystem",
Expand Down