Parse a full Python module usually consisting of multiple lines. This is a convenience function that can be used to parse a full Python program without having to specify the [`Mode`] or the location. It is probably what you want to use most of the time. # Example For example, parsing a simple function definition and a call to that function: ``` use ruff_python_parser::parse_module; let source
(source: &str)
| 110 | /// assert!(module.is_ok()); |
| 111 | /// ``` |
| 112 | pub fn parse_module(source: &str) -> Result<Parsed<ModModule>, ParseError> { |
| 113 | Parser::new(source, ParseOptions::from(Mode::Module)) |
| 114 | .parse() |
| 115 | .try_into_module() |
| 116 | .unwrap() |
| 117 | .into_result() |
| 118 | } |
| 119 | |
| 120 | /// Parses a single Python expression. |
| 121 | /// |