fsspec 2024.5.0__py3-none-any.whl → 2024.6.0__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.
Files changed (73) hide show
  1. fsspec/_version.py +2 -2
  2. fsspec/caching.py +3 -2
  3. fsspec/compression.py +1 -1
  4. fsspec/implementations/cached.py +1 -13
  5. fsspec/implementations/github.py +12 -0
  6. fsspec/implementations/reference.py +6 -0
  7. fsspec/implementations/smb.py +10 -0
  8. fsspec/json.py +81 -0
  9. fsspec/registry.py +24 -18
  10. fsspec/spec.py +76 -34
  11. fsspec/utils.py +1 -1
  12. {fsspec-2024.5.0.dist-info → fsspec-2024.6.0.dist-info}/METADATA +11 -5
  13. fsspec-2024.6.0.dist-info/RECORD +55 -0
  14. fsspec/implementations/tests/__init__.py +0 -0
  15. fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_file_listing.yaml +0 -112
  16. fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_mkdir.yaml +0 -582
  17. fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_pyarrow_non_partitioned.yaml +0 -873
  18. fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_range.yaml +0 -458
  19. fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_range_chunked.yaml +0 -1355
  20. fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_write_and_read.yaml +0 -795
  21. fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_write_pyarrow_non_partitioned.yaml +0 -613
  22. fsspec/implementations/tests/conftest.py +0 -39
  23. fsspec/implementations/tests/local/__init__.py +0 -0
  24. fsspec/implementations/tests/local/local_fixtures.py +0 -18
  25. fsspec/implementations/tests/local/local_test.py +0 -14
  26. fsspec/implementations/tests/memory/__init__.py +0 -0
  27. fsspec/implementations/tests/memory/memory_fixtures.py +0 -27
  28. fsspec/implementations/tests/memory/memory_test.py +0 -14
  29. fsspec/implementations/tests/out.zip +0 -0
  30. fsspec/implementations/tests/test_archive.py +0 -382
  31. fsspec/implementations/tests/test_arrow.py +0 -259
  32. fsspec/implementations/tests/test_cached.py +0 -1306
  33. fsspec/implementations/tests/test_common.py +0 -35
  34. fsspec/implementations/tests/test_dask.py +0 -29
  35. fsspec/implementations/tests/test_data.py +0 -20
  36. fsspec/implementations/tests/test_dbfs.py +0 -268
  37. fsspec/implementations/tests/test_dirfs.py +0 -588
  38. fsspec/implementations/tests/test_ftp.py +0 -178
  39. fsspec/implementations/tests/test_git.py +0 -76
  40. fsspec/implementations/tests/test_http.py +0 -577
  41. fsspec/implementations/tests/test_jupyter.py +0 -57
  42. fsspec/implementations/tests/test_libarchive.py +0 -33
  43. fsspec/implementations/tests/test_local.py +0 -1285
  44. fsspec/implementations/tests/test_memory.py +0 -382
  45. fsspec/implementations/tests/test_reference.py +0 -720
  46. fsspec/implementations/tests/test_sftp.py +0 -233
  47. fsspec/implementations/tests/test_smb.py +0 -139
  48. fsspec/implementations/tests/test_tar.py +0 -243
  49. fsspec/implementations/tests/test_webhdfs.py +0 -197
  50. fsspec/implementations/tests/test_zip.py +0 -134
  51. fsspec/tests/__init__.py +0 -0
  52. fsspec/tests/conftest.py +0 -188
  53. fsspec/tests/data/listing.html +0 -1
  54. fsspec/tests/test_api.py +0 -498
  55. fsspec/tests/test_async.py +0 -230
  56. fsspec/tests/test_caches.py +0 -255
  57. fsspec/tests/test_callbacks.py +0 -89
  58. fsspec/tests/test_compression.py +0 -164
  59. fsspec/tests/test_config.py +0 -129
  60. fsspec/tests/test_core.py +0 -466
  61. fsspec/tests/test_downstream.py +0 -40
  62. fsspec/tests/test_file.py +0 -200
  63. fsspec/tests/test_fuse.py +0 -147
  64. fsspec/tests/test_generic.py +0 -90
  65. fsspec/tests/test_gui.py +0 -23
  66. fsspec/tests/test_mapping.py +0 -228
  67. fsspec/tests/test_parquet.py +0 -140
  68. fsspec/tests/test_registry.py +0 -134
  69. fsspec/tests/test_spec.py +0 -1167
  70. fsspec/tests/test_utils.py +0 -478
  71. fsspec-2024.5.0.dist-info/RECORD +0 -111
  72. {fsspec-2024.5.0.dist-info → fsspec-2024.6.0.dist-info}/WHEEL +0 -0
  73. {fsspec-2024.5.0.dist-info → fsspec-2024.6.0.dist-info}/licenses/LICENSE +0 -0
@@ -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")