Memory Path API
pathlib_next.mempath
MemBytesIO(dest)
Bases: BytesIO
A BytesIO that writes its buffer back into the backing
bytearray (dest) on close, so MemPath files persist across
open() calls.
Source code in src/pathlib_next/mempath.py
24 25 26 | |
MemPath(*segments, backend=None, **kwargs)
Bases: Path
In-memory Path implementation over nested dicts (see
MemPathBackend) -- a lightweight virtual filesystem for mocks, tests,
or transient storage, and the reference exemplar for Track A of
extending this library (subclassing Path directly; see
docs/guides/extending.md).
Source code in src/pathlib_next/mempath.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
MemPathBackend
Bases: dict
Nested-dict storage backing one or more MemPath trees. A dict
value is a directory; a bytearray value is a file's content. Share
one instance across MemPaths (via backend=) to give them the same
virtual filesystem.