Skip to content

Commit dd0d800

Browse files
authored
Allow kwargs passed to open() with overrides (#1551)
1 parent 1653552 commit dd0d800

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

fsspec/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,8 @@ def open(
456456
- For implementations in separate packages see
457457
https://filesystem-spec.readthedocs.io/en/latest/api.html#other-known-implementations
458458
"""
459+
kw = {"expand": False}
460+
kw.update(kwargs)
459461
out = open_files(
460462
urlpath=[urlpath],
461463
mode=mode,
@@ -464,8 +466,7 @@ def open(
464466
errors=errors,
465467
protocol=protocol,
466468
newline=newline,
467-
expand=False,
468-
**kwargs,
469+
**kw,
469470
)
470471
if not out:
471472
raise FileNotFoundError(urlpath)

fsspec/implementations/local.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ def cp_file(self, path1, path2, **kwargs):
132132
else:
133133
raise FileNotFoundError(path1)
134134

135+
def isfile(self, path):
136+
path = self._strip_protocol(path)
137+
return os.path.isfile(path)
138+
139+
def isdir(self, path):
140+
path = self._strip_protocol(path)
141+
return os.path.isdir(path)
142+
135143
def get_file(self, path1, path2, callback=None, **kwargs):
136144
if isfilelike(path2):
137145
with open(path1, "rb") as f:

0 commit comments

Comments
 (0)