(
qualname: impl core::fmt::Display,
kind: &str,
missing: &mut Vec<impl core::fmt::Display>,
)
| 28 | use rustpython_jit::CompiledCode; |
| 29 | |
| 30 | fn format_missing_args( |
| 31 | qualname: impl core::fmt::Display, |
| 32 | kind: &str, |
| 33 | missing: &mut Vec<impl core::fmt::Display>, |
| 34 | ) -> String { |
| 35 | let count = missing.len(); |
| 36 | let last = if missing.len() > 1 { |
| 37 | missing.pop() |
| 38 | } else { |
| 39 | None |
| 40 | }; |
| 41 | let (and, right): (&str, String) = if let Some(last) = last { |
| 42 | ( |
| 43 | if missing.len() == 1 { |
| 44 | "' and '" |
| 45 | } else { |
| 46 | "', and '" |
| 47 | }, |
| 48 | format!("{last}"), |
| 49 | ) |
| 50 | } else { |
| 51 | ("", String::new()) |
| 52 | }; |
| 53 | format!( |
| 54 | "{qualname}() missing {count} required {kind} argument{}: '{}{}{right}'", |
| 55 | if count == 1 { "" } else { "s" }, |
| 56 | missing.iter().join("', '"), |
| 57 | and, |
| 58 | ) |
| 59 | } |
| 60 | |
| 61 | #[pyclass(module = false, name = "function", traverse = "manual")] |
| 62 | #[derive(Debug)] |
no test coverage detected