Skip to content

Commit

Permalink
Implementation of 'local://' URI Scheme Support (#1381)
Browse files Browse the repository at this point in the history
  • Loading branch information
glesperance authored Oct 4, 2023
1 parent 79e62d3 commit 7036b5a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
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

0 comments on commit 7036b5a

Please sign in to comment.