Module parse_python

Source
Expand description

Parse Python stub syntax and generate PyFunctionInfo and MethodInfo

This module provides functionality to parse Python stub syntax (type hints) and convert them into Rust metadata structures for stub generation.

Re-exportsΒ§

pub use pyfunction::parse_python_function_stub;
pub use pymethods::parse_python_methods_stub;

ModulesΒ§

pyfunction πŸ”’
Parse Python function stub syntax and generate PyFunctionInfo
pymethods πŸ”’
Parse Python class method stub syntax and generate MethodInfo

FunctionsΒ§

dedent πŸ”’
Remove common leading whitespace from all lines (similar to Python’s textwrap.dedent)
expr_to_type_string πŸ”’
Convert Python expression to type string
expr_to_type_string_inner πŸ”’
Convert Python expression to type string with context
extract_args πŸ”’
Extract arguments from function definition
extract_deprecated_from_decorators πŸ”’
Extract deprecated decorator information if present
extract_docstring πŸ”’
Extract docstring from function definition
extract_return_type πŸ”’
Extract return type from function definition
type_annotation_to_type_override πŸ”’
Convert Python type annotation to TypeOrOverride