(&self, sep: PyBytesInner, vm: &VirtualMachine)
| 467 | |
| 468 | #[pymethod] |
| 469 | fn partition(&self, sep: PyBytesInner, vm: &VirtualMachine) -> PyResult<PyTupleRef> { |
| 470 | // sep ALWAYS converted to bytearray even it's bytes or memoryview |
| 471 | // so its ok to accept PyBytesInner |
| 472 | let value = self.inner(); |
| 473 | let (front, has_mid, back) = value.partition(&sep, vm)?; |
| 474 | Ok(vm.new_tuple(( |
| 475 | vm.ctx.new_bytearray(front.to_vec()), |
| 476 | vm.ctx |
| 477 | .new_bytearray(if has_mid { sep.elements } else { Vec::new() }), |
| 478 | vm.ctx.new_bytearray(back.to_vec()), |
| 479 | ))) |
| 480 | } |
| 481 | |
| 482 | #[pymethod] |
| 483 | fn rpartition(&self, sep: PyBytesInner, vm: &VirtualMachine) -> PyResult<PyTupleRef> { |
nothing calls this directly
no test coverage detected