nemo_gym.verifiers.files
nemo_gym.verifiers.files
File checks for Python verifiers: the agent’s workspace is a directory, these read it.
Standard library only (see nemo_gym.verifiers). Paths are relative to the workspace; a path that
escapes it (.. or an absolute path outside it) reads as absent, so a task cannot be graded on files the
agent never owned.
Module Contents
Functions
API
Whether path under the workspace is a regular file.
The text of path under the workspace, or None when it is absent or not a file.
One trailing newline is dropped by default (echo and most editors end a file with one, and a verifier
comparing read_text(...) == "answer" should not fail on it); pass strip_trailing_newline=False for the
bytes as written. Undecodable bytes are replaced rather than raised, so a verifier comparing text never
crashes on binary output.
1.0 when path under the workspace holds exactly content (one trailing newline tolerated).
A complete verifier: verify = functools.partial(text_file_equals, path="hello.txt", content="hello").