Every path is missing: reads fail with NotFound, exists is
False, remove does nothing, and making directories or temporary
files dies. Subclass it and override what a test needs::
class Env(NoopFileSystem):
def read_file_string(self, path: str, encoding: str = "utf-8"):
return fx.succeed("A=1")Functions#
access#
access(path, *, readable=False, writable=False) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
readable | bool = False | |
writable | bool = False |
Returns Effect[None, PlatformError]
def access(
self, path: str, *, readable: bool = False, writable: bool = False
) -> Effect[None, PlatformError]:
return _missing("access", path)copy#
copy(from_path, to_path, *, overwrite=False, preserve_timestamps=False) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
from_path | str | |
to_path | str | |
overwrite | bool = False | |
preserve_timestamps | bool = False |
Returns Effect[None, PlatformError]
def copy(
self,
from_path: str,
to_path: str,
*,
overwrite: bool = False,
preserve_timestamps: bool = False,
) -> Effect[None, PlatformError]:
return _missing("copy", from_path)copy_file#
copy_file(from_path, to_path) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
from_path | str | |
to_path | str |
Returns Effect[None, PlatformError]
def copy_file(self, from_path: str, to_path: str) -> Effect[None, PlatformError]:
return _missing("copy_file", from_path)chmod#
chmod(path, mode) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
mode | int |
Returns Effect[None, PlatformError]
def chmod(self, path: str, mode: int) -> Effect[None, PlatformError]:
return _missing("chmod", path)chown#
chown(path, uid, gid) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
uid | int | |
gid | int |
Returns Effect[None, PlatformError]
def chown(self, path: str, uid: int, gid: int) -> Effect[None, PlatformError]:
return _missing("chown", path)glob#
glob(pattern, *, root=None, exclude=(), dot=False) -> Effect[list[str], PlatformError]| Parameter | Type | Description |
|---|---|---|
pattern | str | |
root | str | None = None | |
exclude | tuple[str, ...] = () | |
dot | bool = False |
Returns Effect[list[str], PlatformError]
def glob(
self,
pattern: str,
*,
root: str | None = None,
exclude: tuple[str, ...] = (),
dot: bool = False,
) -> Effect[list[str], PlatformError]:
return _missing("glob", pattern)exists#
exists(path) -> Effect[bool, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str |
Returns Effect[bool, PlatformError]
def exists(self, path: str) -> Effect[bool, PlatformError]:
return succeed(False)link#
link(from_path, to_path) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
from_path | str | |
to_path | str |
Returns Effect[None, PlatformError]
def link(self, from_path: str, to_path: str) -> Effect[None, PlatformError]:
return _missing("link", from_path)lstat#
lstat(path) -> Effect[FileInfo, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str |
Returns Effect[FileInfo, PlatformError]
def lstat(self, path: str) -> Effect[FileInfo, PlatformError]:
return _missing("lstat", path)make_directory#
make_directory(path, *, recursive=False, mode=511) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
recursive | bool = False | |
mode | int = 511 |
Returns Effect[None, PlatformError]
def make_directory(
self, path: str, *, recursive: bool = False, mode: int = 0o777
) -> Effect[None, PlatformError]:
return _unimplemented()make_temp_directory#
make_temp_directory(*, directory=None, prefix='') -> Effect[str, PlatformError]| Parameter | Type | Description |
|---|---|---|
directory | str | None = None | |
prefix | str = '' |
Returns Effect[str, PlatformError]
def make_temp_directory(
self, *, directory: str | None = None, prefix: str = ""
) -> Effect[str, PlatformError]:
return _unimplemented()make_temp_directory_scoped#
make_temp_directory_scoped(*, directory=None, prefix='') -> Effect[str, PlatformError, Scope]| Parameter | Type | Description |
|---|---|---|
directory | str | None = None | |
prefix | str = '' |
Returns Effect[str, PlatformError, Scope]
def make_temp_directory_scoped(
self, *, directory: str | None = None, prefix: str = ""
) -> Effect[str, PlatformError, Scope]:
return _unimplemented()make_temp_file#
make_temp_file(*, directory=None, prefix='', suffix='') -> Effect[str, PlatformError]| Parameter | Type | Description |
|---|---|---|
directory | str | None = None | |
prefix | str = '' | |
suffix | str = '' |
Returns Effect[str, PlatformError]
def make_temp_file(
self, *, directory: str | None = None, prefix: str = "", suffix: str = ""
) -> Effect[str, PlatformError]:
return _unimplemented()make_temp_file_scoped#
make_temp_file_scoped(*, directory=None, prefix='', suffix='') -> Effect[str, PlatformError, Scope]| Parameter | Type | Description |
|---|---|---|
directory | str | None = None | |
prefix | str = '' | |
suffix | str = '' |
Returns Effect[str, PlatformError, Scope]
def make_temp_file_scoped(
self, *, directory: str | None = None, prefix: str = "", suffix: str = ""
) -> Effect[str, PlatformError, Scope]:
return _unimplemented()open#
open(path, *, flag='r', mode=438, no_follow=False) -> Effect[File, PlatformError, Scope]| Parameter | Type | Description |
|---|---|---|
path | str | |
flag | OpenFlag = 'r' | |
mode | int = 438 | |
no_follow | bool = False |
Returns Effect[File, PlatformError, Scope]
def open(
self, path: str, *, flag: OpenFlag = "r", mode: int = 0o666, no_follow: bool = False
) -> Effect[File, PlatformError, Scope]:
return _missing("open", path)read_directory#
read_directory(path, *, recursive=False) -> Effect[list[str], PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
recursive | bool = False |
Returns Effect[list[str], PlatformError]
def read_directory(
self, path: str, *, recursive: bool = False
) -> Effect[list[str], PlatformError]:
return _missing("read_directory", path)read_directory_entries#
read_directory_entries(path) -> Effect[tuple[DirectoryEntry, ...], PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str |
Returns Effect[tuple[DirectoryEntry, ...], PlatformError]
def read_directory_entries(
self, path: str
) -> Effect[tuple[DirectoryEntry, ...], PlatformError]:
return _missing("read_directory_entries", path)read_file#
read_file(path) -> Effect[bytes, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str |
Returns Effect[bytes, PlatformError]
def read_file(self, path: str) -> Effect[bytes, PlatformError]:
return _missing("read_file", path)read_file_string#
read_file_string(path, encoding='utf-8') -> Effect[str, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
encoding | str = 'utf-8' |
Returns Effect[str, PlatformError]
def read_file_string(self, path: str, encoding: str = "utf-8") -> Effect[str, PlatformError]:
return _missing("read_file_string", path)read_link#
read_link(path) -> Effect[str, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str |
Returns Effect[str, PlatformError]
def read_link(self, path: str) -> Effect[str, PlatformError]:
return _missing("read_link", path)real_path#
real_path(path) -> Effect[str, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str |
Returns Effect[str, PlatformError]
def real_path(self, path: str) -> Effect[str, PlatformError]:
return _missing("real_path", path)remove#
remove(path, *, recursive=False, force=False) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
recursive | bool = False | |
force | bool = False |
Returns Effect[None, PlatformError]
def remove(
self, path: str, *, recursive: bool = False, force: bool = False
) -> Effect[None, PlatformError]:
return voidrename#
rename(old_path, new_path) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
old_path | str | |
new_path | str |
Returns Effect[None, PlatformError]
def rename(self, old_path: str, new_path: str) -> Effect[None, PlatformError]:
return _missing("rename", old_path)sink#
sink(path, *, flag='w', mode=438) -> Sink[None, bytes, Never, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
flag | OpenFlag = 'w' | |
mode | int = 438 |
Returns Sink[None, bytes, Never, PlatformError]
def sink(
self, path: str, *, flag: OpenFlag = "w", mode: int = 0o666
) -> Sink[None, bytes, Never, PlatformError]:
return sink_.fail(not_found("sink", path))stat#
stat(path) -> Effect[FileInfo, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str |
Returns Effect[FileInfo, PlatformError]
def stat(self, path: str) -> Effect[FileInfo, PlatformError]:
return _missing("stat", path)stream#
stream(path, *, offset=0, bytes_to_read=None, chunk_size=DEFAULT_CHUNK_SIZE) -> Stream[bytes, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
offset | int = 0 | |
bytes_to_read | int | None = None | |
chunk_size | int = DEFAULT_CHUNK_SIZE |
Returns Stream[bytes, PlatformError]
def stream(
self,
path: str,
*,
offset: int = 0,
bytes_to_read: int | None = None,
chunk_size: int = DEFAULT_CHUNK_SIZE,
) -> Stream[bytes, PlatformError]:
return stream_.fail(not_found("stream", path))symlink#
symlink(from_path, to_path) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
from_path | str | |
to_path | str |
Returns Effect[None, PlatformError]
def symlink(self, from_path: str, to_path: str) -> Effect[None, PlatformError]:
return _missing("symlink", from_path)truncate#
truncate(path, length=0) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
length | int = 0 |
Returns Effect[None, PlatformError]
def truncate(self, path: str, length: int = 0) -> Effect[None, PlatformError]:
return _missing("truncate", path)utimes#
utimes(path, atime, mtime) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
atime | datetime | float | |
mtime | datetime | float |
Returns Effect[None, PlatformError]
def utimes(
self, path: str, atime: datetime | float, mtime: datetime | float
) -> Effect[None, PlatformError]:
return _missing("utimes", path)watch#
watch(path, *, recursive=False, on_ready=None) -> Stream[WatchEvent, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
recursive | bool = False | |
on_ready | Callable[[], None] | None = None |
Returns Stream[WatchEvent, PlatformError]
def watch(
self, path: str, *, recursive: bool = False, on_ready: Callable[[], None] | None = None
) -> Stream[WatchEvent, PlatformError]:
return stream_.fail(not_found("watch", path))write_file#
write_file(path, data, *, flag='w', mode=438) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
data | bytes | |
flag | OpenFlag = 'w' | |
mode | int = 438 |
Returns Effect[None, PlatformError]
def write_file(
self, path: str, data: bytes, *, flag: OpenFlag = "w", mode: int = 0o666
) -> Effect[None, PlatformError]:
return _missing("write_file", path)write_file_string#
write_file_string(path, data, *, flag='w', mode=438) -> Effect[None, PlatformError]| Parameter | Type | Description |
|---|---|---|
path | str | |
data | str | |
flag | OpenFlag = 'w' | |
mode | int = 438 |
Returns Effect[None, PlatformError]
def write_file_string(
self, path: str, data: str, *, flag: OpenFlag = "w", mode: int = 0o666
) -> Effect[None, PlatformError]:
return _missing("write_file_string", path)On This Page
Functionsaccesscopycopy_filechmodchownglobexistslinklstatmake_directorymake_temp_directorymake_temp_directory_scopedmake_temp_filemake_temp_file_scopedopenread_directoryread_directory_entriesread_fileread_file_stringread_linkreal_pathremoverenamesinkstatstreamsymlinktruncateutimeswatchwrite_filewrite_file_string