Parse a single parameter line from NumPy/Sphinx-style docstring
(line: &str)
| 786 | |
| 787 | /// Parse a single parameter line from NumPy/Sphinx-style docstring |
| 788 | fn parse_numpy_param_line(line: &str) -> Option<(String, String)> { |
| 789 | let trimmed = line.trim(); |
| 790 | |
| 791 | // Look for pattern: "param_name : type" followed by description on next lines |
| 792 | // For simplicity, we'll look for lines that start with a word followed by space and colon |
| 793 | if let Some(colon_pos) = trimmed.find(" :") { |
| 794 | let param_name = trimmed[..colon_pos].trim(); |
| 795 | let rest = trimmed[colon_pos + 2..].trim(); |
| 796 | |
| 797 | if !param_name.is_empty() { |
| 798 | // For NumPy style, description might be on the same line after type |
| 799 | let description = if rest.is_empty() { |
| 800 | format!("Parameter {}", param_name) |
| 801 | } else { |
| 802 | rest.to_string() |
| 803 | }; |
| 804 | return Some((param_name.to_string(), description)); |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | None |
| 809 | } |
| 810 | |
| 811 | /// Map Python type annotations to JSON Schema types |
| 812 | fn map_python_type_to_json_schema(type_str: &str) -> &'static str { |
no test coverage detected