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_gen_function_from_python_input;pub use pyfunction::parse_python_function_stub;pub use pyfunction::parse_python_overload_stubs;pub use pyfunction::GenFunctionFromPythonInput;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Β§
- build_
parameters_ πfrom_ ast - Build Parameters directly from Python AST Arguments
- dedent π
- Remove common leading whitespace from all lines (similar to Pythonβs textwrap.dedent)
- escape_
python_ πstring - Escape a string for Python syntax
- expr_
to_ πtype_ string - Convert Python expression to type string
- expr_
to_ πtype_ string_ inner - Convert Python expression to type string with context
- 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
- extract_
rust_ πtype_ marker - Extract type name from pyo3_stub_gen.RustType[βTypeNameβ]
- has_
overload_ πdecorator - Check if decorator list contains @overload decorator
- python_
ast_ πto_ python_ string - Convert Python AST expression to Python syntax string
- type_
annotation_ πto_ type_ override - Convert Python type annotation to TypeOrOverride