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

Method repr_str

crates/vm/src/builtins/builtin_func.rs:111–126  ·  view source on GitHub ↗
(zelf: &Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

109impl Representable for PyNativeFunction {
110 #[inline]
111 fn repr_str(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<String> {
112 if let Some(bound) = zelf
113 .zelf
114 .as_ref()
115 .filter(|b| !b.class().is(vm.ctx.types.module_type))
116 {
117 Ok(format!(
118 "<built-in method {} of {} object at {:#x}>",
119 zelf.value.name,
120 bound.class().name(),
121 bound.get_id()
122 ))
123 } else {
124 Ok(format!("<built-in function {}>", zelf.value.name))
125 }
126 }
127}
128
129#[pyclass(

Callers

nothing calls this directly

Calls 4

isMethod · 0.80
filterMethod · 0.45
as_refMethod · 0.45
classMethod · 0.45

Tested by

no test coverage detected