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

Function split

crates/stdlib/src/re.rs:149–159  ·  view source on GitHub ↗
(
        pattern: PyStrRef,
        string: PyStrRef,
        maxsplit: OptionalArg<PyIntRef>,
        flags: OptionalArg<usize>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

147
148 #[pyfunction]
149 fn split(
150 pattern: PyStrRef,
151 string: PyStrRef,
152 maxsplit: OptionalArg<PyIntRef>,
153 flags: OptionalArg<usize>,
154 vm: &VirtualMachine,
155 ) -> PyResult {
156 let flags = extract_flags(flags);
157 let regex = make_regex(vm, pattern.as_str(), flags)?;
158 do_split(vm, &regex, string, maxsplit.into_option())
159 }
160
161 fn do_sub(pattern: &PyPattern, repl: PyStrRef, search_text: PyStrRef, limit: usize) -> String {
162 let out = pattern

Callers 2

py_splitMethod · 0.50
py_partitionMethod · 0.50

Calls 5

extract_flagsFunction · 0.85
make_regexFunction · 0.85
do_splitFunction · 0.85
into_optionMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected