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

Function check_readable

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

Source from the content-addressed store, hash-verified

367 }
368
369 fn check_readable(file: &PyObject, vm: &VirtualMachine) -> PyResult<()> {
370 if vm.call_method(file, "readable", ())?.try_to_bool(vm)? {
371 Ok(())
372 } else {
373 Err(new_unsupported_operation(
374 vm,
375 "File or stream is not readable".to_owned(),
376 ))
377 }
378 }
379
380 fn check_writable(file: &PyObject, vm: &VirtualMachine) -> PyResult<()> {
381 if vm.call_method(file, "writable", ())?.try_to_bool(vm)? {

Callers 2

check_readableMethod · 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