fsspec 2024.5.0__py3-none-any.whl → 2024.6.1__py3-none-any.whl
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/_version.py +2 -2
- fsspec/caching.py +3 -2
- fsspec/compression.py +1 -1
- fsspec/generic.py +3 -0
- fsspec/implementations/cached.py +6 -16
- fsspec/implementations/dirfs.py +2 -0
- fsspec/implementations/github.py +12 -0
- fsspec/implementations/http.py +2 -1
- fsspec/implementations/reference.py +9 -0
- fsspec/implementations/smb.py +10 -0
- fsspec/json.py +121 -0
- fsspec/registry.py +24 -18
- fsspec/spec.py +119 -33
- fsspec/utils.py +1 -1
- {fsspec-2024.5.0.dist-info → fsspec-2024.6.1.dist-info}/METADATA +10 -5
- fsspec-2024.6.1.dist-info/RECORD +55 -0
- {fsspec-2024.5.0.dist-info → fsspec-2024.6.1.dist-info}/WHEEL +1 -1
- fsspec/implementations/tests/__init__.py +0 -0
- fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_file_listing.yaml +0 -112
- fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_mkdir.yaml +0 -582
- fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_pyarrow_non_partitioned.yaml +0 -873
- fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_range.yaml +0 -458
- fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_range_chunked.yaml +0 -1355
- fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_write_and_read.yaml +0 -795
- fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_write_pyarrow_non_partitioned.yaml +0 -613
- fsspec/implementations/tests/conftest.py +0 -39
- fsspec/implementations/tests/local/__init__.py +0 -0
- fsspec/implementations/tests/local/local_fixtures.py +0 -18
- fsspec/implementations/tests/local/local_test.py +0 -14
- fsspec/implementations/tests/memory/__init__.py +0 -0
- fsspec/implementations/tests/memory/memory_fixtures.py +0 -27
- fsspec/implementations/tests/memory/memory_test.py +0 -14
- fsspec/implementations/tests/out.zip +0 -0
- fsspec/implementations/tests/test_archive.py +0 -382
- fsspec/implementations/tests/test_arrow.py +0 -259
- fsspec/implementations/tests/test_cached.py +0 -1306
- fsspec/implementations/tests/test_common.py +0 -35
- fsspec/implementations/tests/test_dask.py +0 -29
- fsspec/implementations/tests/test_data.py +0 -20
- fsspec/implementations/tests/test_dbfs.py +0 -268
- fsspec/implementations/tests/test_dirfs.py +0 -588
- fsspec/implementations/tests/test_ftp.py +0 -178
- fsspec/implementations/tests/test_git.py +0 -76
- fsspec/implementations/tests/test_http.py +0 -577
- fsspec/implementations/tests/test_jupyter.py +0 -57
- fsspec/implementations/tests/test_libarchive.py +0 -33
- fsspec/implementations/tests/test_local.py +0 -1285
- fsspec/implementations/tests/test_memory.py +0 -382
- fsspec/implementations/tests/test_reference.py +0 -720
- fsspec/implementations/tests/test_sftp.py +0 -233
- fsspec/implementations/tests/test_smb.py +0 -139
- fsspec/implementations/tests/test_tar.py +0 -243
- fsspec/implementations/tests/test_webhdfs.py +0 -197
- fsspec/implementations/tests/test_zip.py +0 -134
- fsspec/tests/__init__.py +0 -0
- fsspec/tests/conftest.py +0 -188
- fsspec/tests/data/listing.html +0 -1
- fsspec/tests/test_api.py +0 -498
- fsspec/tests/test_async.py +0 -230
- fsspec/tests/test_caches.py +0 -255
- fsspec/tests/test_callbacks.py +0 -89
- fsspec/tests/test_compression.py +0 -164
- fsspec/tests/test_config.py +0 -129
- fsspec/tests/test_core.py +0 -466
- fsspec/tests/test_downstream.py +0 -40
- fsspec/tests/test_file.py +0 -200
- fsspec/tests/test_fuse.py +0 -147
- fsspec/tests/test_generic.py +0 -90
- fsspec/tests/test_gui.py +0 -23
- fsspec/tests/test_mapping.py +0 -228
- fsspec/tests/test_parquet.py +0 -140
- fsspec/tests/test_registry.py +0 -134
- fsspec/tests/test_spec.py +0 -1167
- fsspec/tests/test_utils.py +0 -478
- fsspec-2024.5.0.dist-info/RECORD +0 -111
- {fsspec-2024.5.0.dist-info → fsspec-2024.6.1.dist-info}/licenses/LICENSE +0 -0
fsspec/tests/test_registry.py
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from importlib.metadata import EntryPoint
|
|
3
|
-
from unittest.mock import create_autospec, patch
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
import fsspec
|
|
8
|
-
from fsspec.implementations.zip import ZipFileSystem
|
|
9
|
-
from fsspec.registry import (
|
|
10
|
-
_registry,
|
|
11
|
-
filesystem,
|
|
12
|
-
get_filesystem_class,
|
|
13
|
-
known_implementations,
|
|
14
|
-
register_implementation,
|
|
15
|
-
registry,
|
|
16
|
-
)
|
|
17
|
-
from fsspec.spec import AbstractFileSystem
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@pytest.fixture()
|
|
21
|
-
def clear_registry():
|
|
22
|
-
try:
|
|
23
|
-
yield
|
|
24
|
-
finally:
|
|
25
|
-
_registry.clear()
|
|
26
|
-
known_implementations.pop("test", None)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@pytest.fixture()
|
|
30
|
-
def clean_imports():
|
|
31
|
-
try:
|
|
32
|
-
real_module = sys.modules["fsspec"]
|
|
33
|
-
del sys.modules["fsspec"]
|
|
34
|
-
yield
|
|
35
|
-
finally:
|
|
36
|
-
sys.modules["fsspec"] = real_module
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def test_registry_readonly():
|
|
40
|
-
get_filesystem_class("file")
|
|
41
|
-
assert "file" in registry
|
|
42
|
-
assert "file" in list(registry)
|
|
43
|
-
with pytest.raises(TypeError):
|
|
44
|
-
del registry["file"]
|
|
45
|
-
with pytest.raises(TypeError):
|
|
46
|
-
registry["file"] = None
|
|
47
|
-
with pytest.raises(AttributeError):
|
|
48
|
-
registry.clear()
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def test_register_cls(clear_registry):
|
|
52
|
-
with pytest.raises(ValueError):
|
|
53
|
-
get_filesystem_class("test")
|
|
54
|
-
register_implementation("test", AbstractFileSystem)
|
|
55
|
-
cls = get_filesystem_class("test")
|
|
56
|
-
assert cls is AbstractFileSystem
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def test_register_str(clear_registry):
|
|
60
|
-
with pytest.raises(ValueError):
|
|
61
|
-
get_filesystem_class("test")
|
|
62
|
-
register_implementation("test", "fsspec.AbstractFileSystem")
|
|
63
|
-
assert "test" not in registry
|
|
64
|
-
cls = get_filesystem_class("test")
|
|
65
|
-
assert cls is AbstractFileSystem
|
|
66
|
-
assert "test" in registry
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def test_register_fail(clear_registry):
|
|
70
|
-
register_implementation("test", "doesntexist.AbstractFileSystem")
|
|
71
|
-
with pytest.raises(ImportError):
|
|
72
|
-
get_filesystem_class("test")
|
|
73
|
-
|
|
74
|
-
# NOOP
|
|
75
|
-
register_implementation("test", "doesntexist.AbstractFileSystem", clobber=False)
|
|
76
|
-
with pytest.raises(ValueError):
|
|
77
|
-
register_implementation(
|
|
78
|
-
"test", "doesntexist.AbstractFileSystemm", clobber=False
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
# by default we do not allow clobbering
|
|
82
|
-
with pytest.raises(ValueError):
|
|
83
|
-
register_implementation("test", "doesntexist.AbstractFileSystemm")
|
|
84
|
-
|
|
85
|
-
register_implementation(
|
|
86
|
-
"test", "doesntexist.AbstractFileSystem", errtxt="hiho", clobber=True
|
|
87
|
-
)
|
|
88
|
-
with pytest.raises(ImportError) as e:
|
|
89
|
-
get_filesystem_class("test")
|
|
90
|
-
assert "hiho" in str(e.value)
|
|
91
|
-
register_implementation("test", AbstractFileSystem)
|
|
92
|
-
|
|
93
|
-
# NOOP
|
|
94
|
-
register_implementation("test", AbstractFileSystem)
|
|
95
|
-
with pytest.raises(ValueError):
|
|
96
|
-
register_implementation("test", ZipFileSystem)
|
|
97
|
-
register_implementation("test", AbstractFileSystem, clobber=True)
|
|
98
|
-
assert isinstance(fsspec.filesystem("test"), AbstractFileSystem)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def test_entry_points_registered_on_import(clear_registry, clean_imports):
|
|
102
|
-
mock_ep = create_autospec(EntryPoint, module="fsspec.spec.AbstractFileSystem")
|
|
103
|
-
mock_ep.name = "test" # this can't be set in the constructor...
|
|
104
|
-
mock_ep.value = "fsspec.spec.AbstractFileSystem"
|
|
105
|
-
import_location = "importlib.metadata.entry_points"
|
|
106
|
-
with patch(import_location, return_value={"fsspec.specs": [mock_ep]}):
|
|
107
|
-
assert "test" not in registry
|
|
108
|
-
import fsspec # noqa
|
|
109
|
-
|
|
110
|
-
get_filesystem_class("test")
|
|
111
|
-
assert "test" in registry
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def test_filesystem_warning_arrow_hdfs_deprecated(clear_registry, clean_imports):
|
|
115
|
-
mock_ep = create_autospec(EntryPoint, module="fsspec.spec.AbstractFileSystem")
|
|
116
|
-
mock_ep.name = "arrow_hdfs" # this can't be set in the constructor...
|
|
117
|
-
mock_ep.value = "fsspec.spec.AbstractFileSystem"
|
|
118
|
-
import_location = "importlib.metadata.entry_points"
|
|
119
|
-
with patch(import_location, return_value={"fsspec.specs": [mock_ep]}):
|
|
120
|
-
import fsspec # noqa
|
|
121
|
-
|
|
122
|
-
with pytest.warns(DeprecationWarning):
|
|
123
|
-
filesystem("arrow_hdfs")
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def test_old_s3(monkeypatch):
|
|
127
|
-
from fsspec.registry import _import_class
|
|
128
|
-
|
|
129
|
-
s3fs = pytest.importorskip("s3fs")
|
|
130
|
-
monkeypatch.setattr(s3fs, "__version__", "0.4.2")
|
|
131
|
-
with pytest.warns():
|
|
132
|
-
_import_class("s3fs:S3FileSystem")
|
|
133
|
-
with pytest.warns():
|
|
134
|
-
_import_class("s3fs.S3FileSystem")
|