fsspec 2024.6.0__tar.gz → 2024.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fsspec-2024.6.0 → fsspec-2024.6.1}/PKG-INFO +1 -2
- {fsspec-2024.6.0 → fsspec-2024.6.1}/README.md +0 -1
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/changelog.rst +14 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/_version.py +2 -2
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/generic.py +3 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/cached.py +5 -3
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/dirfs.py +2 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/http.py +2 -1
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/reference.py +7 -4
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/json.py +42 -2
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/spec.py +50 -6
- {fsspec-2024.6.0 → fsspec-2024.6.1}/.codespellrc +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/.coveragerc +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/.gitattributes +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/.github/workflows/codespell.yml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/.github/workflows/main.yaml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/.github/workflows/pypipublish.yaml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/.gitignore +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/.pre-commit-config.yaml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/LICENSE +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/ci/environment-downstream.yml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/ci/environment-friends.yml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/ci/environment-py38.yml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/ci/environment-typecheck.yml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/ci/environment-win.yml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/Makefile +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/README.md +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/environment.yml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/make.bat +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/_static/custom.css +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/api.rst +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/async.rst +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/conf.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/copying.rst +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/developer.rst +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/features.rst +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/img/gui.png +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/index.rst +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/intro.rst +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/docs/source/usage.rst +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/__init__.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/archive.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/asyn.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/caching.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/callbacks.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/compression.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/config.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/conftest.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/core.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/dircache.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/exceptions.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/fuse.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/gui.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/__init__.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/arrow.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/cache_mapper.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/cache_metadata.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/dask.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/data.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/dbfs.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/ftp.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/git.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/github.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/jupyter.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/libarchive.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/local.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/memory.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/sftp.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/smb.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/tar.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/webhdfs.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/implementations/zip.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/mapping.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/parquet.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/registry.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/tests/abstract/__init__.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/tests/abstract/common.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/tests/abstract/copy.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/tests/abstract/get.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/tests/abstract/mv.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/tests/abstract/put.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/transaction.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/fsspec/utils.py +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/install_s3fs.sh +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/pyproject.toml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/readthedocs.yml +0 -0
- {fsspec-2024.6.0 → fsspec-2024.6.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: fsspec
|
|
3
|
-
Version: 2024.6.
|
|
3
|
+
Version: 2024.6.1
|
|
4
4
|
Summary: File-system specification
|
|
5
5
|
Project-URL: Changelog, https://filesystem-spec.readthedocs.io/en/latest/changelog.html
|
|
6
6
|
Project-URL: Documentation, https://filesystem-spec.readthedocs.io/en/latest/
|
|
@@ -184,7 +184,6 @@ Description-Content-Type: text/markdown
|
|
|
184
184
|
[](https://anaconda.org/conda-forge/fsspec)
|
|
185
185
|

|
|
186
186
|
[](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest)
|
|
187
|
-
[](https://piptrends.com/package/fsspec)
|
|
188
187
|
|
|
189
188
|
A specification for pythonic filesystems.
|
|
190
189
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
[](https://anaconda.org/conda-forge/fsspec)
|
|
5
5
|

|
|
6
6
|
[](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest)
|
|
7
|
-
[](https://piptrends.com/package/fsspec)
|
|
8
7
|
|
|
9
8
|
A specification for pythonic filesystems.
|
|
10
9
|
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
2024.6.1
|
|
5
|
+
--------
|
|
6
|
+
|
|
7
|
+
Fixes
|
|
8
|
+
|
|
9
|
+
- fix appending to non-dict reference sets (#1634)
|
|
10
|
+
- don't let generic edit info dicts (#1633)
|
|
11
|
+
- set https's loop before calling super (#1633)
|
|
12
|
+
- cached write file doesn't need to update it's size on close (#1633)
|
|
13
|
+
- fix JSON serialize for FSs with interior FSs (#1628, 1627)
|
|
14
|
+
- option to strip "password" when pickling (#1625)
|
|
15
|
+
- fix filecache write (#1622)
|
|
16
|
+
|
|
17
|
+
|
|
4
18
|
2024.6.0
|
|
5
19
|
--------
|
|
6
20
|
|
|
@@ -12,5 +12,5 @@ __version__: str
|
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
|
13
13
|
version_tuple: VERSION_TUPLE
|
|
14
14
|
|
|
15
|
-
__version__ = version = '2024.6.
|
|
16
|
-
__version_tuple__ = version_tuple = (2024, 6,
|
|
15
|
+
__version__ = version = '2024.6.1'
|
|
16
|
+
__version_tuple__ = version_tuple = (2024, 6, 1)
|
|
@@ -197,6 +197,7 @@ class GenericFileSystem(AsyncFileSystem):
|
|
|
197
197
|
)
|
|
198
198
|
result = {}
|
|
199
199
|
for k, v in out.items():
|
|
200
|
+
v = v.copy() # don't corrupt target FS dircache
|
|
200
201
|
name = fs.unstrip_protocol(k)
|
|
201
202
|
v["name"] = name
|
|
202
203
|
result[name] = v
|
|
@@ -210,6 +211,7 @@ class GenericFileSystem(AsyncFileSystem):
|
|
|
210
211
|
out = await fs._info(url, **kwargs)
|
|
211
212
|
else:
|
|
212
213
|
out = fs.info(url, **kwargs)
|
|
214
|
+
out = out.copy() # don't edit originals
|
|
213
215
|
out["name"] = fs.unstrip_protocol(out["name"])
|
|
214
216
|
return out
|
|
215
217
|
|
|
@@ -224,6 +226,7 @@ class GenericFileSystem(AsyncFileSystem):
|
|
|
224
226
|
out = await fs._ls(url, detail=True, **kwargs)
|
|
225
227
|
else:
|
|
226
228
|
out = fs.ls(url, detail=True, **kwargs)
|
|
229
|
+
out = [o.copy() for o in out] # don't edit originals
|
|
227
230
|
for o in out:
|
|
228
231
|
o["name"] = fs.unstrip_protocol(o["name"])
|
|
229
232
|
if detail:
|
|
@@ -651,7 +651,8 @@ class WholeFileCacheFileSystem(CachingFileSystem):
|
|
|
651
651
|
def _open(self, path, mode="rb", **kwargs):
|
|
652
652
|
path = self._strip_protocol(path)
|
|
653
653
|
if "r" not in mode:
|
|
654
|
-
|
|
654
|
+
hash = self._mapper(path)
|
|
655
|
+
fn = os.path.join(self.storage[-1], hash)
|
|
655
656
|
user_specified_kwargs = {
|
|
656
657
|
k: v
|
|
657
658
|
for k, v in kwargs.items()
|
|
@@ -794,7 +795,8 @@ class SimpleCacheFileSystem(WholeFileCacheFileSystem):
|
|
|
794
795
|
if self._intrans:
|
|
795
796
|
f = [_ for _ in self.transaction.files if _.path == path]
|
|
796
797
|
if f:
|
|
797
|
-
|
|
798
|
+
size = os.path.getsize(f[0].fn) if f[0].closed else f[0].tell()
|
|
799
|
+
return {"name": path, "size": size, "type": "file"}
|
|
798
800
|
f = any(_.path.startswith(path + "/") for _ in self.transaction.files)
|
|
799
801
|
if f:
|
|
800
802
|
return {"name": path, "size": 0, "type": "directory"}
|
|
@@ -900,7 +902,7 @@ class LocalTempFile:
|
|
|
900
902
|
self.close()
|
|
901
903
|
|
|
902
904
|
def close(self):
|
|
903
|
-
self.size = self.fh.tell()
|
|
905
|
+
# self.size = self.fh.tell()
|
|
904
906
|
if self.closed:
|
|
905
907
|
return
|
|
906
908
|
self.fh.close()
|
|
@@ -56,6 +56,8 @@ class DirFileSystem(AsyncFileSystem):
|
|
|
56
56
|
if not path:
|
|
57
57
|
return self.path
|
|
58
58
|
return self.fs.sep.join((self.path, self._strip_protocol(path)))
|
|
59
|
+
if isinstance(path, dict):
|
|
60
|
+
return {self._join(_path): value for _path, value in path.items()}
|
|
59
61
|
return [self._join(_path) for _path in path]
|
|
60
62
|
|
|
61
63
|
def _relpath(self, path):
|
|
@@ -560,6 +560,7 @@ class HTTPFile(AbstractBufferedFile):
|
|
|
560
560
|
if mode != "rb":
|
|
561
561
|
raise NotImplementedError("File mode not supported")
|
|
562
562
|
self.asynchronous = asynchronous
|
|
563
|
+
self.loop = loop
|
|
563
564
|
self.url = url
|
|
564
565
|
self.session = session
|
|
565
566
|
self.details = {"name": url, "size": size, "type": "file"}
|
|
@@ -572,7 +573,6 @@ class HTTPFile(AbstractBufferedFile):
|
|
|
572
573
|
cache_options=cache_options,
|
|
573
574
|
**kwargs,
|
|
574
575
|
)
|
|
575
|
-
self.loop = loop
|
|
576
576
|
|
|
577
577
|
def read(self, length=-1):
|
|
578
578
|
"""Read bytes from file
|
|
@@ -736,6 +736,7 @@ class HTTPStreamFile(AbstractBufferedFile):
|
|
|
736
736
|
return r
|
|
737
737
|
|
|
738
738
|
self.r = sync(self.loop, cor)
|
|
739
|
+
self.loop = fs.loop
|
|
739
740
|
|
|
740
741
|
def seek(self, loc, whence=0):
|
|
741
742
|
if loc == 0 and whence == 1:
|
|
@@ -935,10 +935,13 @@ class ReferenceFileSystem(AsyncFileSystem):
|
|
|
935
935
|
|
|
936
936
|
def _process_references0(self, references):
|
|
937
937
|
"""Make reference dict for Spec Version 0"""
|
|
938
|
-
references
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
938
|
+
if isinstance(references, dict):
|
|
939
|
+
# do not do this for lazy/parquet backend, which will not make dicts,
|
|
940
|
+
# but must remain writable in the original object
|
|
941
|
+
references = {
|
|
942
|
+
key: json.dumps(val) if isinstance(val, dict) else val
|
|
943
|
+
for key, val in references.items()
|
|
944
|
+
}
|
|
942
945
|
self.references = references
|
|
943
946
|
|
|
944
947
|
def _process_references1(self, references, template_overrides=None):
|
|
@@ -1,22 +1,49 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from contextlib import suppress
|
|
3
3
|
from pathlib import PurePath
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import (
|
|
5
|
+
Any,
|
|
6
|
+
Callable,
|
|
7
|
+
ClassVar,
|
|
8
|
+
Dict,
|
|
9
|
+
List,
|
|
10
|
+
Mapping,
|
|
11
|
+
Optional,
|
|
12
|
+
Sequence,
|
|
13
|
+
Tuple,
|
|
14
|
+
)
|
|
5
15
|
|
|
6
16
|
from .registry import _import_class, get_filesystem_class
|
|
7
17
|
from .spec import AbstractFileSystem
|
|
8
18
|
|
|
9
19
|
|
|
10
20
|
class FilesystemJSONEncoder(json.JSONEncoder):
|
|
21
|
+
include_password: ClassVar[bool] = True
|
|
22
|
+
|
|
11
23
|
def default(self, o: Any) -> Any:
|
|
12
24
|
if isinstance(o, AbstractFileSystem):
|
|
13
|
-
return o.to_dict()
|
|
25
|
+
return o.to_dict(include_password=self.include_password)
|
|
14
26
|
if isinstance(o, PurePath):
|
|
15
27
|
cls = type(o)
|
|
16
28
|
return {"cls": f"{cls.__module__}.{cls.__name__}", "str": str(o)}
|
|
17
29
|
|
|
18
30
|
return super().default(o)
|
|
19
31
|
|
|
32
|
+
def make_serializable(self, obj: Any) -> Any:
|
|
33
|
+
"""
|
|
34
|
+
Recursively converts an object so that it can be JSON serialized via
|
|
35
|
+
:func:`json.dumps` and :func:`json.dump`, without actually calling
|
|
36
|
+
said functions.
|
|
37
|
+
"""
|
|
38
|
+
if isinstance(obj, (str, int, float, bool)):
|
|
39
|
+
return obj
|
|
40
|
+
if isinstance(obj, Mapping):
|
|
41
|
+
return {k: self.make_serializable(v) for k, v in obj.items()}
|
|
42
|
+
if isinstance(obj, Sequence):
|
|
43
|
+
return [self.make_serializable(v) for v in obj]
|
|
44
|
+
|
|
45
|
+
return self.default(obj)
|
|
46
|
+
|
|
20
47
|
|
|
21
48
|
class FilesystemJSONDecoder(json.JSONDecoder):
|
|
22
49
|
def __init__(
|
|
@@ -79,3 +106,16 @@ class FilesystemJSONDecoder(json.JSONDecoder):
|
|
|
79
106
|
return self.original_object_hook(dct)
|
|
80
107
|
|
|
81
108
|
return dct
|
|
109
|
+
|
|
110
|
+
def unmake_serializable(self, obj: Any) -> Any:
|
|
111
|
+
"""
|
|
112
|
+
Inverse function of :meth:`FilesystemJSONEncoder.make_serializable`.
|
|
113
|
+
"""
|
|
114
|
+
if isinstance(obj, dict):
|
|
115
|
+
obj = self.custom_object_hook(obj)
|
|
116
|
+
if isinstance(obj, dict):
|
|
117
|
+
return {k: self.unmake_serializable(v) for k, v in obj.items()}
|
|
118
|
+
if isinstance(obj, (list, tuple)):
|
|
119
|
+
return [self.unmake_serializable(v) for v in obj]
|
|
120
|
+
|
|
121
|
+
return obj
|
|
@@ -1386,20 +1386,38 @@ class AbstractFileSystem(metaclass=_Cached):
|
|
|
1386
1386
|
length = size - offset
|
|
1387
1387
|
return read_block(f, offset, length, delimiter)
|
|
1388
1388
|
|
|
1389
|
-
def to_json(self) -> str:
|
|
1389
|
+
def to_json(self, *, include_password: bool = True) -> str:
|
|
1390
1390
|
"""
|
|
1391
1391
|
JSON representation of this filesystem instance.
|
|
1392
1392
|
|
|
1393
|
+
Parameters
|
|
1394
|
+
----------
|
|
1395
|
+
include_password: bool, default True
|
|
1396
|
+
Whether to include the password (if any) in the output.
|
|
1397
|
+
|
|
1393
1398
|
Returns
|
|
1394
1399
|
-------
|
|
1395
1400
|
JSON string with keys ``cls`` (the python location of this class),
|
|
1396
1401
|
protocol (text name of this class's protocol, first one in case of
|
|
1397
1402
|
multiple), ``args`` (positional args, usually empty), and all other
|
|
1398
1403
|
keyword arguments as their own keys.
|
|
1404
|
+
|
|
1405
|
+
Warnings
|
|
1406
|
+
--------
|
|
1407
|
+
Serialized filesystems may contain sensitive information which have been
|
|
1408
|
+
passed to the constructor, such as passwords and tokens. Make sure you
|
|
1409
|
+
store and send them in a secure environment!
|
|
1399
1410
|
"""
|
|
1400
1411
|
from .json import FilesystemJSONEncoder
|
|
1401
1412
|
|
|
1402
|
-
return json.dumps(
|
|
1413
|
+
return json.dumps(
|
|
1414
|
+
self,
|
|
1415
|
+
cls=type(
|
|
1416
|
+
"_FilesystemJSONEncoder",
|
|
1417
|
+
(FilesystemJSONEncoder,),
|
|
1418
|
+
{"include_password": include_password},
|
|
1419
|
+
),
|
|
1420
|
+
)
|
|
1403
1421
|
|
|
1404
1422
|
@staticmethod
|
|
1405
1423
|
def from_json(blob: str) -> AbstractFileSystem:
|
|
@@ -1426,25 +1444,44 @@ class AbstractFileSystem(metaclass=_Cached):
|
|
|
1426
1444
|
|
|
1427
1445
|
return json.loads(blob, cls=FilesystemJSONDecoder)
|
|
1428
1446
|
|
|
1429
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
1447
|
+
def to_dict(self, *, include_password: bool = True) -> Dict[str, Any]:
|
|
1430
1448
|
"""
|
|
1431
1449
|
JSON-serializable dictionary representation of this filesystem instance.
|
|
1432
1450
|
|
|
1451
|
+
Parameters
|
|
1452
|
+
----------
|
|
1453
|
+
include_password: bool, default True
|
|
1454
|
+
Whether to include the password (if any) in the output.
|
|
1455
|
+
|
|
1433
1456
|
Returns
|
|
1434
1457
|
-------
|
|
1435
1458
|
Dictionary with keys ``cls`` (the python location of this class),
|
|
1436
1459
|
protocol (text name of this class's protocol, first one in case of
|
|
1437
1460
|
multiple), ``args`` (positional args, usually empty), and all other
|
|
1438
1461
|
keyword arguments as their own keys.
|
|
1462
|
+
|
|
1463
|
+
Warnings
|
|
1464
|
+
--------
|
|
1465
|
+
Serialized filesystems may contain sensitive information which have been
|
|
1466
|
+
passed to the constructor, such as passwords and tokens. Make sure you
|
|
1467
|
+
store and send them in a secure environment!
|
|
1439
1468
|
"""
|
|
1469
|
+
from .json import FilesystemJSONEncoder
|
|
1470
|
+
|
|
1471
|
+
json_encoder = FilesystemJSONEncoder()
|
|
1472
|
+
|
|
1440
1473
|
cls = type(self)
|
|
1441
1474
|
proto = self.protocol
|
|
1442
1475
|
|
|
1476
|
+
storage_options = dict(self.storage_options)
|
|
1477
|
+
if not include_password:
|
|
1478
|
+
storage_options.pop("password", None)
|
|
1479
|
+
|
|
1443
1480
|
return dict(
|
|
1444
1481
|
cls=f"{cls.__module__}:{cls.__name__}",
|
|
1445
1482
|
protocol=proto[0] if isinstance(proto, (tuple, list)) else proto,
|
|
1446
|
-
args=self.storage_args,
|
|
1447
|
-
**
|
|
1483
|
+
args=json_encoder.make_serializable(self.storage_args),
|
|
1484
|
+
**json_encoder.make_serializable(storage_options),
|
|
1448
1485
|
)
|
|
1449
1486
|
|
|
1450
1487
|
@staticmethod
|
|
@@ -1470,6 +1507,10 @@ class AbstractFileSystem(metaclass=_Cached):
|
|
|
1470
1507
|
"""
|
|
1471
1508
|
from .json import FilesystemJSONDecoder
|
|
1472
1509
|
|
|
1510
|
+
json_decoder = FilesystemJSONDecoder()
|
|
1511
|
+
|
|
1512
|
+
dct = dict(dct) # Defensive copy
|
|
1513
|
+
|
|
1473
1514
|
cls = FilesystemJSONDecoder.try_resolve_fs_cls(dct)
|
|
1474
1515
|
if cls is None:
|
|
1475
1516
|
raise ValueError("Not a serialized AbstractFileSystem")
|
|
@@ -1477,7 +1518,10 @@ class AbstractFileSystem(metaclass=_Cached):
|
|
|
1477
1518
|
dct.pop("cls", None)
|
|
1478
1519
|
dct.pop("protocol", None)
|
|
1479
1520
|
|
|
1480
|
-
return cls(
|
|
1521
|
+
return cls(
|
|
1522
|
+
*json_decoder.unmake_serializable(dct.pop("args", ())),
|
|
1523
|
+
**json_decoder.unmake_serializable(dct),
|
|
1524
|
+
)
|
|
1481
1525
|
|
|
1482
1526
|
def _get_pyarrow_filesystem(self):
|
|
1483
1527
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|