MCPcopy Index your code
hub / github.com/RustPython/RustPython / stat

Function stat

crates/vm/src/stdlib/os.rs:1455–1465  ·  view source on GitHub ↗
(
        file: OsPathOrFd<'_>,
        dir_fd: DirFd<'_, { STAT_DIR_FD as usize }>,
        follow_symlinks: FollowSymlinks,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

1453 #[pyfunction]
1454 #[pyfunction(name = "fstat")]
1455 fn stat(
1456 file: OsPathOrFd<'_>,
1457 dir_fd: DirFd<'_, { STAT_DIR_FD as usize }>,
1458 follow_symlinks: FollowSymlinks,
1459 vm: &VirtualMachine,
1460 ) -> PyResult {
1461 let stat = stat_inner(file.clone(), dir_fd, follow_symlinks)
1462 .map_err(|err| OSErrorBuilder::with_filename(&err, file, vm))?
1463 .ok_or_else(|| crate::exceptions::cstring_error(vm))?;
1464 Ok(StatResultData::from_stat(&stat, vm).to_pyobject(vm))
1465 }
1466
1467 #[pyfunction]
1468 fn lstat(

Callers 4

_fwalkFunction · 0.85
statMethod · 0.85
stat_innerFunction · 0.85
lstatFunction · 0.85

Calls 5

stat_innerFunction · 0.85
cstring_errorFunction · 0.85
ok_or_elseMethod · 0.80
cloneMethod · 0.45
to_pyobjectMethod · 0.45

Tested by

no test coverage detected