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

Function get_future_repr_info_fallback

crates/stdlib/src/_asyncio.rs:897–909  ·  view source on GitHub ↗
(future: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

895 }
896
897 fn get_future_repr_info_fallback(future: &PyObject, vm: &VirtualMachine) -> PyResult<Wtf8Buf> {
898 // Fallback: build repr from properties directly
899 if let Ok(Some(state)) =
900 vm.get_attribute_opt(future.to_owned(), vm.ctx.intern_str("_state"))
901 {
902 let s = state
903 .str(vm)
904 .map(|s| s.as_wtf8().to_lowercase())
905 .unwrap_or_else(|_| Wtf8Buf::from("unknown"));
906 return Ok(s);
907 }
908 Ok(Wtf8Buf::from("state=unknown"))
909 }
910
911 fn get_task_repr_info(task: &PyObject, vm: &VirtualMachine) -> PyResult<Wtf8Buf> {
912 // vm.import returns the top-level module, get base_tasks submodule

Callers 1

get_future_repr_infoFunction · 0.85

Calls 7

get_attribute_optMethod · 0.80
intern_strMethod · 0.80
to_lowercaseMethod · 0.80
to_ownedMethod · 0.45
mapMethod · 0.45
strMethod · 0.45
as_wtf8Method · 0.45

Tested by

no test coverage detected