Skip to content

Commit

Permalink
Allow kwargs passed to open() with overrides (fsspec#1551)
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant authored Mar 18, 2024
1 parent 1653552 commit dd0d800
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fsspec/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ def open(
- For implementations in separate packages see
https://filesystem-spec.readthedocs.io/en/latest/api.html#other-known-implementations
"""
kw = {"expand": False}
kw.update(kwargs)
out = open_files(
urlpath=[urlpath],
mode=mode,
Expand All @@ -464,8 +466,7 @@ def open(
errors=errors,
protocol=protocol,
newline=newline,
expand=False,
**kwargs,
**kw,
)
if not out:
raise FileNotFoundError(urlpath)
Expand Down
8 changes: 8 additions & 0 deletions fsspec/implementations/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ def cp_file(self, path1, path2, **kwargs):
else:
raise FileNotFoundError(path1)

def isfile(self, path):
path = self._strip_protocol(path)
return os.path.isfile(path)

def isdir(self, path):
path = self._strip_protocol(path)
return os.path.isdir(path)

def get_file(self, path1, path2, callback=None, **kwargs):
if isfilelike(path2):
with open(path1, "rb") as f:
Expand Down

0 comments on commit dd0d800

Please sign in to comment.