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

Function access

crates/vm/src/stdlib/nt.rs:68–74  ·  view source on GitHub ↗
(path: OsPath, mode: u8, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

66
67 #[pyfunction]
68 pub(super) fn access(path: OsPath, mode: u8, vm: &VirtualMachine) -> PyResult<bool> {
69 let attr = unsafe { FileSystem::GetFileAttributesW(path.to_wide_cstring(vm)?.as_ptr()) };
70 Ok(attr != FileSystem::INVALID_FILE_ATTRIBUTES
71 && (mode & 2 == 0
72 || attr & FileSystem::FILE_ATTRIBUTE_READONLY == 0
73 || attr & FileSystem::FILE_ATTRIBUTE_DIRECTORY != 0))
74 }
75
76 #[pyfunction]
77 #[pyfunction(name = "unlink")]

Callers

nothing calls this directly

Calls 2

as_ptrMethod · 0.45
to_wide_cstringMethod · 0.45

Tested by

no test coverage detected