Predicates & ids¶
Type predicates classify the entry itself (lstat): a symlink answers True
only to is_link, matching fs.
pyrfs.is_file ¶
is_file(path: str) -> bool
Whether the path is a regular file (symlinks answer False).
Classifies the entry itself (lstat), matching fs — unlike
os.path.isfile, which follows symlinks. Vectorized: also accepts an
iterable or pandas Series of paths.
See Also
is_link : The predicate a symlink answers True to.
pyrfs.file_exists : Existence regardless of type.
Examples:
>>> from pyrfs import file_touch, link_create
>>> _ = file_touch("data.txt")
>>> _ = link_create("data.txt", "ln.txt")
>>> is_file("data.txt"), is_file("ln.txt"), is_file("missing")
(True, False, False)
pyrfs.is_dir ¶
is_dir(path: str) -> bool
Whether the path is a directory (symlinks answer False).
Classifies the entry itself (lstat), matching fs — unlike
os.path.isdir and pyrfs.dir_exists, which follow symlinks.
Vectorized: also accepts an iterable or pandas Series of paths.
See Also
pyrfs.dir_exists : Follow-symlink directory test.
pyrfs.is_link ¶
is_link(path: str) -> bool
Whether the path is a symlink (its target need not exist).
Vectorized: also accepts an iterable or pandas Series of paths.
See Also
pyrfs.link_path : Read where the link points.
pyrfs.is_file_empty ¶
is_file_empty(path: str) -> bool
Whether the file exists and has size zero.
Missing paths answer False (they are not empty files). Vectorized:
also accepts an iterable or pandas Series of paths.
pyrfs.is_dir_empty ¶
is_dir_empty(path: str) -> bool
Whether the directory exists and has no entries (hidden included).
Missing paths answer False. Vectorized: also accepts an iterable or
pandas Series of paths.
Examples:
>>> from pyrfs import dir_create
>>> _ = dir_create("empty")
>>> is_dir_empty("empty")
True
pyrfs.is_absolute_path ¶
is_absolute_path(path: str) -> bool
Whether the path is absolute (a leading ~ counts, as in fs).
Pure string test — no filesystem access. Vectorized: also accepts an iterable or pandas Series of paths.
Examples:
>>> is_absolute_path(["/usr", "~/data", "rel/path"])
[True, True, False]
pyrfs.user_ids ¶
user_ids() -> list[dict[str, object]]
All known users as rows of {"user_id", "user_name"}.
Returns an empty list on platforms without pwd (Windows).
pyrfs.group_ids ¶
group_ids() -> list[dict[str, object]]
All known groups as rows of {"group_id", "group_name"}.
Returns an empty list on platforms without grp (Windows).