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

Function calculate_qualname

crates/vm/src/builtins/descriptor.rs:248–257  ·  view source on GitHub ↗
(descr: &PyDescriptorOwned, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

246}
247
248fn calculate_qualname(descr: &PyDescriptorOwned, vm: &VirtualMachine) -> PyResult<Option<String>> {
249 if let Some(qualname) = vm.get_attribute_opt(descr.typ.clone().into(), "__qualname__")? {
250 let str = qualname.downcast::<PyStr>().map_err(|_| {
251 vm.new_type_error("<descriptor>.__objclass__.__qualname__ is not a unicode object")
252 })?;
253 Ok(Some(format!("{}.{}", str, descr.name)))
254 } else {
255 Ok(None)
256 }
257}
258
259#[pyclass(with(GetDescriptor, Representable), flags(DISALLOW_INSTANTIATION))]
260impl PyMemberDescriptor {

Callers 1

__qualname__Method · 0.85

Calls 3

get_attribute_optMethod · 0.80
SomeClass · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected