GitHub

NoopFileSystem

API reference for NoopFileSystem.

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]
ParameterTypeDescription
pathstr
readablebool = False
writablebool = 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]
ParameterTypeDescription
from_pathstr
to_pathstr
overwritebool = False
preserve_timestampsbool = 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]
ParameterTypeDescription
from_pathstr
to_pathstr

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]
ParameterTypeDescription
pathstr
modeint

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]
ParameterTypeDescription
pathstr
uidint
gidint

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]
ParameterTypeDescription
patternstr
rootstr | None = None
excludetuple[str, ...] = ()
dotbool = 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]
ParameterTypeDescription
pathstr

Returns Effect[bool, PlatformError]

def exists(self, path: str) -> Effect[bool, PlatformError]:
    return succeed(False)
link(from_path, to_path) -> Effect[None, PlatformError]
ParameterTypeDescription
from_pathstr
to_pathstr

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]
ParameterTypeDescription
pathstr

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]
ParameterTypeDescription
pathstr
recursivebool = False
modeint = 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]
ParameterTypeDescription
directorystr | None = None
prefixstr = ''

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]
ParameterTypeDescription
directorystr | None = None
prefixstr = ''

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]
ParameterTypeDescription
directorystr | None = None
prefixstr = ''
suffixstr = ''

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]
ParameterTypeDescription
directorystr | None = None
prefixstr = ''
suffixstr = ''

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]
ParameterTypeDescription
pathstr
flagOpenFlag = 'r'
modeint = 438
no_followbool = 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]
ParameterTypeDescription
pathstr
recursivebool = 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]
ParameterTypeDescription
pathstr

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]
ParameterTypeDescription
pathstr

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]
ParameterTypeDescription
pathstr
encodingstr = '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(path) -> Effect[str, PlatformError]
ParameterTypeDescription
pathstr

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]
ParameterTypeDescription
pathstr

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]
ParameterTypeDescription
pathstr
recursivebool = False
forcebool = False

Returns Effect[None, PlatformError]

def remove(
    self, path: str, *, recursive: bool = False, force: bool = False
) -> Effect[None, PlatformError]:
    return void

rename

rename(old_path, new_path) -> Effect[None, PlatformError]
ParameterTypeDescription
old_pathstr
new_pathstr

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]
ParameterTypeDescription
pathstr
flagOpenFlag = 'w'
modeint = 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]
ParameterTypeDescription
pathstr

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]
ParameterTypeDescription
pathstr
offsetint = 0
bytes_to_readint | None = None
chunk_sizeint = 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(from_path, to_path) -> Effect[None, PlatformError]
ParameterTypeDescription
from_pathstr
to_pathstr

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]
ParameterTypeDescription
pathstr
lengthint = 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]
ParameterTypeDescription
pathstr
atimedatetime | float
mtimedatetime | 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]
ParameterTypeDescription
pathstr
recursivebool = False
on_readyCallable[[], 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]
ParameterTypeDescription
pathstr
databytes
flagOpenFlag = 'w'
modeint = 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]
ParameterTypeDescription
pathstr
datastr
flagOpenFlag = 'w'
modeint = 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)