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

Method slot_repr

crates/vm/src/stdlib/_io.rs:1751–1761  ·  view source on GitHub ↗
(zelf: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1749
1750 #[pyslot]
1751 fn slot_repr(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyRef<PyStr>> {
1752 let name_repr = repr_file_obj_name(zelf, vm)?;
1753 let cls = zelf.class();
1754 let slot_name = cls.slot_name();
1755 let repr = if let Some(name_repr) = name_repr {
1756 format!("<{slot_name} name={name_repr}>")
1757 } else {
1758 format!("<{slot_name}>")
1759 };
1760 Ok(vm.ctx.new_str(repr))
1761 }
1762
1763 #[pymethod]
1764 fn __repr__(zelf: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyRef<PyStr>> {

Callers

nothing calls this directly

Implementers 1

_io.rscrates/vm/src/stdlib/_io.rs

Calls 4

repr_file_obj_nameFunction · 0.85
classMethod · 0.45
slot_nameMethod · 0.45
new_strMethod · 0.45

Tested by

no test coverage detected