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

Function validate_whence

crates/vm/src/stdlib/_io.rs:153–162  ·  view source on GitHub ↗
(whence: i32)

Source from the content-addressed store, hash-verified

151
152 #[allow(clippy::let_and_return)]
153 fn validate_whence(whence: i32) -> bool {
154 let x = (0..=2).contains(&whence);
155 cfg_if::cfg_if! {
156 if #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "linux"))] {
157 x || matches!(whence, libc::SEEK_DATA | libc::SEEK_HOLE)
158 } else {
159 x
160 }
161 }
162 }
163
164 fn ensure_unclosed(file: &PyObject, msg: &str, vm: &VirtualMachine) -> PyResult<()> {
165 if file.get_attr("closed", vm)?.try_to_bool(vm)? {

Callers 1

seekMethod · 0.85

Calls 1

containsMethod · 0.45

Tested by

no test coverage detected