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

Method rpartition

crates/vm/src/builtins/str.rs:1234–1250  ·  view source on GitHub ↗
(&self, sep: PyStrRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1232
1233 #[pymethod]
1234 fn rpartition(&self, sep: PyStrRef, vm: &VirtualMachine) -> PyResult {
1235 let (back, has_mid, front) = self.as_wtf8().py_partition(
1236 sep.as_wtf8(),
1237 || self.as_wtf8().rsplitn(2, sep.as_wtf8()),
1238 vm,
1239 )?;
1240 Ok((
1241 self.new_substr(front),
1242 if has_mid {
1243 sep
1244 } else {
1245 vm.ctx.empty_str.to_owned()
1246 },
1247 self.new_substr(back),
1248 )
1249 .to_pyobject(vm))
1250 }
1251
1252 #[pymethod]
1253 fn istitle(&self) -> bool {

Callers

nothing calls this directly

Calls 6

py_partitionMethod · 0.80
rsplitnMethod · 0.80
new_substrMethod · 0.80
as_wtf8Method · 0.45
to_pyobjectMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected