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

Method repr_str

crates/stdlib/src/array.rs:1268–1280  ·  view source on GitHub ↗
(zelf: &Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1266 impl Representable for PyArray {
1267 #[inline]
1268 fn repr_str(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<String> {
1269 let class = zelf.class();
1270 let class_name = class.name();
1271 if zelf.read().typecode() == 'u' {
1272 if zelf.__len__() == 0 {
1273 return Ok(format!("{class_name}('u')"));
1274 }
1275 let to_unicode = zelf.tounicode(vm)?;
1276 let escape = crate::vm::literal::escape::UnicodeEscape::new_repr(&to_unicode);
1277 return Ok(format!("{}('u', {})", class_name, escape.str_repr()));
1278 }
1279 zelf.read().repr(&class_name, vm)
1280 }
1281 }
1282
1283 static BUFFER_METHODS: BufferMethods = BufferMethods {

Callers

nothing calls this directly

Calls 7

typecodeMethod · 0.80
tounicodeMethod · 0.80
classMethod · 0.45
nameMethod · 0.45
readMethod · 0.45
__len__Method · 0.45
reprMethod · 0.45

Tested by

no test coverage detected