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

Method with_kwargs_names

crates/vm/src/function/argument.rs:118–136  ·  view source on GitHub ↗
(mut args: A, kwarg_names: KW)

Source from the content-addressed store, hash-verified

116 }
117
118 pub fn with_kwargs_names<A, KW>(mut args: A, kwarg_names: KW) -> Self
119 where
120 A: ExactSizeIterator<Item = PyObjectRef>,
121 KW: ExactSizeIterator<Item = String>,
122 {
123 // last `kwarg_names.len()` elements of args in order of appearance in the call signature
124 let total_argc = args.len();
125 let kwarg_count = kwarg_names.len();
126 let pos_arg_count = total_argc - kwarg_count;
127
128 let pos_args = args.by_ref().take(pos_arg_count).collect();
129
130 let kwargs = kwarg_names.zip_eq(args).collect::<IndexMap<_, _>>();
131
132 Self {
133 args: pos_args,
134 kwargs,
135 }
136 }
137
138 /// Create FuncArgs from a vectorcall-style argument slice (PEP 590).
139 /// `args[..nargs]` are positional, and if `kwnames` is provided,

Callers

nothing calls this directly

Calls 4

collectMethod · 0.80
zip_eqMethod · 0.80
lenMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected