flatfs 0.6.0__tar.gz → 0.7.0__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.
- {flatfs-0.6.0 → flatfs-0.7.0}/PKG-INFO +2 -1
- flatfs-0.7.0/flatfs/__init__.py +1 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/backends.py +15 -9
- {flatfs-0.6.0 → flatfs-0.7.0}/pyproject.toml +2 -1
- flatfs-0.6.0/flatfs/__init__.py +0 -1
- {flatfs-0.6.0 → flatfs-0.7.0}/LICENSE.txt +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/README.md +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/_compat.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/_export.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/_utils.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/aio/__init__.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/aio/api.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/aio/backends.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/aio/helpers.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/aio/interface.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/api.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/exc.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/helpers.py +0 -0
- {flatfs-0.6.0 → flatfs-0.7.0}/flatfs/interface.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flatfs
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Minimal filesystem abstraction with pluggable backends, treating paths as keys and file contents as values.
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE.txt
|
|
@@ -12,6 +12,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Requires-Dist: atomicwrites (>=1.4.1,<2.0.0)
|
|
15
16
|
Project-URL: Bug Tracker, https://github.com/mwiatrzyk/flatfs/issues
|
|
16
17
|
Project-URL: Repository, https://github.com/mwiatrzyk/flatfs
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.7.0"
|
|
@@ -5,6 +5,8 @@ import os
|
|
|
5
5
|
import pathlib
|
|
6
6
|
from typing import Generator, Iterator, Optional
|
|
7
7
|
|
|
8
|
+
from atomicwrites import atomic_write # type: ignore
|
|
9
|
+
|
|
8
10
|
from flatfs.exc import PathAccessError, PathNotFoundError
|
|
9
11
|
from flatfs.interface import Stat
|
|
10
12
|
|
|
@@ -15,9 +17,9 @@ __all__ = export = _export.Export() # type: ignore
|
|
|
15
17
|
|
|
16
18
|
@export
|
|
17
19
|
class LocalFlatFs:
|
|
18
|
-
"""FlatFS implementation using local filesystem to store files.
|
|
20
|
+
"""FlatFS implementation using a local filesystem to store files.
|
|
19
21
|
|
|
20
|
-
You can use this to access files
|
|
22
|
+
You can use this to access files within an existing directory (the paths are
|
|
21
23
|
then relative to *root_dir*), or to create a completely new filesystem
|
|
22
24
|
inside an empty directory.
|
|
23
25
|
|
|
@@ -27,19 +29,19 @@ class LocalFlatFs:
|
|
|
27
29
|
:param exclude:
|
|
28
30
|
The glob patterns of paths to exclude.
|
|
29
31
|
|
|
30
|
-
For example, you may want to exclude ``.git`` directory when you use
|
|
31
|
-
FlatFS to access content of
|
|
32
|
+
For example, you may want to exclude the ``.git`` directory when you use
|
|
33
|
+
FlatFS to access the content of a Git repository.
|
|
32
34
|
|
|
33
|
-
For more details on pattern syntax
|
|
35
|
+
For more details on the pattern syntax, check :mod:`fnmatch` which is
|
|
34
36
|
used underneath.
|
|
35
37
|
|
|
36
38
|
:param include:
|
|
37
39
|
The glob patterns of paths to include.
|
|
38
40
|
|
|
39
|
-
These can only be paths from
|
|
40
|
-
may wish to allow
|
|
41
|
+
These can only be paths from within the root directory. For example, you
|
|
42
|
+
may wish to allow only the ``src`` and ``test`` directories, not all files.
|
|
41
43
|
|
|
42
|
-
For more details on pattern syntax
|
|
44
|
+
For more details on the pattern syntax, check :mod:`fnmatch` which is
|
|
43
45
|
used underneath.
|
|
44
46
|
"""
|
|
45
47
|
|
|
@@ -111,7 +113,7 @@ class LocalFlatFs:
|
|
|
111
113
|
def write_chunks(self, path: str, chunk_gen: Generator[bytes, None, None]) -> Generator[int, None, None]:
|
|
112
114
|
abspath = self.__make_abspath(path)
|
|
113
115
|
abspath.parent.mkdir(parents=True, exist_ok=True)
|
|
114
|
-
with abspath
|
|
116
|
+
with atomic_write(abspath, mode="wb", overwrite=True) as fd:
|
|
115
117
|
for chunk in chunk_gen:
|
|
116
118
|
yield fd.write(chunk)
|
|
117
119
|
|
|
@@ -120,6 +122,10 @@ class LocalFlatFs:
|
|
|
120
122
|
if not abspath.is_file():
|
|
121
123
|
raise PathNotFoundError(path)
|
|
122
124
|
abspath.unlink()
|
|
125
|
+
current = abspath.parent
|
|
126
|
+
while len(os.listdir(current)) == 0:
|
|
127
|
+
current.rmdir()
|
|
128
|
+
current = current.parent
|
|
123
129
|
|
|
124
130
|
|
|
125
131
|
@export
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "flatfs"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.7.0"
|
|
4
4
|
description = "Minimal filesystem abstraction with pluggable backends, treating paths as keys and file contents as values."
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Maciej Wiatrzyk", email = "maciej.wiatrzyk@gmail.com"}
|
|
@@ -17,6 +17,7 @@ classifiers = [
|
|
|
17
17
|
]
|
|
18
18
|
requires-python = ">=3.9,<4"
|
|
19
19
|
dependencies = [
|
|
20
|
+
"atomicwrites (>=1.4.1,<2.0.0)"
|
|
20
21
|
]
|
|
21
22
|
|
|
22
23
|
[project.urls]
|
flatfs-0.6.0/flatfs/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.6.0"
|
|
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
|