Skip to content

Commit 5549f65

Browse files
Merge pull request #222 from jrbourbeau/update_auto_mkdir
Deprecate auto_mkdir default value
2 parents a9f70dd + ce24b80 commit 5549f65

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

fsspec/implementations/local.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import posixpath
55
import re
66
import tempfile
7+
import warnings
78
from fsspec import AbstractFileSystem
89
from fsspec.utils import stringify_path
910

@@ -21,8 +22,16 @@ class LocalFileSystem(AbstractFileSystem):
2122

2223
root_marker = "/"
2324

24-
def __init__(self, auto_mkdir=True, **kwargs):
25+
def __init__(self, auto_mkdir=None, **kwargs):
2526
super().__init__(**kwargs)
27+
if auto_mkdir is None:
28+
warnings.warn(
29+
"The default value of auto_mkdir=True has been deprecated "
30+
"and will be changed to auto_mkdir=False by default in a "
31+
"future release.",
32+
FutureWarning,
33+
)
34+
auto_mkdir = True
2635
self.auto_mkdir = auto_mkdir
2736

2837
def mkdir(self, path, create_parents=True, **kwargs):

fsspec/implementations/tests/test_local.py

+7
Original file line numberDiff line numberDiff line change
@@ -432,3 +432,10 @@ def test_links(tmpdir):
432432
def test_isfilestore():
433433
fs = LocalFileSystem(auto_mkdir=False)
434434
assert fs._isfilestore()
435+
436+
437+
def test_auto_mkdir_warns():
438+
# Ensure we're not pulling from instance cache
439+
LocalFileSystem.clear_instance_cache()
440+
with pytest.warns(FutureWarning, match="auto_mkdir=True has been deprecated"):
441+
LocalFileSystem()

0 commit comments

Comments
 (0)