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

Function check_writable

crates/vm/src/stdlib/_io.rs:380–389  ·  view source on GitHub ↗
(file: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

378 }
379
380 fn check_writable(file: &PyObject, vm: &VirtualMachine) -> PyResult<()> {
381 if vm.call_method(file, "writable", ())?.try_to_bool(vm)? {
382 Ok(())
383 } else {
384 Err(new_unsupported_operation(
385 vm,
386 "File or stream is not writable.".to_owned(),
387 ))
388 }
389 }
390
391 fn check_seekable(file: &PyObject, vm: &VirtualMachine) -> PyResult<()> {
392 if vm.call_method(file, "seekable", ())?.try_to_bool(vm)? {

Callers 2

check_writableMethod · 0.85
initMethod · 0.85

Calls 5

try_to_boolMethod · 0.80
ErrClass · 0.50
call_methodMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected