diff --git a/Cargo.toml b/Cargo.toml index 8e43b189..df2b843b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ include = ["LICENSE", "Cargo.toml", "src/**/*.rs"] resolver = "2" members = [ "ast", "core", "format", "literal", "parser", + "ast-pyo3", "ruff_text_size", "ruff_source_location", ] diff --git a/ast-pyo3/Cargo.toml b/ast-pyo3/Cargo.toml new file mode 100644 index 00000000..c1394a4c --- /dev/null +++ b/ast-pyo3/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "rustpython-ast-pyo3" +version = "0.1.0" +edition = "2021" + +[features] +# This feature is experimental +# It reimplements AST types, but currently both slower than python AST types and limited to use in other API +wrapper = [] + +[dependencies] +rustpython-ast = { workspace = true, features = ["location"] } +num-complex = { workspace = true } +once_cell = { workspace = true } + +pyo3 = { workspace = true, features = ["num-bigint", "num-complex"] } diff --git a/ast-pyo3/src/gen/to_py_ast.rs b/ast-pyo3/src/gen/to_py_ast.rs new file mode 100644 index 00000000..16ccadb9 --- /dev/null +++ b/ast-pyo3/src/gen/to_py_ast.rs @@ -0,0 +1,4841 @@ +// File automatically generated by ast/asdl_rs.py. + +impl PyNode for ast::Mod { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ModModule { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ModInteractive { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ModExpression { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ModFunctionType { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Stmt { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtFunctionDef { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtAsyncFunctionDef { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtClassDef { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtReturn { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtDelete { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtAssign { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtAugAssign { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtAnnAssign { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtFor { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtAsyncFor { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtWhile { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtIf { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtWith { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtAsyncWith { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtMatch { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtRaise { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtTry { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtTryStar { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtAssert { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtImport { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtImportFrom { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtGlobal { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtNonlocal { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtExpr { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtPass { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtBreak { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::StmtContinue { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Expr { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprBoolOp { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprNamedExpr { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprBinOp { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprUnaryOp { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprLambda { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprIfExp { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprDict { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprSet { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprListComp { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprSetComp { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprDictComp { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprGeneratorExp { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprAwait { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprYield { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprYieldFrom { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprCompare { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprCall { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprFormattedValue { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprJoinedStr { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprConstant { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprAttribute { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprSubscript { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprStarred { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprName { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprList { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprTuple { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprSlice { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprContext { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprContextLoad { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprContextStore { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExprContextDel { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Boolop { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::BoolopAnd { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::BoolopOr { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Operator { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorAdd { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorSub { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorMult { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorMatMult { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorDiv { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorMod { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorPow { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorLShift { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorRShift { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorBitOr { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorBitXor { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorBitAnd { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::OperatorFloorDiv { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Unaryop { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::UnaryopInvert { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::UnaryopNot { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::UnaryopUAdd { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::UnaryopUSub { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Cmpop { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopEq { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopNotEq { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopLt { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopLtE { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopGt { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopGtE { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopIs { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopIsNot { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopIn { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::CmpopNotIn { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Comprehension { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Excepthandler { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::ExcepthandlerExceptHandler { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Arguments { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Arg { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Keyword { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Alias { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Withitem { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::MatchCase { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::Pattern { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::PatternMatchValue { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::PatternMatchSingleton { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::PatternMatchSequence { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::PatternMatchMapping { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::PatternMatchClass { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::PatternMatchStar { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::PatternMatchAs { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::PatternMatchOr { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::TypeIgnore { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl PyNode for ast::TypeIgnoreTypeIgnore { + #[inline] + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } +} + +impl ToPyAst for ast::ExprContext { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cell = match &self { + ast::ExprContext::Load => ast::ExprContextLoad::py_type_cache(), + ast::ExprContext::Store => ast::ExprContextStore::py_type_cache(), + ast::ExprContext::Del => ast::ExprContextDel::py_type_cache(), + }; + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) + } +} + +impl ToPyAst for ast::Boolop { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cell = match &self { + ast::Boolop::And => ast::BoolopAnd::py_type_cache(), + ast::Boolop::Or => ast::BoolopOr::py_type_cache(), + }; + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) + } +} + +impl ToPyAst for ast::Operator { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cell = match &self { + ast::Operator::Add => ast::OperatorAdd::py_type_cache(), + ast::Operator::Sub => ast::OperatorSub::py_type_cache(), + ast::Operator::Mult => ast::OperatorMult::py_type_cache(), + ast::Operator::MatMult => ast::OperatorMatMult::py_type_cache(), + ast::Operator::Div => ast::OperatorDiv::py_type_cache(), + ast::Operator::Mod => ast::OperatorMod::py_type_cache(), + ast::Operator::Pow => ast::OperatorPow::py_type_cache(), + ast::Operator::LShift => ast::OperatorLShift::py_type_cache(), + ast::Operator::RShift => ast::OperatorRShift::py_type_cache(), + ast::Operator::BitOr => ast::OperatorBitOr::py_type_cache(), + ast::Operator::BitXor => ast::OperatorBitXor::py_type_cache(), + ast::Operator::BitAnd => ast::OperatorBitAnd::py_type_cache(), + ast::Operator::FloorDiv => ast::OperatorFloorDiv::py_type_cache(), + }; + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) + } +} + +impl ToPyAst for ast::Unaryop { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cell = match &self { + ast::Unaryop::Invert => ast::UnaryopInvert::py_type_cache(), + ast::Unaryop::Not => ast::UnaryopNot::py_type_cache(), + ast::Unaryop::UAdd => ast::UnaryopUAdd::py_type_cache(), + ast::Unaryop::USub => ast::UnaryopUSub::py_type_cache(), + }; + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) + } +} + +impl ToPyAst for ast::Cmpop { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cell = match &self { + ast::Cmpop::Eq => ast::CmpopEq::py_type_cache(), + ast::Cmpop::NotEq => ast::CmpopNotEq::py_type_cache(), + ast::Cmpop::Lt => ast::CmpopLt::py_type_cache(), + ast::Cmpop::LtE => ast::CmpopLtE::py_type_cache(), + ast::Cmpop::Gt => ast::CmpopGt::py_type_cache(), + ast::Cmpop::GtE => ast::CmpopGtE::py_type_cache(), + ast::Cmpop::Is => ast::CmpopIs::py_type_cache(), + ast::Cmpop::IsNot => ast::CmpopIsNot::py_type_cache(), + ast::Cmpop::In => ast::CmpopIn::py_type_cache(), + ast::Cmpop::NotIn => ast::CmpopNotIn::py_type_cache(), + }; + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) + } +} + +impl ToPyAst for ast::Mod { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Mod::Module(cons) => cons.to_py_ast(py)?, + ast::Mod::Interactive(cons) => cons.to_py_ast(py)?, + ast::Mod::Expression(cons) => cons.to_py_ast(py)?, + ast::Mod::FunctionType(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::ModModule { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + type_ignores, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((body.to_py_ast(py)?, type_ignores.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ModInteractive { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((body.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ModExpression { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((body.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ModFunctionType { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + argtypes, + returns, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((argtypes.to_py_ast(py)?, returns.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Stmt { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Stmt::FunctionDef(cons) => cons.to_py_ast(py)?, + ast::Stmt::AsyncFunctionDef(cons) => cons.to_py_ast(py)?, + ast::Stmt::ClassDef(cons) => cons.to_py_ast(py)?, + ast::Stmt::Return(cons) => cons.to_py_ast(py)?, + ast::Stmt::Delete(cons) => cons.to_py_ast(py)?, + ast::Stmt::Assign(cons) => cons.to_py_ast(py)?, + ast::Stmt::AugAssign(cons) => cons.to_py_ast(py)?, + ast::Stmt::AnnAssign(cons) => cons.to_py_ast(py)?, + ast::Stmt::For(cons) => cons.to_py_ast(py)?, + ast::Stmt::AsyncFor(cons) => cons.to_py_ast(py)?, + ast::Stmt::While(cons) => cons.to_py_ast(py)?, + ast::Stmt::If(cons) => cons.to_py_ast(py)?, + ast::Stmt::With(cons) => cons.to_py_ast(py)?, + ast::Stmt::AsyncWith(cons) => cons.to_py_ast(py)?, + ast::Stmt::Match(cons) => cons.to_py_ast(py)?, + ast::Stmt::Raise(cons) => cons.to_py_ast(py)?, + ast::Stmt::Try(cons) => cons.to_py_ast(py)?, + ast::Stmt::TryStar(cons) => cons.to_py_ast(py)?, + ast::Stmt::Assert(cons) => cons.to_py_ast(py)?, + ast::Stmt::Import(cons) => cons.to_py_ast(py)?, + ast::Stmt::ImportFrom(cons) => cons.to_py_ast(py)?, + ast::Stmt::Global(cons) => cons.to_py_ast(py)?, + ast::Stmt::Nonlocal(cons) => cons.to_py_ast(py)?, + ast::Stmt::Expr(cons) => cons.to_py_ast(py)?, + ast::Stmt::Pass(cons) => cons.to_py_ast(py)?, + ast::Stmt::Break(cons) => cons.to_py_ast(py)?, + ast::Stmt::Continue(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::StmtFunctionDef { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + args, + body, + decorator_list, + returns, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + name.to_py_ast(py)?, + args.to_py_ast(py)?, + body.to_py_ast(py)?, + decorator_list.to_py_ast(py)?, + returns.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAsyncFunctionDef { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + args, + body, + decorator_list, + returns, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + name.to_py_ast(py)?, + args.to_py_ast(py)?, + body.to_py_ast(py)?, + decorator_list.to_py_ast(py)?, + returns.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtClassDef { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + bases, + keywords, + body, + decorator_list, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + name.to_py_ast(py)?, + bases.to_py_ast(py)?, + keywords.to_py_ast(py)?, + body.to_py_ast(py)?, + decorator_list.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtReturn { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtDelete { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + targets, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((targets.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAssign { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + targets, + value, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + targets.to_py_ast(py)?, + value.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAugAssign { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + op, + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + op.to_py_ast(py)?, + value.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAnnAssign { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + annotation, + value, + simple, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + annotation.to_py_ast(py)?, + value.to_py_ast(py)?, + simple.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtFor { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + iter, + body, + orelse, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + iter.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAsyncFor { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + iter, + body, + orelse, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + iter.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtWhile { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + test, + body, + orelse, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtIf { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + test, + body, + orelse, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtWith { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + items, + body, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + items.to_py_ast(py)?, + body.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAsyncWith { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + items, + body, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + items.to_py_ast(py)?, + body.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtMatch { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + subject, + cases, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((subject.to_py_ast(py)?, cases.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtRaise { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + exc, + cause, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((exc.to_py_ast(py)?, cause.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtTry { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + handlers, + orelse, + finalbody, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + body.to_py_ast(py)?, + handlers.to_py_ast(py)?, + orelse.to_py_ast(py)?, + finalbody.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtTryStar { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + handlers, + orelse, + finalbody, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + body.to_py_ast(py)?, + handlers.to_py_ast(py)?, + orelse.to_py_ast(py)?, + finalbody.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAssert { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + test, + msg, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((test.to_py_ast(py)?, msg.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtImport { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + names, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtImportFrom { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + module, + names, + level, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + module.to_py_ast(py)?, + names.to_py_ast(py)?, + level.map_or_else(|| py.None(), |level| level.to_u32().to_object(py)), + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtGlobal { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + names, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtNonlocal { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + names, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtExpr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtPass { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let instance = Py::::as_ref(&cache.0, py).call0()?; + let Self { range: _range } = self; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtBreak { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let instance = Py::::as_ref(&cache.0, py).call0()?; + let Self { range: _range } = self; + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtContinue { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let instance = Py::::as_ref(&cache.0, py).call0()?; + let Self { range: _range } = self; + + Ok(instance) + } +} + +impl ToPyAst for ast::Expr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Expr::BoolOp(cons) => cons.to_py_ast(py)?, + ast::Expr::NamedExpr(cons) => cons.to_py_ast(py)?, + ast::Expr::BinOp(cons) => cons.to_py_ast(py)?, + ast::Expr::UnaryOp(cons) => cons.to_py_ast(py)?, + ast::Expr::Lambda(cons) => cons.to_py_ast(py)?, + ast::Expr::IfExp(cons) => cons.to_py_ast(py)?, + ast::Expr::Dict(cons) => cons.to_py_ast(py)?, + ast::Expr::Set(cons) => cons.to_py_ast(py)?, + ast::Expr::ListComp(cons) => cons.to_py_ast(py)?, + ast::Expr::SetComp(cons) => cons.to_py_ast(py)?, + ast::Expr::DictComp(cons) => cons.to_py_ast(py)?, + ast::Expr::GeneratorExp(cons) => cons.to_py_ast(py)?, + ast::Expr::Await(cons) => cons.to_py_ast(py)?, + ast::Expr::Yield(cons) => cons.to_py_ast(py)?, + ast::Expr::YieldFrom(cons) => cons.to_py_ast(py)?, + ast::Expr::Compare(cons) => cons.to_py_ast(py)?, + ast::Expr::Call(cons) => cons.to_py_ast(py)?, + ast::Expr::FormattedValue(cons) => cons.to_py_ast(py)?, + ast::Expr::JoinedStr(cons) => cons.to_py_ast(py)?, + ast::Expr::Constant(cons) => cons.to_py_ast(py)?, + ast::Expr::Attribute(cons) => cons.to_py_ast(py)?, + ast::Expr::Subscript(cons) => cons.to_py_ast(py)?, + ast::Expr::Starred(cons) => cons.to_py_ast(py)?, + ast::Expr::Name(cons) => cons.to_py_ast(py)?, + ast::Expr::List(cons) => cons.to_py_ast(py)?, + ast::Expr::Tuple(cons) => cons.to_py_ast(py)?, + ast::Expr::Slice(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::ExprBoolOp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + op, + values, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((op.to_py_ast(py)?, values.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprNamedExpr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((target.to_py_ast(py)?, value.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprBinOp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + left, + op, + right, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + left.to_py_ast(py)?, + op.to_py_ast(py)?, + right.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprUnaryOp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + op, + operand, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((op.to_py_ast(py)?, operand.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprLambda { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + args, + body, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((args.to_py_ast(py)?, body.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprIfExp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + test, + body, + orelse, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprDict { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + keys, + values, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((keys.to_py_ast(py)?, values.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprSet { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elts, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprListComp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elt, + generators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprSetComp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elt, + generators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprDictComp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + key, + value, + generators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + key.to_py_ast(py)?, + value.to_py_ast(py)?, + generators.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprGeneratorExp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elt, + generators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprAwait { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprYield { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprYieldFrom { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprCompare { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + left, + ops, + comparators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + left.to_py_ast(py)?, + ops.to_py_ast(py)?, + comparators.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprCall { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + func, + args, + keywords, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + func.to_py_ast(py)?, + args.to_py_ast(py)?, + keywords.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprFormattedValue { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + conversion, + format_spec, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_py_ast(py)?, + conversion.to_py_ast(py)?, + format_spec.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprJoinedStr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + values, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((values.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprConstant { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + kind, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((constant_to_object(value, py), kind.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprAttribute { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + attr, + ctx, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_py_ast(py)?, + attr.to_py_ast(py)?, + ctx.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprSubscript { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + slice, + ctx, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_py_ast(py)?, + slice.to_py_ast(py)?, + ctx.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprStarred { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + ctx, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?, ctx.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprName { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + id, + ctx, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((id.to_py_ast(py)?, ctx.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprList { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elts, + ctx, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?, ctx.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprTuple { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elts, + ctx, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?, ctx.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprSlice { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + lower, + upper, + step, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + lower.to_py_ast(py)?, + upper.to_py_ast(py)?, + step.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Comprehension { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + iter, + ifs, + is_async, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + iter.to_py_ast(py)?, + ifs.to_py_ast(py)?, + is_async.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Excepthandler { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::ExcepthandlerExceptHandler { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + type_, + name, + body, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + type_.to_py_ast(py)?, + name.to_py_ast(py)?, + body.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Arguments { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + posonlyargs, + args, + vararg, + kwonlyargs, + kw_defaults, + kwarg, + defaults, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + posonlyargs.to_py_ast(py)?, + args.to_py_ast(py)?, + vararg.to_py_ast(py)?, + kwonlyargs.to_py_ast(py)?, + kw_defaults.to_py_ast(py)?, + kwarg.to_py_ast(py)?, + defaults.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Arg { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + arg, + annotation, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + arg.to_py_ast(py)?, + annotation.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Keyword { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + arg, + value, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((arg.to_py_ast(py)?, value.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Alias { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + asname, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((name.to_py_ast(py)?, asname.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Withitem { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + context_expr, + optional_vars, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((context_expr.to_py_ast(py)?, optional_vars.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::MatchCase { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + pattern, + guard, + body, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + pattern.to_py_ast(py)?, + guard.to_py_ast(py)?, + body.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Pattern { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Pattern::MatchValue(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchSingleton(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchSequence(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchMapping(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchClass(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchStar(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchAs(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchOr(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchValue { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchSingleton { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((constant_to_object(value, py),))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchSequence { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + patterns, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchMapping { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + keys, + patterns, + rest, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + keys.to_py_ast(py)?, + patterns.to_py_ast(py)?, + rest.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchClass { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + cls, + patterns, + kwd_attrs, + kwd_patterns, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + cls.to_py_ast(py)?, + patterns.to_py_ast(py)?, + kwd_attrs.to_py_ast(py)?, + kwd_patterns.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchStar { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((name.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchAs { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + pattern, + name, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((pattern.to_py_ast(py)?, name.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchOr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + patterns, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::TypeIgnore { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::TypeIgnore::TypeIgnore(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::TypeIgnoreTypeIgnore { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + lineno, + tag, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((lineno.to_u32().to_object(py), tag.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Mod { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Mod::Module(cons) => cons.to_py_ast(py)?, + ast::Mod::Interactive(cons) => cons.to_py_ast(py)?, + ast::Mod::Expression(cons) => cons.to_py_ast(py)?, + ast::Mod::FunctionType(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::ModModule { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + type_ignores, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((body.to_py_ast(py)?, type_ignores.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ModInteractive { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((body.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ModExpression { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((body.to_py_ast(py)?,))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::ModFunctionType { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + argtypes, + returns, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((argtypes.to_py_ast(py)?, returns.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Stmt { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Stmt::FunctionDef(cons) => cons.to_py_ast(py)?, + ast::Stmt::AsyncFunctionDef(cons) => cons.to_py_ast(py)?, + ast::Stmt::ClassDef(cons) => cons.to_py_ast(py)?, + ast::Stmt::Return(cons) => cons.to_py_ast(py)?, + ast::Stmt::Delete(cons) => cons.to_py_ast(py)?, + ast::Stmt::Assign(cons) => cons.to_py_ast(py)?, + ast::Stmt::AugAssign(cons) => cons.to_py_ast(py)?, + ast::Stmt::AnnAssign(cons) => cons.to_py_ast(py)?, + ast::Stmt::For(cons) => cons.to_py_ast(py)?, + ast::Stmt::AsyncFor(cons) => cons.to_py_ast(py)?, + ast::Stmt::While(cons) => cons.to_py_ast(py)?, + ast::Stmt::If(cons) => cons.to_py_ast(py)?, + ast::Stmt::With(cons) => cons.to_py_ast(py)?, + ast::Stmt::AsyncWith(cons) => cons.to_py_ast(py)?, + ast::Stmt::Match(cons) => cons.to_py_ast(py)?, + ast::Stmt::Raise(cons) => cons.to_py_ast(py)?, + ast::Stmt::Try(cons) => cons.to_py_ast(py)?, + ast::Stmt::TryStar(cons) => cons.to_py_ast(py)?, + ast::Stmt::Assert(cons) => cons.to_py_ast(py)?, + ast::Stmt::Import(cons) => cons.to_py_ast(py)?, + ast::Stmt::ImportFrom(cons) => cons.to_py_ast(py)?, + ast::Stmt::Global(cons) => cons.to_py_ast(py)?, + ast::Stmt::Nonlocal(cons) => cons.to_py_ast(py)?, + ast::Stmt::Expr(cons) => cons.to_py_ast(py)?, + ast::Stmt::Pass(cons) => cons.to_py_ast(py)?, + ast::Stmt::Break(cons) => cons.to_py_ast(py)?, + ast::Stmt::Continue(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::StmtFunctionDef { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + args, + body, + decorator_list, + returns, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + name.to_py_ast(py)?, + args.to_py_ast(py)?, + body.to_py_ast(py)?, + decorator_list.to_py_ast(py)?, + returns.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAsyncFunctionDef { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + args, + body, + decorator_list, + returns, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + name.to_py_ast(py)?, + args.to_py_ast(py)?, + body.to_py_ast(py)?, + decorator_list.to_py_ast(py)?, + returns.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtClassDef { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + bases, + keywords, + body, + decorator_list, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + name.to_py_ast(py)?, + bases.to_py_ast(py)?, + keywords.to_py_ast(py)?, + body.to_py_ast(py)?, + decorator_list.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtReturn { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtDelete { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + targets, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((targets.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAssign { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + targets, + value, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + targets.to_py_ast(py)?, + value.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAugAssign { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + op, + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + op.to_py_ast(py)?, + value.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAnnAssign { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + annotation, + value, + simple, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + annotation.to_py_ast(py)?, + value.to_py_ast(py)?, + simple.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtFor { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + iter, + body, + orelse, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + iter.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAsyncFor { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + iter, + body, + orelse, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + iter.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtWhile { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + test, + body, + orelse, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtIf { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + test, + body, + orelse, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtWith { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + items, + body, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + items.to_py_ast(py)?, + body.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAsyncWith { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + items, + body, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + items.to_py_ast(py)?, + body.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtMatch { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + subject, + cases, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((subject.to_py_ast(py)?, cases.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtRaise { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + exc, + cause, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((exc.to_py_ast(py)?, cause.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtTry { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + handlers, + orelse, + finalbody, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + body.to_py_ast(py)?, + handlers.to_py_ast(py)?, + orelse.to_py_ast(py)?, + finalbody.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtTryStar { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + body, + handlers, + orelse, + finalbody, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + body.to_py_ast(py)?, + handlers.to_py_ast(py)?, + orelse.to_py_ast(py)?, + finalbody.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtAssert { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + test, + msg, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((test.to_py_ast(py)?, msg.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtImport { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + names, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtImportFrom { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + module, + names, + level, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + module.to_py_ast(py)?, + names.to_py_ast(py)?, + level.map_or_else(|| py.None(), |level| level.to_u32().to_object(py)), + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtGlobal { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + names, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtNonlocal { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + names, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtExpr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtPass { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let instance = Py::::as_ref(&cache.0, py).call0()?; + let Self { range: _range } = self; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtBreak { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let instance = Py::::as_ref(&cache.0, py).call0()?; + let Self { range: _range } = self; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::StmtContinue { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let instance = Py::::as_ref(&cache.0, py).call0()?; + let Self { range: _range } = self; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::Expr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Expr::BoolOp(cons) => cons.to_py_ast(py)?, + ast::Expr::NamedExpr(cons) => cons.to_py_ast(py)?, + ast::Expr::BinOp(cons) => cons.to_py_ast(py)?, + ast::Expr::UnaryOp(cons) => cons.to_py_ast(py)?, + ast::Expr::Lambda(cons) => cons.to_py_ast(py)?, + ast::Expr::IfExp(cons) => cons.to_py_ast(py)?, + ast::Expr::Dict(cons) => cons.to_py_ast(py)?, + ast::Expr::Set(cons) => cons.to_py_ast(py)?, + ast::Expr::ListComp(cons) => cons.to_py_ast(py)?, + ast::Expr::SetComp(cons) => cons.to_py_ast(py)?, + ast::Expr::DictComp(cons) => cons.to_py_ast(py)?, + ast::Expr::GeneratorExp(cons) => cons.to_py_ast(py)?, + ast::Expr::Await(cons) => cons.to_py_ast(py)?, + ast::Expr::Yield(cons) => cons.to_py_ast(py)?, + ast::Expr::YieldFrom(cons) => cons.to_py_ast(py)?, + ast::Expr::Compare(cons) => cons.to_py_ast(py)?, + ast::Expr::Call(cons) => cons.to_py_ast(py)?, + ast::Expr::FormattedValue(cons) => cons.to_py_ast(py)?, + ast::Expr::JoinedStr(cons) => cons.to_py_ast(py)?, + ast::Expr::Constant(cons) => cons.to_py_ast(py)?, + ast::Expr::Attribute(cons) => cons.to_py_ast(py)?, + ast::Expr::Subscript(cons) => cons.to_py_ast(py)?, + ast::Expr::Starred(cons) => cons.to_py_ast(py)?, + ast::Expr::Name(cons) => cons.to_py_ast(py)?, + ast::Expr::List(cons) => cons.to_py_ast(py)?, + ast::Expr::Tuple(cons) => cons.to_py_ast(py)?, + ast::Expr::Slice(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::ExprBoolOp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + op, + values, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((op.to_py_ast(py)?, values.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprNamedExpr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((target.to_py_ast(py)?, value.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprBinOp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + left, + op, + right, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + left.to_py_ast(py)?, + op.to_py_ast(py)?, + right.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprUnaryOp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + op, + operand, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((op.to_py_ast(py)?, operand.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprLambda { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + args, + body, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((args.to_py_ast(py)?, body.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprIfExp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + test, + body, + orelse, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprDict { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + keys, + values, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((keys.to_py_ast(py)?, values.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprSet { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elts, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprListComp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elt, + generators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprSetComp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elt, + generators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprDictComp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + key, + value, + generators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + key.to_py_ast(py)?, + value.to_py_ast(py)?, + generators.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprGeneratorExp { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elt, + generators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprAwait { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprYield { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprYieldFrom { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprCompare { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + left, + ops, + comparators, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + left.to_py_ast(py)?, + ops.to_py_ast(py)?, + comparators.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprCall { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + func, + args, + keywords, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + func.to_py_ast(py)?, + args.to_py_ast(py)?, + keywords.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprFormattedValue { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + conversion, + format_spec, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_py_ast(py)?, + conversion.to_py_ast(py)?, + format_spec.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprJoinedStr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + values, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((values.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprConstant { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + kind, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((constant_to_object(value, py), kind.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprAttribute { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + attr, + ctx, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_py_ast(py)?, + attr.to_py_ast(py)?, + ctx.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprSubscript { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + slice, + ctx, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_py_ast(py)?, + slice.to_py_ast(py)?, + ctx.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprStarred { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + ctx, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?, ctx.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprName { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + id, + ctx, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((id.to_py_ast(py)?, ctx.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprList { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elts, + ctx, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?, ctx.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprTuple { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + elts, + ctx, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?, ctx.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::ExprSlice { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + lower, + upper, + step, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + lower.to_py_ast(py)?, + upper.to_py_ast(py)?, + step.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::Comprehension { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + target, + iter, + ifs, + is_async, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_py_ast(py)?, + iter.to_py_ast(py)?, + ifs.to_py_ast(py)?, + is_async.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Excepthandler { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::ExcepthandlerExceptHandler { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + type_, + name, + body, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + type_.to_py_ast(py)?, + name.to_py_ast(py)?, + body.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::Arguments { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + posonlyargs, + args, + vararg, + kwonlyargs, + kw_defaults, + kwarg, + defaults, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + posonlyargs.to_py_ast(py)?, + args.to_py_ast(py)?, + vararg.to_py_ast(py)?, + kwonlyargs.to_py_ast(py)?, + kw_defaults.to_py_ast(py)?, + kwarg.to_py_ast(py)?, + defaults.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Arg { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + arg, + annotation, + type_comment, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + arg.to_py_ast(py)?, + annotation.to_py_ast(py)?, + type_comment.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::Keyword { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + arg, + value, + range: _range, + } = self; + + let instance = + Py::::as_ref(&cache.0, py).call1((arg.to_py_ast(py)?, value.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::Alias { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + asname, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((name.to_py_ast(py)?, asname.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::Withitem { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + context_expr, + optional_vars, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((context_expr.to_py_ast(py)?, optional_vars.to_py_ast(py)?))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::MatchCase { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + pattern, + guard, + body, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + pattern.to_py_ast(py)?, + guard.to_py_ast(py)?, + body.to_py_ast(py)?, + ))?; + + Ok(instance) + } +} + +impl ToPyAst for ast::Pattern { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::Pattern::MatchValue(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchSingleton(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchSequence(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchMapping(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchClass(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchStar(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchAs(cons) => cons.to_py_ast(py)?, + ast::Pattern::MatchOr(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchValue { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchSingleton { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + value, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((constant_to_object(value, py),))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchSequence { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + patterns, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchMapping { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + keys, + patterns, + rest, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + keys.to_py_ast(py)?, + patterns.to_py_ast(py)?, + rest.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchClass { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + cls, + patterns, + kwd_attrs, + kwd_patterns, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1(( + cls.to_py_ast(py)?, + patterns.to_py_ast(py)?, + kwd_attrs.to_py_ast(py)?, + kwd_patterns.to_py_ast(py)?, + ))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchStar { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + name, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((name.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchAs { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + pattern, + name, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((pattern.to_py_ast(py)?, name.to_py_ast(py)?))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::PatternMatchOr { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + patterns, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_py_ast(py)?,))?; + + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; + if let Some(end) = _range.end { + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; + } + + Ok(instance) + } +} + +impl ToPyAst for ast::TypeIgnore { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let instance = match &self { + ast::TypeIgnore::TypeIgnore(cons) => cons.to_py_ast(py)?, + }; + Ok(instance) + } +} + +impl ToPyAst for ast::TypeIgnoreTypeIgnore { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let cache = Self::py_type_cache().get().unwrap(); + + let Self { + lineno, + tag, + range: _range, + } = self; + + let instance = Py::::as_ref(&cache.0, py) + .call1((lineno.to_u32().to_object(py), tag.to_py_ast(py)?))?; + + Ok(instance) + } +} + +fn init_types(py: Python) -> PyResult<()> { + let ast_module = PyModule::import(py, "_ast")?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + Ok(()) +} diff --git a/ast/src/gen/pyo3_wrapper_located.rs b/ast-pyo3/src/gen/wrapper_located.rs similarity index 54% rename from ast/src/gen/pyo3_wrapper_located.rs rename to ast-pyo3/src/gen/wrapper_located.rs index ba55ee24..1f4e0d6d 100644 --- a/ast/src/gen/pyo3_wrapper_located.rs +++ b/ast-pyo3/src/gen/wrapper_located.rs @@ -1,11 +1,11 @@ // File automatically generated by ast/asdl_rs.py. -#[pyclass(module="rustpython_ast.located", name="_mod", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_mod", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Mod; -impl From<&'static crate::Mod> for Mod { - fn from(_node: &'static crate::Mod) -> Self { +impl From<&'static ast::Mod> for Mod { + fn from(_node: &'static ast::Mod) -> Self { Mod } } @@ -14,7 +14,7 @@ impl From<&'static crate::Mod> for Mod { impl Mod { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Mod { @@ -24,40 +24,40 @@ impl ToPyObject for Mod { } } -impl ToPyo3Wrapper for crate::Mod { +impl ToPyWrapper for ast::Mod { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::Module(cons) => cons.to_pyo3_wrapper(py), - Self::Interactive(cons) => cons.to_pyo3_wrapper(py), - Self::Expression(cons) => cons.to_pyo3_wrapper(py), - Self::FunctionType(cons) => cons.to_pyo3_wrapper(py), + Self::Module(cons) => cons.to_py_wrapper(py), + Self::Interactive(cons) => cons.to_py_wrapper(py), + Self::Expression(cons) => cons.to_py_wrapper(py), + Self::FunctionType(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.located", name="_Module", extends=Mod, frozen)] #[derive(Clone, Debug)] -pub struct ModModule(pub &'static crate::ModModule); +pub struct ModModule(pub &'static ast::ModModule); -impl From<&'static crate::ModModule> for ModModule { - fn from(node: &'static crate::ModModule) -> Self { +impl From<&'static ast::ModModule> for ModModule { + fn from(node: &'static ast::ModModule) -> Self { ModModule(node) } } impl ToPyObject for ModModule { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Mod) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ModModule { +impl ToPyWrapper for ast::ModModule { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ModModule(self).to_object(py)) } } @@ -67,38 +67,38 @@ impl ModModule { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_type_ignores(&self, py: Python) -> PyResult { - self.0.type_ignores.to_pyo3_wrapper(py) + self.0.type_ignores.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Interactive", extends=Mod, frozen)] #[derive(Clone, Debug)] -pub struct ModInteractive(pub &'static crate::ModInteractive); +pub struct ModInteractive(pub &'static ast::ModInteractive); -impl From<&'static crate::ModInteractive> for ModInteractive { - fn from(node: &'static crate::ModInteractive) -> Self { +impl From<&'static ast::ModInteractive> for ModInteractive { + fn from(node: &'static ast::ModInteractive) -> Self { ModInteractive(node) } } impl ToPyObject for ModInteractive { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Mod) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ModInteractive { +impl ToPyWrapper for ast::ModInteractive { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ModInteractive(self).to_object(py)) } } @@ -108,32 +108,32 @@ impl ModInteractive { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Expression", extends=Mod, frozen)] #[derive(Clone, Debug)] -pub struct ModExpression(pub &'static crate::ModExpression); +pub struct ModExpression(pub &'static ast::ModExpression); -impl From<&'static crate::ModExpression> for ModExpression { - fn from(node: &'static crate::ModExpression) -> Self { +impl From<&'static ast::ModExpression> for ModExpression { + fn from(node: &'static ast::ModExpression) -> Self { ModExpression(node) } } impl ToPyObject for ModExpression { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Mod) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ModExpression { +impl ToPyWrapper for ast::ModExpression { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ModExpression(self).to_object(py)) } } @@ -143,32 +143,32 @@ impl ModExpression { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_FunctionType", extends=Mod, frozen)] #[derive(Clone, Debug)] -pub struct ModFunctionType(pub &'static crate::ModFunctionType); +pub struct ModFunctionType(pub &'static ast::ModFunctionType); -impl From<&'static crate::ModFunctionType> for ModFunctionType { - fn from(node: &'static crate::ModFunctionType) -> Self { +impl From<&'static ast::ModFunctionType> for ModFunctionType { + fn from(node: &'static ast::ModFunctionType) -> Self { ModFunctionType(node) } } impl ToPyObject for ModFunctionType { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Mod) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ModFunctionType { +impl ToPyWrapper for ast::ModFunctionType { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ModFunctionType(self).to_object(py)) } } @@ -178,22 +178,22 @@ impl ModFunctionType { #[getter] #[inline] fn get_argtypes(&self, py: Python) -> PyResult { - self.0.argtypes.to_pyo3_wrapper(py) + self.0.argtypes.to_py_wrapper(py) } #[getter] #[inline] fn get_returns(&self, py: Python) -> PyResult { - self.0.returns.to_pyo3_wrapper(py) + self.0.returns.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_stmt", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_stmt", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Stmt; -impl From<&'static crate::Stmt> for Stmt { - fn from(_node: &'static crate::Stmt) -> Self { +impl From<&'static ast::Stmt> for Stmt { + fn from(_node: &'static ast::Stmt) -> Self { Stmt } } @@ -202,7 +202,7 @@ impl From<&'static crate::Stmt> for Stmt { impl Stmt { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Stmt { @@ -212,63 +212,63 @@ impl ToPyObject for Stmt { } } -impl ToPyo3Wrapper for crate::Stmt { +impl ToPyWrapper for ast::Stmt { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::FunctionDef(cons) => cons.to_pyo3_wrapper(py), - Self::AsyncFunctionDef(cons) => cons.to_pyo3_wrapper(py), - Self::ClassDef(cons) => cons.to_pyo3_wrapper(py), - Self::Return(cons) => cons.to_pyo3_wrapper(py), - Self::Delete(cons) => cons.to_pyo3_wrapper(py), - Self::Assign(cons) => cons.to_pyo3_wrapper(py), - Self::AugAssign(cons) => cons.to_pyo3_wrapper(py), - Self::AnnAssign(cons) => cons.to_pyo3_wrapper(py), - Self::For(cons) => cons.to_pyo3_wrapper(py), - Self::AsyncFor(cons) => cons.to_pyo3_wrapper(py), - Self::While(cons) => cons.to_pyo3_wrapper(py), - Self::If(cons) => cons.to_pyo3_wrapper(py), - Self::With(cons) => cons.to_pyo3_wrapper(py), - Self::AsyncWith(cons) => cons.to_pyo3_wrapper(py), - Self::Match(cons) => cons.to_pyo3_wrapper(py), - Self::Raise(cons) => cons.to_pyo3_wrapper(py), - Self::Try(cons) => cons.to_pyo3_wrapper(py), - Self::TryStar(cons) => cons.to_pyo3_wrapper(py), - Self::Assert(cons) => cons.to_pyo3_wrapper(py), - Self::Import(cons) => cons.to_pyo3_wrapper(py), - Self::ImportFrom(cons) => cons.to_pyo3_wrapper(py), - Self::Global(cons) => cons.to_pyo3_wrapper(py), - Self::Nonlocal(cons) => cons.to_pyo3_wrapper(py), - Self::Expr(cons) => cons.to_pyo3_wrapper(py), - Self::Pass(cons) => cons.to_pyo3_wrapper(py), - Self::Break(cons) => cons.to_pyo3_wrapper(py), - Self::Continue(cons) => cons.to_pyo3_wrapper(py), + Self::FunctionDef(cons) => cons.to_py_wrapper(py), + Self::AsyncFunctionDef(cons) => cons.to_py_wrapper(py), + Self::ClassDef(cons) => cons.to_py_wrapper(py), + Self::Return(cons) => cons.to_py_wrapper(py), + Self::Delete(cons) => cons.to_py_wrapper(py), + Self::Assign(cons) => cons.to_py_wrapper(py), + Self::AugAssign(cons) => cons.to_py_wrapper(py), + Self::AnnAssign(cons) => cons.to_py_wrapper(py), + Self::For(cons) => cons.to_py_wrapper(py), + Self::AsyncFor(cons) => cons.to_py_wrapper(py), + Self::While(cons) => cons.to_py_wrapper(py), + Self::If(cons) => cons.to_py_wrapper(py), + Self::With(cons) => cons.to_py_wrapper(py), + Self::AsyncWith(cons) => cons.to_py_wrapper(py), + Self::Match(cons) => cons.to_py_wrapper(py), + Self::Raise(cons) => cons.to_py_wrapper(py), + Self::Try(cons) => cons.to_py_wrapper(py), + Self::TryStar(cons) => cons.to_py_wrapper(py), + Self::Assert(cons) => cons.to_py_wrapper(py), + Self::Import(cons) => cons.to_py_wrapper(py), + Self::ImportFrom(cons) => cons.to_py_wrapper(py), + Self::Global(cons) => cons.to_py_wrapper(py), + Self::Nonlocal(cons) => cons.to_py_wrapper(py), + Self::Expr(cons) => cons.to_py_wrapper(py), + Self::Pass(cons) => cons.to_py_wrapper(py), + Self::Break(cons) => cons.to_py_wrapper(py), + Self::Continue(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.located", name="_FunctionDef", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtFunctionDef(pub &'static crate::StmtFunctionDef); +pub struct StmtFunctionDef(pub &'static ast::StmtFunctionDef); -impl From<&'static crate::StmtFunctionDef> for StmtFunctionDef { - fn from(node: &'static crate::StmtFunctionDef) -> Self { +impl From<&'static ast::StmtFunctionDef> for StmtFunctionDef { + fn from(node: &'static ast::StmtFunctionDef) -> Self { StmtFunctionDef(node) } } impl ToPyObject for StmtFunctionDef { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtFunctionDef { +impl ToPyWrapper for ast::StmtFunctionDef { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtFunctionDef(self).to_object(py)) } } @@ -278,62 +278,62 @@ impl StmtFunctionDef { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_decorator_list(&self, py: Python) -> PyResult { - self.0.decorator_list.to_pyo3_wrapper(py) + self.0.decorator_list.to_py_wrapper(py) } #[getter] #[inline] fn get_returns(&self, py: Python) -> PyResult { - self.0.returns.to_pyo3_wrapper(py) + self.0.returns.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_AsyncFunctionDef", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAsyncFunctionDef(pub &'static crate::StmtAsyncFunctionDef); +pub struct StmtAsyncFunctionDef(pub &'static ast::StmtAsyncFunctionDef); -impl From<&'static crate::StmtAsyncFunctionDef> for StmtAsyncFunctionDef { - fn from(node: &'static crate::StmtAsyncFunctionDef) -> Self { +impl From<&'static ast::StmtAsyncFunctionDef> for StmtAsyncFunctionDef { + fn from(node: &'static ast::StmtAsyncFunctionDef) -> Self { StmtAsyncFunctionDef(node) } } impl ToPyObject for StmtAsyncFunctionDef { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAsyncFunctionDef { +impl ToPyWrapper for ast::StmtAsyncFunctionDef { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAsyncFunctionDef(self).to_object(py)) } } @@ -343,62 +343,62 @@ impl StmtAsyncFunctionDef { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_decorator_list(&self, py: Python) -> PyResult { - self.0.decorator_list.to_pyo3_wrapper(py) + self.0.decorator_list.to_py_wrapper(py) } #[getter] #[inline] fn get_returns(&self, py: Python) -> PyResult { - self.0.returns.to_pyo3_wrapper(py) + self.0.returns.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_ClassDef", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtClassDef(pub &'static crate::StmtClassDef); +pub struct StmtClassDef(pub &'static ast::StmtClassDef); -impl From<&'static crate::StmtClassDef> for StmtClassDef { - fn from(node: &'static crate::StmtClassDef) -> Self { +impl From<&'static ast::StmtClassDef> for StmtClassDef { + fn from(node: &'static ast::StmtClassDef) -> Self { StmtClassDef(node) } } impl ToPyObject for StmtClassDef { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtClassDef { +impl ToPyWrapper for ast::StmtClassDef { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtClassDef(self).to_object(py)) } } @@ -408,56 +408,56 @@ impl StmtClassDef { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_bases(&self, py: Python) -> PyResult { - self.0.bases.to_pyo3_wrapper(py) + self.0.bases.to_py_wrapper(py) } #[getter] #[inline] fn get_keywords(&self, py: Python) -> PyResult { - self.0.keywords.to_pyo3_wrapper(py) + self.0.keywords.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_decorator_list(&self, py: Python) -> PyResult { - self.0.decorator_list.to_pyo3_wrapper(py) + self.0.decorator_list.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Return", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtReturn(pub &'static crate::StmtReturn); +pub struct StmtReturn(pub &'static ast::StmtReturn); -impl From<&'static crate::StmtReturn> for StmtReturn { - fn from(node: &'static crate::StmtReturn) -> Self { +impl From<&'static ast::StmtReturn> for StmtReturn { + fn from(node: &'static ast::StmtReturn) -> Self { StmtReturn(node) } } impl ToPyObject for StmtReturn { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtReturn { +impl ToPyWrapper for ast::StmtReturn { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtReturn(self).to_object(py)) } } @@ -467,32 +467,32 @@ impl StmtReturn { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Delete", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtDelete(pub &'static crate::StmtDelete); +pub struct StmtDelete(pub &'static ast::StmtDelete); -impl From<&'static crate::StmtDelete> for StmtDelete { - fn from(node: &'static crate::StmtDelete) -> Self { +impl From<&'static ast::StmtDelete> for StmtDelete { + fn from(node: &'static ast::StmtDelete) -> Self { StmtDelete(node) } } impl ToPyObject for StmtDelete { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtDelete { +impl ToPyWrapper for ast::StmtDelete { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtDelete(self).to_object(py)) } } @@ -502,32 +502,32 @@ impl StmtDelete { #[getter] #[inline] fn get_targets(&self, py: Python) -> PyResult { - self.0.targets.to_pyo3_wrapper(py) + self.0.targets.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Assign", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAssign(pub &'static crate::StmtAssign); +pub struct StmtAssign(pub &'static ast::StmtAssign); -impl From<&'static crate::StmtAssign> for StmtAssign { - fn from(node: &'static crate::StmtAssign) -> Self { +impl From<&'static ast::StmtAssign> for StmtAssign { + fn from(node: &'static ast::StmtAssign) -> Self { StmtAssign(node) } } impl ToPyObject for StmtAssign { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAssign { +impl ToPyWrapper for ast::StmtAssign { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAssign(self).to_object(py)) } } @@ -537,44 +537,44 @@ impl StmtAssign { #[getter] #[inline] fn get_targets(&self, py: Python) -> PyResult { - self.0.targets.to_pyo3_wrapper(py) + self.0.targets.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_AugAssign", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAugAssign(pub &'static crate::StmtAugAssign); +pub struct StmtAugAssign(pub &'static ast::StmtAugAssign); -impl From<&'static crate::StmtAugAssign> for StmtAugAssign { - fn from(node: &'static crate::StmtAugAssign) -> Self { +impl From<&'static ast::StmtAugAssign> for StmtAugAssign { + fn from(node: &'static ast::StmtAugAssign) -> Self { StmtAugAssign(node) } } impl ToPyObject for StmtAugAssign { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAugAssign { +impl ToPyWrapper for ast::StmtAugAssign { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAugAssign(self).to_object(py)) } } @@ -584,44 +584,44 @@ impl StmtAugAssign { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_op(&self, py: Python) -> PyResult { - self.0.op.to_pyo3_wrapper(py) + self.0.op.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_AnnAssign", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAnnAssign(pub &'static crate::StmtAnnAssign); +pub struct StmtAnnAssign(pub &'static ast::StmtAnnAssign); -impl From<&'static crate::StmtAnnAssign> for StmtAnnAssign { - fn from(node: &'static crate::StmtAnnAssign) -> Self { +impl From<&'static ast::StmtAnnAssign> for StmtAnnAssign { + fn from(node: &'static ast::StmtAnnAssign) -> Self { StmtAnnAssign(node) } } impl ToPyObject for StmtAnnAssign { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAnnAssign { +impl ToPyWrapper for ast::StmtAnnAssign { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAnnAssign(self).to_object(py)) } } @@ -631,50 +631,50 @@ impl StmtAnnAssign { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_annotation(&self, py: Python) -> PyResult { - self.0.annotation.to_pyo3_wrapper(py) + self.0.annotation.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_simple(&self, py: Python) -> PyResult { - self.0.simple.to_pyo3_wrapper(py) + self.0.simple.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_For", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtFor(pub &'static crate::StmtFor); +pub struct StmtFor(pub &'static ast::StmtFor); -impl From<&'static crate::StmtFor> for StmtFor { - fn from(node: &'static crate::StmtFor) -> Self { +impl From<&'static ast::StmtFor> for StmtFor { + fn from(node: &'static ast::StmtFor) -> Self { StmtFor(node) } } impl ToPyObject for StmtFor { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtFor { +impl ToPyWrapper for ast::StmtFor { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtFor(self).to_object(py)) } } @@ -684,56 +684,56 @@ impl StmtFor { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_iter(&self, py: Python) -> PyResult { - self.0.iter.to_pyo3_wrapper(py) + self.0.iter.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_AsyncFor", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAsyncFor(pub &'static crate::StmtAsyncFor); +pub struct StmtAsyncFor(pub &'static ast::StmtAsyncFor); -impl From<&'static crate::StmtAsyncFor> for StmtAsyncFor { - fn from(node: &'static crate::StmtAsyncFor) -> Self { +impl From<&'static ast::StmtAsyncFor> for StmtAsyncFor { + fn from(node: &'static ast::StmtAsyncFor) -> Self { StmtAsyncFor(node) } } impl ToPyObject for StmtAsyncFor { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAsyncFor { +impl ToPyWrapper for ast::StmtAsyncFor { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAsyncFor(self).to_object(py)) } } @@ -743,56 +743,56 @@ impl StmtAsyncFor { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_iter(&self, py: Python) -> PyResult { - self.0.iter.to_pyo3_wrapper(py) + self.0.iter.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_While", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtWhile(pub &'static crate::StmtWhile); +pub struct StmtWhile(pub &'static ast::StmtWhile); -impl From<&'static crate::StmtWhile> for StmtWhile { - fn from(node: &'static crate::StmtWhile) -> Self { +impl From<&'static ast::StmtWhile> for StmtWhile { + fn from(node: &'static ast::StmtWhile) -> Self { StmtWhile(node) } } impl ToPyObject for StmtWhile { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtWhile { +impl ToPyWrapper for ast::StmtWhile { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtWhile(self).to_object(py)) } } @@ -802,44 +802,44 @@ impl StmtWhile { #[getter] #[inline] fn get_test(&self, py: Python) -> PyResult { - self.0.test.to_pyo3_wrapper(py) + self.0.test.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_If", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtIf(pub &'static crate::StmtIf); +pub struct StmtIf(pub &'static ast::StmtIf); -impl From<&'static crate::StmtIf> for StmtIf { - fn from(node: &'static crate::StmtIf) -> Self { +impl From<&'static ast::StmtIf> for StmtIf { + fn from(node: &'static ast::StmtIf) -> Self { StmtIf(node) } } impl ToPyObject for StmtIf { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtIf { +impl ToPyWrapper for ast::StmtIf { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtIf(self).to_object(py)) } } @@ -849,44 +849,44 @@ impl StmtIf { #[getter] #[inline] fn get_test(&self, py: Python) -> PyResult { - self.0.test.to_pyo3_wrapper(py) + self.0.test.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_With", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtWith(pub &'static crate::StmtWith); +pub struct StmtWith(pub &'static ast::StmtWith); -impl From<&'static crate::StmtWith> for StmtWith { - fn from(node: &'static crate::StmtWith) -> Self { +impl From<&'static ast::StmtWith> for StmtWith { + fn from(node: &'static ast::StmtWith) -> Self { StmtWith(node) } } impl ToPyObject for StmtWith { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtWith { +impl ToPyWrapper for ast::StmtWith { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtWith(self).to_object(py)) } } @@ -896,44 +896,44 @@ impl StmtWith { #[getter] #[inline] fn get_items(&self, py: Python) -> PyResult { - self.0.items.to_pyo3_wrapper(py) + self.0.items.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_AsyncWith", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAsyncWith(pub &'static crate::StmtAsyncWith); +pub struct StmtAsyncWith(pub &'static ast::StmtAsyncWith); -impl From<&'static crate::StmtAsyncWith> for StmtAsyncWith { - fn from(node: &'static crate::StmtAsyncWith) -> Self { +impl From<&'static ast::StmtAsyncWith> for StmtAsyncWith { + fn from(node: &'static ast::StmtAsyncWith) -> Self { StmtAsyncWith(node) } } impl ToPyObject for StmtAsyncWith { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAsyncWith { +impl ToPyWrapper for ast::StmtAsyncWith { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAsyncWith(self).to_object(py)) } } @@ -943,44 +943,44 @@ impl StmtAsyncWith { #[getter] #[inline] fn get_items(&self, py: Python) -> PyResult { - self.0.items.to_pyo3_wrapper(py) + self.0.items.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Match", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtMatch(pub &'static crate::StmtMatch); +pub struct StmtMatch(pub &'static ast::StmtMatch); -impl From<&'static crate::StmtMatch> for StmtMatch { - fn from(node: &'static crate::StmtMatch) -> Self { +impl From<&'static ast::StmtMatch> for StmtMatch { + fn from(node: &'static ast::StmtMatch) -> Self { StmtMatch(node) } } impl ToPyObject for StmtMatch { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtMatch { +impl ToPyWrapper for ast::StmtMatch { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtMatch(self).to_object(py)) } } @@ -990,38 +990,38 @@ impl StmtMatch { #[getter] #[inline] fn get_subject(&self, py: Python) -> PyResult { - self.0.subject.to_pyo3_wrapper(py) + self.0.subject.to_py_wrapper(py) } #[getter] #[inline] fn get_cases(&self, py: Python) -> PyResult { - self.0.cases.to_pyo3_wrapper(py) + self.0.cases.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Raise", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtRaise(pub &'static crate::StmtRaise); +pub struct StmtRaise(pub &'static ast::StmtRaise); -impl From<&'static crate::StmtRaise> for StmtRaise { - fn from(node: &'static crate::StmtRaise) -> Self { +impl From<&'static ast::StmtRaise> for StmtRaise { + fn from(node: &'static ast::StmtRaise) -> Self { StmtRaise(node) } } impl ToPyObject for StmtRaise { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtRaise { +impl ToPyWrapper for ast::StmtRaise { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtRaise(self).to_object(py)) } } @@ -1031,38 +1031,38 @@ impl StmtRaise { #[getter] #[inline] fn get_exc(&self, py: Python) -> PyResult { - self.0.exc.to_pyo3_wrapper(py) + self.0.exc.to_py_wrapper(py) } #[getter] #[inline] fn get_cause(&self, py: Python) -> PyResult { - self.0.cause.to_pyo3_wrapper(py) + self.0.cause.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Try", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtTry(pub &'static crate::StmtTry); +pub struct StmtTry(pub &'static ast::StmtTry); -impl From<&'static crate::StmtTry> for StmtTry { - fn from(node: &'static crate::StmtTry) -> Self { +impl From<&'static ast::StmtTry> for StmtTry { + fn from(node: &'static ast::StmtTry) -> Self { StmtTry(node) } } impl ToPyObject for StmtTry { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtTry { +impl ToPyWrapper for ast::StmtTry { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtTry(self).to_object(py)) } } @@ -1072,50 +1072,50 @@ impl StmtTry { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_handlers(&self, py: Python) -> PyResult { - self.0.handlers.to_pyo3_wrapper(py) + self.0.handlers.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } #[getter] #[inline] fn get_finalbody(&self, py: Python) -> PyResult { - self.0.finalbody.to_pyo3_wrapper(py) + self.0.finalbody.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_TryStar", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtTryStar(pub &'static crate::StmtTryStar); +pub struct StmtTryStar(pub &'static ast::StmtTryStar); -impl From<&'static crate::StmtTryStar> for StmtTryStar { - fn from(node: &'static crate::StmtTryStar) -> Self { +impl From<&'static ast::StmtTryStar> for StmtTryStar { + fn from(node: &'static ast::StmtTryStar) -> Self { StmtTryStar(node) } } impl ToPyObject for StmtTryStar { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtTryStar { +impl ToPyWrapper for ast::StmtTryStar { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtTryStar(self).to_object(py)) } } @@ -1125,50 +1125,50 @@ impl StmtTryStar { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_handlers(&self, py: Python) -> PyResult { - self.0.handlers.to_pyo3_wrapper(py) + self.0.handlers.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } #[getter] #[inline] fn get_finalbody(&self, py: Python) -> PyResult { - self.0.finalbody.to_pyo3_wrapper(py) + self.0.finalbody.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Assert", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAssert(pub &'static crate::StmtAssert); +pub struct StmtAssert(pub &'static ast::StmtAssert); -impl From<&'static crate::StmtAssert> for StmtAssert { - fn from(node: &'static crate::StmtAssert) -> Self { +impl From<&'static ast::StmtAssert> for StmtAssert { + fn from(node: &'static ast::StmtAssert) -> Self { StmtAssert(node) } } impl ToPyObject for StmtAssert { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAssert { +impl ToPyWrapper for ast::StmtAssert { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAssert(self).to_object(py)) } } @@ -1178,38 +1178,38 @@ impl StmtAssert { #[getter] #[inline] fn get_test(&self, py: Python) -> PyResult { - self.0.test.to_pyo3_wrapper(py) + self.0.test.to_py_wrapper(py) } #[getter] #[inline] fn get_msg(&self, py: Python) -> PyResult { - self.0.msg.to_pyo3_wrapper(py) + self.0.msg.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Import", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtImport(pub &'static crate::StmtImport); +pub struct StmtImport(pub &'static ast::StmtImport); -impl From<&'static crate::StmtImport> for StmtImport { - fn from(node: &'static crate::StmtImport) -> Self { +impl From<&'static ast::StmtImport> for StmtImport { + fn from(node: &'static ast::StmtImport) -> Self { StmtImport(node) } } impl ToPyObject for StmtImport { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtImport { +impl ToPyWrapper for ast::StmtImport { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtImport(self).to_object(py)) } } @@ -1219,32 +1219,32 @@ impl StmtImport { #[getter] #[inline] fn get_names(&self, py: Python) -> PyResult { - self.0.names.to_pyo3_wrapper(py) + self.0.names.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_ImportFrom", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtImportFrom(pub &'static crate::StmtImportFrom); +pub struct StmtImportFrom(pub &'static ast::StmtImportFrom); -impl From<&'static crate::StmtImportFrom> for StmtImportFrom { - fn from(node: &'static crate::StmtImportFrom) -> Self { +impl From<&'static ast::StmtImportFrom> for StmtImportFrom { + fn from(node: &'static ast::StmtImportFrom) -> Self { StmtImportFrom(node) } } impl ToPyObject for StmtImportFrom { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtImportFrom { +impl ToPyWrapper for ast::StmtImportFrom { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtImportFrom(self).to_object(py)) } } @@ -1254,44 +1254,44 @@ impl StmtImportFrom { #[getter] #[inline] fn get_module(&self, py: Python) -> PyResult { - self.0.module.to_pyo3_wrapper(py) + self.0.module.to_py_wrapper(py) } #[getter] #[inline] fn get_names(&self, py: Python) -> PyResult { - self.0.names.to_pyo3_wrapper(py) + self.0.names.to_py_wrapper(py) } #[getter] #[inline] fn get_level(&self, py: Python) -> PyResult { - self.0.level.to_pyo3_wrapper(py) + self.0.level.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Global", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtGlobal(pub &'static crate::StmtGlobal); +pub struct StmtGlobal(pub &'static ast::StmtGlobal); -impl From<&'static crate::StmtGlobal> for StmtGlobal { - fn from(node: &'static crate::StmtGlobal) -> Self { +impl From<&'static ast::StmtGlobal> for StmtGlobal { + fn from(node: &'static ast::StmtGlobal) -> Self { StmtGlobal(node) } } impl ToPyObject for StmtGlobal { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtGlobal { +impl ToPyWrapper for ast::StmtGlobal { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtGlobal(self).to_object(py)) } } @@ -1301,32 +1301,32 @@ impl StmtGlobal { #[getter] #[inline] fn get_names(&self, py: Python) -> PyResult { - self.0.names.to_pyo3_wrapper(py) + self.0.names.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Nonlocal", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtNonlocal(pub &'static crate::StmtNonlocal); +pub struct StmtNonlocal(pub &'static ast::StmtNonlocal); -impl From<&'static crate::StmtNonlocal> for StmtNonlocal { - fn from(node: &'static crate::StmtNonlocal) -> Self { +impl From<&'static ast::StmtNonlocal> for StmtNonlocal { + fn from(node: &'static ast::StmtNonlocal) -> Self { StmtNonlocal(node) } } impl ToPyObject for StmtNonlocal { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtNonlocal { +impl ToPyWrapper for ast::StmtNonlocal { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtNonlocal(self).to_object(py)) } } @@ -1336,32 +1336,32 @@ impl StmtNonlocal { #[getter] #[inline] fn get_names(&self, py: Python) -> PyResult { - self.0.names.to_pyo3_wrapper(py) + self.0.names.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Expr", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtExpr(pub &'static crate::StmtExpr); +pub struct StmtExpr(pub &'static ast::StmtExpr); -impl From<&'static crate::StmtExpr> for StmtExpr { - fn from(node: &'static crate::StmtExpr) -> Self { +impl From<&'static ast::StmtExpr> for StmtExpr { + fn from(node: &'static ast::StmtExpr) -> Self { StmtExpr(node) } } impl ToPyObject for StmtExpr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtExpr { +impl ToPyWrapper for ast::StmtExpr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtExpr(self).to_object(py)) } } @@ -1371,32 +1371,32 @@ impl StmtExpr { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Pass", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtPass(pub &'static crate::StmtPass); +pub struct StmtPass(pub &'static ast::StmtPass); -impl From<&'static crate::StmtPass> for StmtPass { - fn from(node: &'static crate::StmtPass) -> Self { +impl From<&'static ast::StmtPass> for StmtPass { + fn from(node: &'static ast::StmtPass) -> Self { StmtPass(node) } } impl ToPyObject for StmtPass { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtPass { +impl ToPyWrapper for ast::StmtPass { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtPass(self).to_object(py)) } } @@ -1406,26 +1406,26 @@ impl StmtPass {} #[pyclass(module="rustpython_ast.located", name="_Break", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtBreak(pub &'static crate::StmtBreak); +pub struct StmtBreak(pub &'static ast::StmtBreak); -impl From<&'static crate::StmtBreak> for StmtBreak { - fn from(node: &'static crate::StmtBreak) -> Self { +impl From<&'static ast::StmtBreak> for StmtBreak { + fn from(node: &'static ast::StmtBreak) -> Self { StmtBreak(node) } } impl ToPyObject for StmtBreak { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtBreak { +impl ToPyWrapper for ast::StmtBreak { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtBreak(self).to_object(py)) } } @@ -1435,26 +1435,26 @@ impl StmtBreak {} #[pyclass(module="rustpython_ast.located", name="_Continue", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtContinue(pub &'static crate::StmtContinue); +pub struct StmtContinue(pub &'static ast::StmtContinue); -impl From<&'static crate::StmtContinue> for StmtContinue { - fn from(node: &'static crate::StmtContinue) -> Self { +impl From<&'static ast::StmtContinue> for StmtContinue { + fn from(node: &'static ast::StmtContinue) -> Self { StmtContinue(node) } } impl ToPyObject for StmtContinue { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtContinue { +impl ToPyWrapper for ast::StmtContinue { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtContinue(self).to_object(py)) } } @@ -1462,12 +1462,12 @@ impl ToPyo3Wrapper for crate::StmtContinue { #[pymethods] impl StmtContinue {} -#[pyclass(module="rustpython_ast.located", name="_expr", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_expr", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Expr; -impl From<&'static crate::Expr> for Expr { - fn from(_node: &'static crate::Expr) -> Self { +impl From<&'static ast::Expr> for Expr { + fn from(_node: &'static ast::Expr) -> Self { Expr } } @@ -1476,7 +1476,7 @@ impl From<&'static crate::Expr> for Expr { impl Expr { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Expr { @@ -1486,63 +1486,63 @@ impl ToPyObject for Expr { } } -impl ToPyo3Wrapper for crate::Expr { +impl ToPyWrapper for ast::Expr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::BoolOp(cons) => cons.to_pyo3_wrapper(py), - Self::NamedExpr(cons) => cons.to_pyo3_wrapper(py), - Self::BinOp(cons) => cons.to_pyo3_wrapper(py), - Self::UnaryOp(cons) => cons.to_pyo3_wrapper(py), - Self::Lambda(cons) => cons.to_pyo3_wrapper(py), - Self::IfExp(cons) => cons.to_pyo3_wrapper(py), - Self::Dict(cons) => cons.to_pyo3_wrapper(py), - Self::Set(cons) => cons.to_pyo3_wrapper(py), - Self::ListComp(cons) => cons.to_pyo3_wrapper(py), - Self::SetComp(cons) => cons.to_pyo3_wrapper(py), - Self::DictComp(cons) => cons.to_pyo3_wrapper(py), - Self::GeneratorExp(cons) => cons.to_pyo3_wrapper(py), - Self::Await(cons) => cons.to_pyo3_wrapper(py), - Self::Yield(cons) => cons.to_pyo3_wrapper(py), - Self::YieldFrom(cons) => cons.to_pyo3_wrapper(py), - Self::Compare(cons) => cons.to_pyo3_wrapper(py), - Self::Call(cons) => cons.to_pyo3_wrapper(py), - Self::FormattedValue(cons) => cons.to_pyo3_wrapper(py), - Self::JoinedStr(cons) => cons.to_pyo3_wrapper(py), - Self::Constant(cons) => cons.to_pyo3_wrapper(py), - Self::Attribute(cons) => cons.to_pyo3_wrapper(py), - Self::Subscript(cons) => cons.to_pyo3_wrapper(py), - Self::Starred(cons) => cons.to_pyo3_wrapper(py), - Self::Name(cons) => cons.to_pyo3_wrapper(py), - Self::List(cons) => cons.to_pyo3_wrapper(py), - Self::Tuple(cons) => cons.to_pyo3_wrapper(py), - Self::Slice(cons) => cons.to_pyo3_wrapper(py), + Self::BoolOp(cons) => cons.to_py_wrapper(py), + Self::NamedExpr(cons) => cons.to_py_wrapper(py), + Self::BinOp(cons) => cons.to_py_wrapper(py), + Self::UnaryOp(cons) => cons.to_py_wrapper(py), + Self::Lambda(cons) => cons.to_py_wrapper(py), + Self::IfExp(cons) => cons.to_py_wrapper(py), + Self::Dict(cons) => cons.to_py_wrapper(py), + Self::Set(cons) => cons.to_py_wrapper(py), + Self::ListComp(cons) => cons.to_py_wrapper(py), + Self::SetComp(cons) => cons.to_py_wrapper(py), + Self::DictComp(cons) => cons.to_py_wrapper(py), + Self::GeneratorExp(cons) => cons.to_py_wrapper(py), + Self::Await(cons) => cons.to_py_wrapper(py), + Self::Yield(cons) => cons.to_py_wrapper(py), + Self::YieldFrom(cons) => cons.to_py_wrapper(py), + Self::Compare(cons) => cons.to_py_wrapper(py), + Self::Call(cons) => cons.to_py_wrapper(py), + Self::FormattedValue(cons) => cons.to_py_wrapper(py), + Self::JoinedStr(cons) => cons.to_py_wrapper(py), + Self::Constant(cons) => cons.to_py_wrapper(py), + Self::Attribute(cons) => cons.to_py_wrapper(py), + Self::Subscript(cons) => cons.to_py_wrapper(py), + Self::Starred(cons) => cons.to_py_wrapper(py), + Self::Name(cons) => cons.to_py_wrapper(py), + Self::List(cons) => cons.to_py_wrapper(py), + Self::Tuple(cons) => cons.to_py_wrapper(py), + Self::Slice(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.located", name="_BoolOp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprBoolOp(pub &'static crate::ExprBoolOp); +pub struct ExprBoolOp(pub &'static ast::ExprBoolOp); -impl From<&'static crate::ExprBoolOp> for ExprBoolOp { - fn from(node: &'static crate::ExprBoolOp) -> Self { +impl From<&'static ast::ExprBoolOp> for ExprBoolOp { + fn from(node: &'static ast::ExprBoolOp) -> Self { ExprBoolOp(node) } } impl ToPyObject for ExprBoolOp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprBoolOp { +impl ToPyWrapper for ast::ExprBoolOp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprBoolOp(self).to_object(py)) } } @@ -1552,38 +1552,38 @@ impl ExprBoolOp { #[getter] #[inline] fn get_op(&self, py: Python) -> PyResult { - self.0.op.to_pyo3_wrapper(py) + self.0.op.to_py_wrapper(py) } #[getter] #[inline] fn get_values(&self, py: Python) -> PyResult { - self.0.values.to_pyo3_wrapper(py) + self.0.values.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_NamedExpr", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprNamedExpr(pub &'static crate::ExprNamedExpr); +pub struct ExprNamedExpr(pub &'static ast::ExprNamedExpr); -impl From<&'static crate::ExprNamedExpr> for ExprNamedExpr { - fn from(node: &'static crate::ExprNamedExpr) -> Self { +impl From<&'static ast::ExprNamedExpr> for ExprNamedExpr { + fn from(node: &'static ast::ExprNamedExpr) -> Self { ExprNamedExpr(node) } } impl ToPyObject for ExprNamedExpr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprNamedExpr { +impl ToPyWrapper for ast::ExprNamedExpr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprNamedExpr(self).to_object(py)) } } @@ -1593,38 +1593,38 @@ impl ExprNamedExpr { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_BinOp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprBinOp(pub &'static crate::ExprBinOp); +pub struct ExprBinOp(pub &'static ast::ExprBinOp); -impl From<&'static crate::ExprBinOp> for ExprBinOp { - fn from(node: &'static crate::ExprBinOp) -> Self { +impl From<&'static ast::ExprBinOp> for ExprBinOp { + fn from(node: &'static ast::ExprBinOp) -> Self { ExprBinOp(node) } } impl ToPyObject for ExprBinOp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprBinOp { +impl ToPyWrapper for ast::ExprBinOp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprBinOp(self).to_object(py)) } } @@ -1634,44 +1634,44 @@ impl ExprBinOp { #[getter] #[inline] fn get_left(&self, py: Python) -> PyResult { - self.0.left.to_pyo3_wrapper(py) + self.0.left.to_py_wrapper(py) } #[getter] #[inline] fn get_op(&self, py: Python) -> PyResult { - self.0.op.to_pyo3_wrapper(py) + self.0.op.to_py_wrapper(py) } #[getter] #[inline] fn get_right(&self, py: Python) -> PyResult { - self.0.right.to_pyo3_wrapper(py) + self.0.right.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_UnaryOp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprUnaryOp(pub &'static crate::ExprUnaryOp); +pub struct ExprUnaryOp(pub &'static ast::ExprUnaryOp); -impl From<&'static crate::ExprUnaryOp> for ExprUnaryOp { - fn from(node: &'static crate::ExprUnaryOp) -> Self { +impl From<&'static ast::ExprUnaryOp> for ExprUnaryOp { + fn from(node: &'static ast::ExprUnaryOp) -> Self { ExprUnaryOp(node) } } impl ToPyObject for ExprUnaryOp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprUnaryOp { +impl ToPyWrapper for ast::ExprUnaryOp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprUnaryOp(self).to_object(py)) } } @@ -1681,38 +1681,38 @@ impl ExprUnaryOp { #[getter] #[inline] fn get_op(&self, py: Python) -> PyResult { - self.0.op.to_pyo3_wrapper(py) + self.0.op.to_py_wrapper(py) } #[getter] #[inline] fn get_operand(&self, py: Python) -> PyResult { - self.0.operand.to_pyo3_wrapper(py) + self.0.operand.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Lambda", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprLambda(pub &'static crate::ExprLambda); +pub struct ExprLambda(pub &'static ast::ExprLambda); -impl From<&'static crate::ExprLambda> for ExprLambda { - fn from(node: &'static crate::ExprLambda) -> Self { +impl From<&'static ast::ExprLambda> for ExprLambda { + fn from(node: &'static ast::ExprLambda) -> Self { ExprLambda(node) } } impl ToPyObject for ExprLambda { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprLambda { +impl ToPyWrapper for ast::ExprLambda { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprLambda(self).to_object(py)) } } @@ -1722,38 +1722,38 @@ impl ExprLambda { #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_IfExp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprIfExp(pub &'static crate::ExprIfExp); +pub struct ExprIfExp(pub &'static ast::ExprIfExp); -impl From<&'static crate::ExprIfExp> for ExprIfExp { - fn from(node: &'static crate::ExprIfExp) -> Self { +impl From<&'static ast::ExprIfExp> for ExprIfExp { + fn from(node: &'static ast::ExprIfExp) -> Self { ExprIfExp(node) } } impl ToPyObject for ExprIfExp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprIfExp { +impl ToPyWrapper for ast::ExprIfExp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprIfExp(self).to_object(py)) } } @@ -1763,44 +1763,44 @@ impl ExprIfExp { #[getter] #[inline] fn get_test(&self, py: Python) -> PyResult { - self.0.test.to_pyo3_wrapper(py) + self.0.test.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Dict", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprDict(pub &'static crate::ExprDict); +pub struct ExprDict(pub &'static ast::ExprDict); -impl From<&'static crate::ExprDict> for ExprDict { - fn from(node: &'static crate::ExprDict) -> Self { +impl From<&'static ast::ExprDict> for ExprDict { + fn from(node: &'static ast::ExprDict) -> Self { ExprDict(node) } } impl ToPyObject for ExprDict { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprDict { +impl ToPyWrapper for ast::ExprDict { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprDict(self).to_object(py)) } } @@ -1810,38 +1810,38 @@ impl ExprDict { #[getter] #[inline] fn get_keys(&self, py: Python) -> PyResult { - self.0.keys.to_pyo3_wrapper(py) + self.0.keys.to_py_wrapper(py) } #[getter] #[inline] fn get_values(&self, py: Python) -> PyResult { - self.0.values.to_pyo3_wrapper(py) + self.0.values.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Set", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprSet(pub &'static crate::ExprSet); +pub struct ExprSet(pub &'static ast::ExprSet); -impl From<&'static crate::ExprSet> for ExprSet { - fn from(node: &'static crate::ExprSet) -> Self { +impl From<&'static ast::ExprSet> for ExprSet { + fn from(node: &'static ast::ExprSet) -> Self { ExprSet(node) } } impl ToPyObject for ExprSet { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprSet { +impl ToPyWrapper for ast::ExprSet { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprSet(self).to_object(py)) } } @@ -1851,32 +1851,32 @@ impl ExprSet { #[getter] #[inline] fn get_elts(&self, py: Python) -> PyResult { - self.0.elts.to_pyo3_wrapper(py) + self.0.elts.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_ListComp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprListComp(pub &'static crate::ExprListComp); +pub struct ExprListComp(pub &'static ast::ExprListComp); -impl From<&'static crate::ExprListComp> for ExprListComp { - fn from(node: &'static crate::ExprListComp) -> Self { +impl From<&'static ast::ExprListComp> for ExprListComp { + fn from(node: &'static ast::ExprListComp) -> Self { ExprListComp(node) } } impl ToPyObject for ExprListComp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprListComp { +impl ToPyWrapper for ast::ExprListComp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprListComp(self).to_object(py)) } } @@ -1886,38 +1886,38 @@ impl ExprListComp { #[getter] #[inline] fn get_elt(&self, py: Python) -> PyResult { - self.0.elt.to_pyo3_wrapper(py) + self.0.elt.to_py_wrapper(py) } #[getter] #[inline] fn get_generators(&self, py: Python) -> PyResult { - self.0.generators.to_pyo3_wrapper(py) + self.0.generators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_SetComp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprSetComp(pub &'static crate::ExprSetComp); +pub struct ExprSetComp(pub &'static ast::ExprSetComp); -impl From<&'static crate::ExprSetComp> for ExprSetComp { - fn from(node: &'static crate::ExprSetComp) -> Self { +impl From<&'static ast::ExprSetComp> for ExprSetComp { + fn from(node: &'static ast::ExprSetComp) -> Self { ExprSetComp(node) } } impl ToPyObject for ExprSetComp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprSetComp { +impl ToPyWrapper for ast::ExprSetComp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprSetComp(self).to_object(py)) } } @@ -1927,38 +1927,38 @@ impl ExprSetComp { #[getter] #[inline] fn get_elt(&self, py: Python) -> PyResult { - self.0.elt.to_pyo3_wrapper(py) + self.0.elt.to_py_wrapper(py) } #[getter] #[inline] fn get_generators(&self, py: Python) -> PyResult { - self.0.generators.to_pyo3_wrapper(py) + self.0.generators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_DictComp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprDictComp(pub &'static crate::ExprDictComp); +pub struct ExprDictComp(pub &'static ast::ExprDictComp); -impl From<&'static crate::ExprDictComp> for ExprDictComp { - fn from(node: &'static crate::ExprDictComp) -> Self { +impl From<&'static ast::ExprDictComp> for ExprDictComp { + fn from(node: &'static ast::ExprDictComp) -> Self { ExprDictComp(node) } } impl ToPyObject for ExprDictComp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprDictComp { +impl ToPyWrapper for ast::ExprDictComp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprDictComp(self).to_object(py)) } } @@ -1968,44 +1968,44 @@ impl ExprDictComp { #[getter] #[inline] fn get_key(&self, py: Python) -> PyResult { - self.0.key.to_pyo3_wrapper(py) + self.0.key.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_generators(&self, py: Python) -> PyResult { - self.0.generators.to_pyo3_wrapper(py) + self.0.generators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_GeneratorExp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprGeneratorExp(pub &'static crate::ExprGeneratorExp); +pub struct ExprGeneratorExp(pub &'static ast::ExprGeneratorExp); -impl From<&'static crate::ExprGeneratorExp> for ExprGeneratorExp { - fn from(node: &'static crate::ExprGeneratorExp) -> Self { +impl From<&'static ast::ExprGeneratorExp> for ExprGeneratorExp { + fn from(node: &'static ast::ExprGeneratorExp) -> Self { ExprGeneratorExp(node) } } impl ToPyObject for ExprGeneratorExp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprGeneratorExp { +impl ToPyWrapper for ast::ExprGeneratorExp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprGeneratorExp(self).to_object(py)) } } @@ -2015,38 +2015,38 @@ impl ExprGeneratorExp { #[getter] #[inline] fn get_elt(&self, py: Python) -> PyResult { - self.0.elt.to_pyo3_wrapper(py) + self.0.elt.to_py_wrapper(py) } #[getter] #[inline] fn get_generators(&self, py: Python) -> PyResult { - self.0.generators.to_pyo3_wrapper(py) + self.0.generators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Await", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprAwait(pub &'static crate::ExprAwait); +pub struct ExprAwait(pub &'static ast::ExprAwait); -impl From<&'static crate::ExprAwait> for ExprAwait { - fn from(node: &'static crate::ExprAwait) -> Self { +impl From<&'static ast::ExprAwait> for ExprAwait { + fn from(node: &'static ast::ExprAwait) -> Self { ExprAwait(node) } } impl ToPyObject for ExprAwait { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprAwait { +impl ToPyWrapper for ast::ExprAwait { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprAwait(self).to_object(py)) } } @@ -2056,32 +2056,32 @@ impl ExprAwait { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Yield", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprYield(pub &'static crate::ExprYield); +pub struct ExprYield(pub &'static ast::ExprYield); -impl From<&'static crate::ExprYield> for ExprYield { - fn from(node: &'static crate::ExprYield) -> Self { +impl From<&'static ast::ExprYield> for ExprYield { + fn from(node: &'static ast::ExprYield) -> Self { ExprYield(node) } } impl ToPyObject for ExprYield { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprYield { +impl ToPyWrapper for ast::ExprYield { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprYield(self).to_object(py)) } } @@ -2091,32 +2091,32 @@ impl ExprYield { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_YieldFrom", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprYieldFrom(pub &'static crate::ExprYieldFrom); +pub struct ExprYieldFrom(pub &'static ast::ExprYieldFrom); -impl From<&'static crate::ExprYieldFrom> for ExprYieldFrom { - fn from(node: &'static crate::ExprYieldFrom) -> Self { +impl From<&'static ast::ExprYieldFrom> for ExprYieldFrom { + fn from(node: &'static ast::ExprYieldFrom) -> Self { ExprYieldFrom(node) } } impl ToPyObject for ExprYieldFrom { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprYieldFrom { +impl ToPyWrapper for ast::ExprYieldFrom { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprYieldFrom(self).to_object(py)) } } @@ -2126,32 +2126,32 @@ impl ExprYieldFrom { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Compare", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprCompare(pub &'static crate::ExprCompare); +pub struct ExprCompare(pub &'static ast::ExprCompare); -impl From<&'static crate::ExprCompare> for ExprCompare { - fn from(node: &'static crate::ExprCompare) -> Self { +impl From<&'static ast::ExprCompare> for ExprCompare { + fn from(node: &'static ast::ExprCompare) -> Self { ExprCompare(node) } } impl ToPyObject for ExprCompare { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprCompare { +impl ToPyWrapper for ast::ExprCompare { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprCompare(self).to_object(py)) } } @@ -2161,44 +2161,44 @@ impl ExprCompare { #[getter] #[inline] fn get_left(&self, py: Python) -> PyResult { - self.0.left.to_pyo3_wrapper(py) + self.0.left.to_py_wrapper(py) } #[getter] #[inline] fn get_ops(&self, py: Python) -> PyResult { - self.0.ops.to_pyo3_wrapper(py) + self.0.ops.to_py_wrapper(py) } #[getter] #[inline] fn get_comparators(&self, py: Python) -> PyResult { - self.0.comparators.to_pyo3_wrapper(py) + self.0.comparators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Call", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprCall(pub &'static crate::ExprCall); +pub struct ExprCall(pub &'static ast::ExprCall); -impl From<&'static crate::ExprCall> for ExprCall { - fn from(node: &'static crate::ExprCall) -> Self { +impl From<&'static ast::ExprCall> for ExprCall { + fn from(node: &'static ast::ExprCall) -> Self { ExprCall(node) } } impl ToPyObject for ExprCall { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprCall { +impl ToPyWrapper for ast::ExprCall { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprCall(self).to_object(py)) } } @@ -2208,44 +2208,44 @@ impl ExprCall { #[getter] #[inline] fn get_func(&self, py: Python) -> PyResult { - self.0.func.to_pyo3_wrapper(py) + self.0.func.to_py_wrapper(py) } #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_keywords(&self, py: Python) -> PyResult { - self.0.keywords.to_pyo3_wrapper(py) + self.0.keywords.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_FormattedValue", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprFormattedValue(pub &'static crate::ExprFormattedValue); +pub struct ExprFormattedValue(pub &'static ast::ExprFormattedValue); -impl From<&'static crate::ExprFormattedValue> for ExprFormattedValue { - fn from(node: &'static crate::ExprFormattedValue) -> Self { +impl From<&'static ast::ExprFormattedValue> for ExprFormattedValue { + fn from(node: &'static ast::ExprFormattedValue) -> Self { ExprFormattedValue(node) } } impl ToPyObject for ExprFormattedValue { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprFormattedValue { +impl ToPyWrapper for ast::ExprFormattedValue { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprFormattedValue(self).to_object(py)) } } @@ -2255,44 +2255,44 @@ impl ExprFormattedValue { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_conversion(&self, py: Python) -> PyResult { - self.0.conversion.to_pyo3_wrapper(py) + self.0.conversion.to_py_wrapper(py) } #[getter] #[inline] fn get_format_spec(&self, py: Python) -> PyResult { - self.0.format_spec.to_pyo3_wrapper(py) + self.0.format_spec.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_JoinedStr", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprJoinedStr(pub &'static crate::ExprJoinedStr); +pub struct ExprJoinedStr(pub &'static ast::ExprJoinedStr); -impl From<&'static crate::ExprJoinedStr> for ExprJoinedStr { - fn from(node: &'static crate::ExprJoinedStr) -> Self { +impl From<&'static ast::ExprJoinedStr> for ExprJoinedStr { + fn from(node: &'static ast::ExprJoinedStr) -> Self { ExprJoinedStr(node) } } impl ToPyObject for ExprJoinedStr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprJoinedStr { +impl ToPyWrapper for ast::ExprJoinedStr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprJoinedStr(self).to_object(py)) } } @@ -2302,32 +2302,32 @@ impl ExprJoinedStr { #[getter] #[inline] fn get_values(&self, py: Python) -> PyResult { - self.0.values.to_pyo3_wrapper(py) + self.0.values.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Constant", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprConstant(pub &'static crate::ExprConstant); +pub struct ExprConstant(pub &'static ast::ExprConstant); -impl From<&'static crate::ExprConstant> for ExprConstant { - fn from(node: &'static crate::ExprConstant) -> Self { +impl From<&'static ast::ExprConstant> for ExprConstant { + fn from(node: &'static ast::ExprConstant) -> Self { ExprConstant(node) } } impl ToPyObject for ExprConstant { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprConstant { +impl ToPyWrapper for ast::ExprConstant { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprConstant(self).to_object(py)) } } @@ -2337,38 +2337,38 @@ impl ExprConstant { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_kind(&self, py: Python) -> PyResult { - self.0.kind.to_pyo3_wrapper(py) + self.0.kind.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Attribute", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprAttribute(pub &'static crate::ExprAttribute); +pub struct ExprAttribute(pub &'static ast::ExprAttribute); -impl From<&'static crate::ExprAttribute> for ExprAttribute { - fn from(node: &'static crate::ExprAttribute) -> Self { +impl From<&'static ast::ExprAttribute> for ExprAttribute { + fn from(node: &'static ast::ExprAttribute) -> Self { ExprAttribute(node) } } impl ToPyObject for ExprAttribute { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprAttribute { +impl ToPyWrapper for ast::ExprAttribute { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprAttribute(self).to_object(py)) } } @@ -2378,44 +2378,44 @@ impl ExprAttribute { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_attr(&self, py: Python) -> PyResult { - self.0.attr.to_pyo3_wrapper(py) + self.0.attr.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Subscript", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprSubscript(pub &'static crate::ExprSubscript); +pub struct ExprSubscript(pub &'static ast::ExprSubscript); -impl From<&'static crate::ExprSubscript> for ExprSubscript { - fn from(node: &'static crate::ExprSubscript) -> Self { +impl From<&'static ast::ExprSubscript> for ExprSubscript { + fn from(node: &'static ast::ExprSubscript) -> Self { ExprSubscript(node) } } impl ToPyObject for ExprSubscript { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprSubscript { +impl ToPyWrapper for ast::ExprSubscript { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprSubscript(self).to_object(py)) } } @@ -2425,44 +2425,44 @@ impl ExprSubscript { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_slice(&self, py: Python) -> PyResult { - self.0.slice.to_pyo3_wrapper(py) + self.0.slice.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Starred", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprStarred(pub &'static crate::ExprStarred); +pub struct ExprStarred(pub &'static ast::ExprStarred); -impl From<&'static crate::ExprStarred> for ExprStarred { - fn from(node: &'static crate::ExprStarred) -> Self { +impl From<&'static ast::ExprStarred> for ExprStarred { + fn from(node: &'static ast::ExprStarred) -> Self { ExprStarred(node) } } impl ToPyObject for ExprStarred { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprStarred { +impl ToPyWrapper for ast::ExprStarred { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprStarred(self).to_object(py)) } } @@ -2472,38 +2472,38 @@ impl ExprStarred { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Name", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprName(pub &'static crate::ExprName); +pub struct ExprName(pub &'static ast::ExprName); -impl From<&'static crate::ExprName> for ExprName { - fn from(node: &'static crate::ExprName) -> Self { +impl From<&'static ast::ExprName> for ExprName { + fn from(node: &'static ast::ExprName) -> Self { ExprName(node) } } impl ToPyObject for ExprName { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprName { +impl ToPyWrapper for ast::ExprName { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprName(self).to_object(py)) } } @@ -2513,38 +2513,38 @@ impl ExprName { #[getter] #[inline] fn get_id(&self, py: Python) -> PyResult { - self.0.id.to_pyo3_wrapper(py) + self.0.id.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_List", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprList(pub &'static crate::ExprList); +pub struct ExprList(pub &'static ast::ExprList); -impl From<&'static crate::ExprList> for ExprList { - fn from(node: &'static crate::ExprList) -> Self { +impl From<&'static ast::ExprList> for ExprList { + fn from(node: &'static ast::ExprList) -> Self { ExprList(node) } } impl ToPyObject for ExprList { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprList { +impl ToPyWrapper for ast::ExprList { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprList(self).to_object(py)) } } @@ -2554,38 +2554,38 @@ impl ExprList { #[getter] #[inline] fn get_elts(&self, py: Python) -> PyResult { - self.0.elts.to_pyo3_wrapper(py) + self.0.elts.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Tuple", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprTuple(pub &'static crate::ExprTuple); +pub struct ExprTuple(pub &'static ast::ExprTuple); -impl From<&'static crate::ExprTuple> for ExprTuple { - fn from(node: &'static crate::ExprTuple) -> Self { +impl From<&'static ast::ExprTuple> for ExprTuple { + fn from(node: &'static ast::ExprTuple) -> Self { ExprTuple(node) } } impl ToPyObject for ExprTuple { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprTuple { +impl ToPyWrapper for ast::ExprTuple { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprTuple(self).to_object(py)) } } @@ -2595,38 +2595,38 @@ impl ExprTuple { #[getter] #[inline] fn get_elts(&self, py: Python) -> PyResult { - self.0.elts.to_pyo3_wrapper(py) + self.0.elts.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_Slice", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprSlice(pub &'static crate::ExprSlice); +pub struct ExprSlice(pub &'static ast::ExprSlice); -impl From<&'static crate::ExprSlice> for ExprSlice { - fn from(node: &'static crate::ExprSlice) -> Self { +impl From<&'static ast::ExprSlice> for ExprSlice { + fn from(node: &'static ast::ExprSlice) -> Self { ExprSlice(node) } } impl ToPyObject for ExprSlice { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprSlice { +impl ToPyWrapper for ast::ExprSlice { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprSlice(self).to_object(py)) } } @@ -2636,28 +2636,28 @@ impl ExprSlice { #[getter] #[inline] fn get_lower(&self, py: Python) -> PyResult { - self.0.lower.to_pyo3_wrapper(py) + self.0.lower.to_py_wrapper(py) } #[getter] #[inline] fn get_upper(&self, py: Python) -> PyResult { - self.0.upper.to_pyo3_wrapper(py) + self.0.upper.to_py_wrapper(py) } #[getter] #[inline] fn get_step(&self, py: Python) -> PyResult { - self.0.step.to_pyo3_wrapper(py) + self.0.step.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_expr_context", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_expr_context", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct ExprContext; -impl From<&'static crate::ExprContext> for ExprContext { - fn from(_node: &'static crate::ExprContext) -> Self { +impl From<&'static ast::ExprContext> for ExprContext { + fn from(_node: &'static ast::ExprContext) -> Self { ExprContext } } @@ -2666,7 +2666,7 @@ impl From<&'static crate::ExprContext> for ExprContext { impl ExprContext { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for ExprContext { @@ -2681,7 +2681,7 @@ pub struct ExprContextLoad; impl ToPyObject for ExprContextLoad { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(ExprContext) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2693,7 +2693,7 @@ pub struct ExprContextStore; impl ToPyObject for ExprContextStore { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(ExprContext) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2705,19 +2705,19 @@ pub struct ExprContextDel; impl ToPyObject for ExprContextDel { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(ExprContext) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_boolop", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_boolop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Boolop; -impl From<&'static crate::Boolop> for Boolop { - fn from(_node: &'static crate::Boolop) -> Self { +impl From<&'static ast::Boolop> for Boolop { + fn from(_node: &'static ast::Boolop) -> Self { Boolop } } @@ -2726,7 +2726,7 @@ impl From<&'static crate::Boolop> for Boolop { impl Boolop { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Boolop { @@ -2741,7 +2741,7 @@ pub struct BoolopAnd; impl ToPyObject for BoolopAnd { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Boolop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2753,19 +2753,19 @@ pub struct BoolopOr; impl ToPyObject for BoolopOr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Boolop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_operator", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_operator", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Operator; -impl From<&'static crate::Operator> for Operator { - fn from(_node: &'static crate::Operator) -> Self { +impl From<&'static ast::Operator> for Operator { + fn from(_node: &'static ast::Operator) -> Self { Operator } } @@ -2774,7 +2774,7 @@ impl From<&'static crate::Operator> for Operator { impl Operator { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Operator { @@ -2789,7 +2789,7 @@ pub struct OperatorAdd; impl ToPyObject for OperatorAdd { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2801,7 +2801,7 @@ pub struct OperatorSub; impl ToPyObject for OperatorSub { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2813,7 +2813,7 @@ pub struct OperatorMult; impl ToPyObject for OperatorMult { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2825,7 +2825,7 @@ pub struct OperatorMatMult; impl ToPyObject for OperatorMatMult { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2837,7 +2837,7 @@ pub struct OperatorDiv; impl ToPyObject for OperatorDiv { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2849,7 +2849,7 @@ pub struct OperatorMod; impl ToPyObject for OperatorMod { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2861,7 +2861,7 @@ pub struct OperatorPow; impl ToPyObject for OperatorPow { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2873,7 +2873,7 @@ pub struct OperatorLShift; impl ToPyObject for OperatorLShift { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2885,7 +2885,7 @@ pub struct OperatorRShift; impl ToPyObject for OperatorRShift { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2897,7 +2897,7 @@ pub struct OperatorBitOr; impl ToPyObject for OperatorBitOr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2909,7 +2909,7 @@ pub struct OperatorBitXor; impl ToPyObject for OperatorBitXor { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2921,7 +2921,7 @@ pub struct OperatorBitAnd; impl ToPyObject for OperatorBitAnd { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2933,19 +2933,19 @@ pub struct OperatorFloorDiv; impl ToPyObject for OperatorFloorDiv { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_unaryop", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_unaryop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Unaryop; -impl From<&'static crate::Unaryop> for Unaryop { - fn from(_node: &'static crate::Unaryop) -> Self { +impl From<&'static ast::Unaryop> for Unaryop { + fn from(_node: &'static ast::Unaryop) -> Self { Unaryop } } @@ -2954,7 +2954,7 @@ impl From<&'static crate::Unaryop> for Unaryop { impl Unaryop { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Unaryop { @@ -2969,7 +2969,7 @@ pub struct UnaryopInvert; impl ToPyObject for UnaryopInvert { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Unaryop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2981,7 +2981,7 @@ pub struct UnaryopNot; impl ToPyObject for UnaryopNot { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Unaryop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2993,7 +2993,7 @@ pub struct UnaryopUAdd; impl ToPyObject for UnaryopUAdd { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Unaryop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3005,19 +3005,19 @@ pub struct UnaryopUSub; impl ToPyObject for UnaryopUSub { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Unaryop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_cmpop", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_cmpop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Cmpop; -impl From<&'static crate::Cmpop> for Cmpop { - fn from(_node: &'static crate::Cmpop) -> Self { +impl From<&'static ast::Cmpop> for Cmpop { + fn from(_node: &'static ast::Cmpop) -> Self { Cmpop } } @@ -3026,7 +3026,7 @@ impl From<&'static crate::Cmpop> for Cmpop { impl Cmpop { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Cmpop { @@ -3041,7 +3041,7 @@ pub struct CmpopEq; impl ToPyObject for CmpopEq { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3053,7 +3053,7 @@ pub struct CmpopNotEq; impl ToPyObject for CmpopNotEq { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3065,7 +3065,7 @@ pub struct CmpopLt; impl ToPyObject for CmpopLt { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3077,7 +3077,7 @@ pub struct CmpopLtE; impl ToPyObject for CmpopLtE { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3089,7 +3089,7 @@ pub struct CmpopGt; impl ToPyObject for CmpopGt { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3101,7 +3101,7 @@ pub struct CmpopGtE; impl ToPyObject for CmpopGtE { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3113,7 +3113,7 @@ pub struct CmpopIs; impl ToPyObject for CmpopIs { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3125,7 +3125,7 @@ pub struct CmpopIsNot; impl ToPyObject for CmpopIsNot { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3137,7 +3137,7 @@ pub struct CmpopIn; impl ToPyObject for CmpopIn { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3149,33 +3149,33 @@ pub struct CmpopNotIn; impl ToPyObject for CmpopNotIn { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_comprehension", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.located", name="_comprehension", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Comprehension(pub &'static crate::Comprehension); +pub struct Comprehension(pub &'static ast::Comprehension); -impl From<&'static crate::Comprehension> for Comprehension { - fn from(node: &'static crate::Comprehension) -> Self { +impl From<&'static ast::Comprehension> for Comprehension { + fn from(node: &'static ast::Comprehension) -> Self { Comprehension(node) } } impl ToPyObject for Comprehension { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Comprehension { +impl ToPyWrapper for ast::Comprehension { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Comprehension(self).to_object(py)) } } @@ -3185,34 +3185,34 @@ impl Comprehension { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_iter(&self, py: Python) -> PyResult { - self.0.iter.to_pyo3_wrapper(py) + self.0.iter.to_py_wrapper(py) } #[getter] #[inline] fn get_ifs(&self, py: Python) -> PyResult { - self.0.ifs.to_pyo3_wrapper(py) + self.0.ifs.to_py_wrapper(py) } #[getter] #[inline] fn get_is_async(&self, py: Python) -> PyResult { - self.0.is_async.to_pyo3_wrapper(py) + self.0.is_async.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_excepthandler", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_excepthandler", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Excepthandler; -impl From<&'static crate::Excepthandler> for Excepthandler { - fn from(_node: &'static crate::Excepthandler) -> Self { +impl From<&'static ast::Excepthandler> for Excepthandler { + fn from(_node: &'static ast::Excepthandler) -> Self { Excepthandler } } @@ -3221,7 +3221,7 @@ impl From<&'static crate::Excepthandler> for Excepthandler { impl Excepthandler { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Excepthandler { @@ -3231,37 +3231,37 @@ impl ToPyObject for Excepthandler { } } -impl ToPyo3Wrapper for crate::Excepthandler { +impl ToPyWrapper for ast::Excepthandler { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::ExceptHandler(cons) => cons.to_pyo3_wrapper(py), + Self::ExceptHandler(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.located", name="_ExceptHandler", extends=Excepthandler, frozen)] #[derive(Clone, Debug)] -pub struct ExcepthandlerExceptHandler(pub &'static crate::ExcepthandlerExceptHandler); +pub struct ExcepthandlerExceptHandler(pub &'static ast::ExcepthandlerExceptHandler); -impl From<&'static crate::ExcepthandlerExceptHandler> for ExcepthandlerExceptHandler { - fn from(node: &'static crate::ExcepthandlerExceptHandler) -> Self { +impl From<&'static ast::ExcepthandlerExceptHandler> for ExcepthandlerExceptHandler { + fn from(node: &'static ast::ExcepthandlerExceptHandler) -> Self { ExcepthandlerExceptHandler(node) } } impl ToPyObject for ExcepthandlerExceptHandler { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Excepthandler) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExcepthandlerExceptHandler { +impl ToPyWrapper for ast::ExcepthandlerExceptHandler { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExcepthandlerExceptHandler(self).to_object(py)) } } @@ -3271,42 +3271,42 @@ impl ExcepthandlerExceptHandler { #[getter] #[inline] fn get_type(&self, py: Python) -> PyResult { - self.0.type_.to_pyo3_wrapper(py) + self.0.type_.to_py_wrapper(py) } #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_arguments", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.located", name="_arguments", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Arguments(pub &'static crate::Arguments); +pub struct Arguments(pub &'static ast::Arguments); -impl From<&'static crate::Arguments> for Arguments { - fn from(node: &'static crate::Arguments) -> Self { +impl From<&'static ast::Arguments> for Arguments { + fn from(node: &'static ast::Arguments) -> Self { Arguments(node) } } impl ToPyObject for Arguments { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Arguments { +impl ToPyWrapper for ast::Arguments { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Arguments(self).to_object(py)) } } @@ -3316,66 +3316,66 @@ impl Arguments { #[getter] #[inline] fn get_posonlyargs(&self, py: Python) -> PyResult { - self.0.posonlyargs.to_pyo3_wrapper(py) + self.0.posonlyargs.to_py_wrapper(py) } #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_vararg(&self, py: Python) -> PyResult { - self.0.vararg.to_pyo3_wrapper(py) + self.0.vararg.to_py_wrapper(py) } #[getter] #[inline] fn get_kwonlyargs(&self, py: Python) -> PyResult { - self.0.kwonlyargs.to_pyo3_wrapper(py) + self.0.kwonlyargs.to_py_wrapper(py) } #[getter] #[inline] fn get_kw_defaults(&self, py: Python) -> PyResult { - self.0.kw_defaults.to_pyo3_wrapper(py) + self.0.kw_defaults.to_py_wrapper(py) } #[getter] #[inline] fn get_kwarg(&self, py: Python) -> PyResult { - self.0.kwarg.to_pyo3_wrapper(py) + self.0.kwarg.to_py_wrapper(py) } #[getter] #[inline] fn get_defaults(&self, py: Python) -> PyResult { - self.0.defaults.to_pyo3_wrapper(py) + self.0.defaults.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_arg", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.located", name="_arg", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Arg(pub &'static crate::Arg); +pub struct Arg(pub &'static ast::Arg); -impl From<&'static crate::Arg> for Arg { - fn from(node: &'static crate::Arg) -> Self { +impl From<&'static ast::Arg> for Arg { + fn from(node: &'static ast::Arg) -> Self { Arg(node) } } impl ToPyObject for Arg { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Arg { +impl ToPyWrapper for ast::Arg { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Arg(self).to_object(py)) } } @@ -3385,42 +3385,42 @@ impl Arg { #[getter] #[inline] fn get_arg(&self, py: Python) -> PyResult { - self.0.arg.to_pyo3_wrapper(py) + self.0.arg.to_py_wrapper(py) } #[getter] #[inline] fn get_annotation(&self, py: Python) -> PyResult { - self.0.annotation.to_pyo3_wrapper(py) + self.0.annotation.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_keyword", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.located", name="_keyword", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Keyword(pub &'static crate::Keyword); +pub struct Keyword(pub &'static ast::Keyword); -impl From<&'static crate::Keyword> for Keyword { - fn from(node: &'static crate::Keyword) -> Self { +impl From<&'static ast::Keyword> for Keyword { + fn from(node: &'static ast::Keyword) -> Self { Keyword(node) } } impl ToPyObject for Keyword { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Keyword { +impl ToPyWrapper for ast::Keyword { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Keyword(self).to_object(py)) } } @@ -3430,36 +3430,36 @@ impl Keyword { #[getter] #[inline] fn get_arg(&self, py: Python) -> PyResult { - self.0.arg.to_pyo3_wrapper(py) + self.0.arg.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_alias", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.located", name="_alias", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Alias(pub &'static crate::Alias); +pub struct Alias(pub &'static ast::Alias); -impl From<&'static crate::Alias> for Alias { - fn from(node: &'static crate::Alias) -> Self { +impl From<&'static ast::Alias> for Alias { + fn from(node: &'static ast::Alias) -> Self { Alias(node) } } impl ToPyObject for Alias { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Alias { +impl ToPyWrapper for ast::Alias { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Alias(self).to_object(py)) } } @@ -3469,36 +3469,36 @@ impl Alias { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_asname(&self, py: Python) -> PyResult { - self.0.asname.to_pyo3_wrapper(py) + self.0.asname.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_withitem", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.located", name="_withitem", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Withitem(pub &'static crate::Withitem); +pub struct Withitem(pub &'static ast::Withitem); -impl From<&'static crate::Withitem> for Withitem { - fn from(node: &'static crate::Withitem) -> Self { +impl From<&'static ast::Withitem> for Withitem { + fn from(node: &'static ast::Withitem) -> Self { Withitem(node) } } impl ToPyObject for Withitem { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Withitem { +impl ToPyWrapper for ast::Withitem { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Withitem(self).to_object(py)) } } @@ -3508,36 +3508,36 @@ impl Withitem { #[getter] #[inline] fn get_context_expr(&self, py: Python) -> PyResult { - self.0.context_expr.to_pyo3_wrapper(py) + self.0.context_expr.to_py_wrapper(py) } #[getter] #[inline] fn get_optional_vars(&self, py: Python) -> PyResult { - self.0.optional_vars.to_pyo3_wrapper(py) + self.0.optional_vars.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_match_case", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.located", name="_match_case", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct MatchCase(pub &'static crate::MatchCase); +pub struct MatchCase(pub &'static ast::MatchCase); -impl From<&'static crate::MatchCase> for MatchCase { - fn from(node: &'static crate::MatchCase) -> Self { +impl From<&'static ast::MatchCase> for MatchCase { + fn from(node: &'static ast::MatchCase) -> Self { MatchCase(node) } } impl ToPyObject for MatchCase { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::MatchCase { +impl ToPyWrapper for ast::MatchCase { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(MatchCase(self).to_object(py)) } } @@ -3547,28 +3547,28 @@ impl MatchCase { #[getter] #[inline] fn get_pattern(&self, py: Python) -> PyResult { - self.0.pattern.to_pyo3_wrapper(py) + self.0.pattern.to_py_wrapper(py) } #[getter] #[inline] fn get_guard(&self, py: Python) -> PyResult { - self.0.guard.to_pyo3_wrapper(py) + self.0.guard.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_pattern", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_pattern", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Pattern; -impl From<&'static crate::Pattern> for Pattern { - fn from(_node: &'static crate::Pattern) -> Self { +impl From<&'static ast::Pattern> for Pattern { + fn from(_node: &'static ast::Pattern) -> Self { Pattern } } @@ -3577,7 +3577,7 @@ impl From<&'static crate::Pattern> for Pattern { impl Pattern { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Pattern { @@ -3587,44 +3587,44 @@ impl ToPyObject for Pattern { } } -impl ToPyo3Wrapper for crate::Pattern { +impl ToPyWrapper for ast::Pattern { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::MatchValue(cons) => cons.to_pyo3_wrapper(py), - Self::MatchSingleton(cons) => cons.to_pyo3_wrapper(py), - Self::MatchSequence(cons) => cons.to_pyo3_wrapper(py), - Self::MatchMapping(cons) => cons.to_pyo3_wrapper(py), - Self::MatchClass(cons) => cons.to_pyo3_wrapper(py), - Self::MatchStar(cons) => cons.to_pyo3_wrapper(py), - Self::MatchAs(cons) => cons.to_pyo3_wrapper(py), - Self::MatchOr(cons) => cons.to_pyo3_wrapper(py), + Self::MatchValue(cons) => cons.to_py_wrapper(py), + Self::MatchSingleton(cons) => cons.to_py_wrapper(py), + Self::MatchSequence(cons) => cons.to_py_wrapper(py), + Self::MatchMapping(cons) => cons.to_py_wrapper(py), + Self::MatchClass(cons) => cons.to_py_wrapper(py), + Self::MatchStar(cons) => cons.to_py_wrapper(py), + Self::MatchAs(cons) => cons.to_py_wrapper(py), + Self::MatchOr(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.located", name="_MatchValue", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchValue(pub &'static crate::PatternMatchValue); +pub struct PatternMatchValue(pub &'static ast::PatternMatchValue); -impl From<&'static crate::PatternMatchValue> for PatternMatchValue { - fn from(node: &'static crate::PatternMatchValue) -> Self { +impl From<&'static ast::PatternMatchValue> for PatternMatchValue { + fn from(node: &'static ast::PatternMatchValue) -> Self { PatternMatchValue(node) } } impl ToPyObject for PatternMatchValue { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchValue { +impl ToPyWrapper for ast::PatternMatchValue { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchValue(self).to_object(py)) } } @@ -3634,32 +3634,32 @@ impl PatternMatchValue { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_MatchSingleton", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchSingleton(pub &'static crate::PatternMatchSingleton); +pub struct PatternMatchSingleton(pub &'static ast::PatternMatchSingleton); -impl From<&'static crate::PatternMatchSingleton> for PatternMatchSingleton { - fn from(node: &'static crate::PatternMatchSingleton) -> Self { +impl From<&'static ast::PatternMatchSingleton> for PatternMatchSingleton { + fn from(node: &'static ast::PatternMatchSingleton) -> Self { PatternMatchSingleton(node) } } impl ToPyObject for PatternMatchSingleton { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchSingleton { +impl ToPyWrapper for ast::PatternMatchSingleton { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchSingleton(self).to_object(py)) } } @@ -3669,32 +3669,32 @@ impl PatternMatchSingleton { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_MatchSequence", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchSequence(pub &'static crate::PatternMatchSequence); +pub struct PatternMatchSequence(pub &'static ast::PatternMatchSequence); -impl From<&'static crate::PatternMatchSequence> for PatternMatchSequence { - fn from(node: &'static crate::PatternMatchSequence) -> Self { +impl From<&'static ast::PatternMatchSequence> for PatternMatchSequence { + fn from(node: &'static ast::PatternMatchSequence) -> Self { PatternMatchSequence(node) } } impl ToPyObject for PatternMatchSequence { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchSequence { +impl ToPyWrapper for ast::PatternMatchSequence { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchSequence(self).to_object(py)) } } @@ -3704,32 +3704,32 @@ impl PatternMatchSequence { #[getter] #[inline] fn get_patterns(&self, py: Python) -> PyResult { - self.0.patterns.to_pyo3_wrapper(py) + self.0.patterns.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_MatchMapping", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchMapping(pub &'static crate::PatternMatchMapping); +pub struct PatternMatchMapping(pub &'static ast::PatternMatchMapping); -impl From<&'static crate::PatternMatchMapping> for PatternMatchMapping { - fn from(node: &'static crate::PatternMatchMapping) -> Self { +impl From<&'static ast::PatternMatchMapping> for PatternMatchMapping { + fn from(node: &'static ast::PatternMatchMapping) -> Self { PatternMatchMapping(node) } } impl ToPyObject for PatternMatchMapping { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchMapping { +impl ToPyWrapper for ast::PatternMatchMapping { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchMapping(self).to_object(py)) } } @@ -3739,44 +3739,44 @@ impl PatternMatchMapping { #[getter] #[inline] fn get_keys(&self, py: Python) -> PyResult { - self.0.keys.to_pyo3_wrapper(py) + self.0.keys.to_py_wrapper(py) } #[getter] #[inline] fn get_patterns(&self, py: Python) -> PyResult { - self.0.patterns.to_pyo3_wrapper(py) + self.0.patterns.to_py_wrapper(py) } #[getter] #[inline] fn get_rest(&self, py: Python) -> PyResult { - self.0.rest.to_pyo3_wrapper(py) + self.0.rest.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_MatchClass", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchClass(pub &'static crate::PatternMatchClass); +pub struct PatternMatchClass(pub &'static ast::PatternMatchClass); -impl From<&'static crate::PatternMatchClass> for PatternMatchClass { - fn from(node: &'static crate::PatternMatchClass) -> Self { +impl From<&'static ast::PatternMatchClass> for PatternMatchClass { + fn from(node: &'static ast::PatternMatchClass) -> Self { PatternMatchClass(node) } } impl ToPyObject for PatternMatchClass { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchClass { +impl ToPyWrapper for ast::PatternMatchClass { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchClass(self).to_object(py)) } } @@ -3786,50 +3786,50 @@ impl PatternMatchClass { #[getter] #[inline] fn get_cls(&self, py: Python) -> PyResult { - self.0.cls.to_pyo3_wrapper(py) + self.0.cls.to_py_wrapper(py) } #[getter] #[inline] fn get_patterns(&self, py: Python) -> PyResult { - self.0.patterns.to_pyo3_wrapper(py) + self.0.patterns.to_py_wrapper(py) } #[getter] #[inline] fn get_kwd_attrs(&self, py: Python) -> PyResult { - self.0.kwd_attrs.to_pyo3_wrapper(py) + self.0.kwd_attrs.to_py_wrapper(py) } #[getter] #[inline] fn get_kwd_patterns(&self, py: Python) -> PyResult { - self.0.kwd_patterns.to_pyo3_wrapper(py) + self.0.kwd_patterns.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_MatchStar", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchStar(pub &'static crate::PatternMatchStar); +pub struct PatternMatchStar(pub &'static ast::PatternMatchStar); -impl From<&'static crate::PatternMatchStar> for PatternMatchStar { - fn from(node: &'static crate::PatternMatchStar) -> Self { +impl From<&'static ast::PatternMatchStar> for PatternMatchStar { + fn from(node: &'static ast::PatternMatchStar) -> Self { PatternMatchStar(node) } } impl ToPyObject for PatternMatchStar { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchStar { +impl ToPyWrapper for ast::PatternMatchStar { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchStar(self).to_object(py)) } } @@ -3839,32 +3839,32 @@ impl PatternMatchStar { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_MatchAs", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchAs(pub &'static crate::PatternMatchAs); +pub struct PatternMatchAs(pub &'static ast::PatternMatchAs); -impl From<&'static crate::PatternMatchAs> for PatternMatchAs { - fn from(node: &'static crate::PatternMatchAs) -> Self { +impl From<&'static ast::PatternMatchAs> for PatternMatchAs { + fn from(node: &'static ast::PatternMatchAs) -> Self { PatternMatchAs(node) } } impl ToPyObject for PatternMatchAs { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchAs { +impl ToPyWrapper for ast::PatternMatchAs { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchAs(self).to_object(py)) } } @@ -3874,38 +3874,38 @@ impl PatternMatchAs { #[getter] #[inline] fn get_pattern(&self, py: Python) -> PyResult { - self.0.pattern.to_pyo3_wrapper(py) + self.0.pattern.to_py_wrapper(py) } #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.located", name="_MatchOr", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchOr(pub &'static crate::PatternMatchOr); +pub struct PatternMatchOr(pub &'static ast::PatternMatchOr); -impl From<&'static crate::PatternMatchOr> for PatternMatchOr { - fn from(node: &'static crate::PatternMatchOr) -> Self { +impl From<&'static ast::PatternMatchOr> for PatternMatchOr { + fn from(node: &'static ast::PatternMatchOr) -> Self { PatternMatchOr(node) } } impl ToPyObject for PatternMatchOr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchOr { +impl ToPyWrapper for ast::PatternMatchOr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchOr(self).to_object(py)) } } @@ -3915,16 +3915,16 @@ impl PatternMatchOr { #[getter] #[inline] fn get_patterns(&self, py: Python) -> PyResult { - self.0.patterns.to_pyo3_wrapper(py) + self.0.patterns.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.located", name="_type_ignore", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.located", name="_type_ignore", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct TypeIgnore; -impl From<&'static crate::TypeIgnore> for TypeIgnore { - fn from(_node: &'static crate::TypeIgnore) -> Self { +impl From<&'static ast::TypeIgnore> for TypeIgnore { + fn from(_node: &'static ast::TypeIgnore) -> Self { TypeIgnore } } @@ -3933,7 +3933,7 @@ impl From<&'static crate::TypeIgnore> for TypeIgnore { impl TypeIgnore { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for TypeIgnore { @@ -3943,37 +3943,37 @@ impl ToPyObject for TypeIgnore { } } -impl ToPyo3Wrapper for crate::TypeIgnore { +impl ToPyWrapper for ast::TypeIgnore { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::TypeIgnore(cons) => cons.to_pyo3_wrapper(py), + Self::TypeIgnore(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.located", name="_TypeIgnore", extends=TypeIgnore, frozen)] #[derive(Clone, Debug)] -pub struct TypeIgnoreTypeIgnore(pub &'static crate::TypeIgnoreTypeIgnore); +pub struct TypeIgnoreTypeIgnore(pub &'static ast::TypeIgnoreTypeIgnore); -impl From<&'static crate::TypeIgnoreTypeIgnore> for TypeIgnoreTypeIgnore { - fn from(node: &'static crate::TypeIgnoreTypeIgnore) -> Self { +impl From<&'static ast::TypeIgnoreTypeIgnore> for TypeIgnoreTypeIgnore { + fn from(node: &'static ast::TypeIgnoreTypeIgnore) -> Self { TypeIgnoreTypeIgnore(node) } } impl ToPyObject for TypeIgnoreTypeIgnore { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(TypeIgnore) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::TypeIgnoreTypeIgnore { +impl ToPyWrapper for ast::TypeIgnoreTypeIgnore { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(TypeIgnoreTypeIgnore(self).to_object(py)) } } @@ -3983,19 +3983,19 @@ impl TypeIgnoreTypeIgnore { #[getter] #[inline] fn get_lineno(&self, py: Python) -> PyResult { - self.0.lineno.to_pyo3_wrapper(py) + self.0.lineno.to_py_wrapper(py) } #[getter] #[inline] fn get_tag(&self, py: Python) -> PyResult { - self.0.tag.to_pyo3_wrapper(py) + self.0.tag.to_py_wrapper(py) } } -impl ToPyo3Wrapper for crate::generic::ExprContext { +impl ToPyWrapper for ast::ExprContext { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { match &self { Self::Load => Ok(ExprContextLoad.to_object(py)), Self::Store => Ok(ExprContextStore.to_object(py)), @@ -4004,30 +4004,30 @@ impl ToPyo3Wrapper for crate::generic::ExprContext { } } -impl ToPyo3Wrapper for crate::generic::ExprContextLoad { +impl ToPyWrapper for ast::ExprContextLoad { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(ExprContextLoad.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::ExprContextStore { +impl ToPyWrapper for ast::ExprContextStore { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(ExprContextStore.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::ExprContextDel { +impl ToPyWrapper for ast::ExprContextDel { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(ExprContextDel.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::Boolop { +impl ToPyWrapper for ast::Boolop { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { match &self { Self::And => Ok(BoolopAnd.to_object(py)), Self::Or => Ok(BoolopOr.to_object(py)), @@ -4035,23 +4035,23 @@ impl ToPyo3Wrapper for crate::generic::Boolop { } } -impl ToPyo3Wrapper for crate::generic::BoolopAnd { +impl ToPyWrapper for ast::BoolopAnd { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(BoolopAnd.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::BoolopOr { +impl ToPyWrapper for ast::BoolopOr { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(BoolopOr.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::Operator { +impl ToPyWrapper for ast::Operator { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { match &self { Self::Add => Ok(OperatorAdd.to_object(py)), Self::Sub => Ok(OperatorSub.to_object(py)), @@ -4070,100 +4070,100 @@ impl ToPyo3Wrapper for crate::generic::Operator { } } -impl ToPyo3Wrapper for crate::generic::OperatorAdd { +impl ToPyWrapper for ast::OperatorAdd { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorAdd.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorSub { +impl ToPyWrapper for ast::OperatorSub { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorSub.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorMult { +impl ToPyWrapper for ast::OperatorMult { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorMult.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorMatMult { +impl ToPyWrapper for ast::OperatorMatMult { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorMatMult.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorDiv { +impl ToPyWrapper for ast::OperatorDiv { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorDiv.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorMod { +impl ToPyWrapper for ast::OperatorMod { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorMod.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorPow { +impl ToPyWrapper for ast::OperatorPow { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorPow.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorLShift { +impl ToPyWrapper for ast::OperatorLShift { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorLShift.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorRShift { +impl ToPyWrapper for ast::OperatorRShift { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorRShift.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorBitOr { +impl ToPyWrapper for ast::OperatorBitOr { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorBitOr.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorBitXor { +impl ToPyWrapper for ast::OperatorBitXor { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorBitXor.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorBitAnd { +impl ToPyWrapper for ast::OperatorBitAnd { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorBitAnd.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::OperatorFloorDiv { +impl ToPyWrapper for ast::OperatorFloorDiv { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(OperatorFloorDiv.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::Unaryop { +impl ToPyWrapper for ast::Unaryop { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { match &self { Self::Invert => Ok(UnaryopInvert.to_object(py)), Self::Not => Ok(UnaryopNot.to_object(py)), @@ -4173,37 +4173,37 @@ impl ToPyo3Wrapper for crate::generic::Unaryop { } } -impl ToPyo3Wrapper for crate::generic::UnaryopInvert { +impl ToPyWrapper for ast::UnaryopInvert { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(UnaryopInvert.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::UnaryopNot { +impl ToPyWrapper for ast::UnaryopNot { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(UnaryopNot.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::UnaryopUAdd { +impl ToPyWrapper for ast::UnaryopUAdd { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(UnaryopUAdd.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::UnaryopUSub { +impl ToPyWrapper for ast::UnaryopUSub { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(UnaryopUSub.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::Cmpop { +impl ToPyWrapper for ast::Cmpop { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { match &self { Self::Eq => Ok(CmpopEq.to_object(py)), Self::NotEq => Ok(CmpopNotEq.to_object(py)), @@ -4219,197 +4219,195 @@ impl ToPyo3Wrapper for crate::generic::Cmpop { } } -impl ToPyo3Wrapper for crate::generic::CmpopEq { +impl ToPyWrapper for ast::CmpopEq { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopEq.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopNotEq { +impl ToPyWrapper for ast::CmpopNotEq { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopNotEq.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopLt { +impl ToPyWrapper for ast::CmpopLt { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopLt.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopLtE { +impl ToPyWrapper for ast::CmpopLtE { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopLtE.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopGt { +impl ToPyWrapper for ast::CmpopGt { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopGt.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopGtE { +impl ToPyWrapper for ast::CmpopGtE { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopGtE.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopIs { +impl ToPyWrapper for ast::CmpopIs { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopIs.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopIsNot { +impl ToPyWrapper for ast::CmpopIsNot { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopIsNot.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopIn { +impl ToPyWrapper for ast::CmpopIn { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopIn.to_object(py)) } } -impl ToPyo3Wrapper for crate::generic::CmpopNotIn { +impl ToPyWrapper for ast::CmpopNotIn { #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> { + fn to_py_wrapper(&self, py: Python) -> PyResult> { Ok(CmpopNotIn.to_object(py)) } } pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> { super::init_module(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::( - py, m, - )?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; Ok(()) } diff --git a/ast/src/gen/pyo3_wrapper_ranged.rs b/ast-pyo3/src/gen/wrapper_ranged.rs similarity index 55% rename from ast/src/gen/pyo3_wrapper_ranged.rs rename to ast-pyo3/src/gen/wrapper_ranged.rs index dfa0a30a..f22a5601 100644 --- a/ast/src/gen/pyo3_wrapper_ranged.rs +++ b/ast-pyo3/src/gen/wrapper_ranged.rs @@ -1,11 +1,11 @@ // File automatically generated by ast/asdl_rs.py. -#[pyclass(module="rustpython_ast.ranged", name="_mod", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_mod", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Mod; -impl From<&'static crate::Mod> for Mod { - fn from(_node: &'static crate::Mod) -> Self { +impl From<&'static ast::Mod> for Mod { + fn from(_node: &'static ast::Mod) -> Self { Mod } } @@ -14,7 +14,7 @@ impl From<&'static crate::Mod> for Mod { impl Mod { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Mod { @@ -24,40 +24,40 @@ impl ToPyObject for Mod { } } -impl ToPyo3Wrapper for crate::Mod { +impl ToPyWrapper for ast::Mod { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::Module(cons) => cons.to_pyo3_wrapper(py), - Self::Interactive(cons) => cons.to_pyo3_wrapper(py), - Self::Expression(cons) => cons.to_pyo3_wrapper(py), - Self::FunctionType(cons) => cons.to_pyo3_wrapper(py), + Self::Module(cons) => cons.to_py_wrapper(py), + Self::Interactive(cons) => cons.to_py_wrapper(py), + Self::Expression(cons) => cons.to_py_wrapper(py), + Self::FunctionType(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.ranged", name="_Module", extends=Mod, frozen)] #[derive(Clone, Debug)] -pub struct ModModule(pub &'static crate::ModModule); +pub struct ModModule(pub &'static ast::ModModule); -impl From<&'static crate::ModModule> for ModModule { - fn from(node: &'static crate::ModModule) -> Self { +impl From<&'static ast::ModModule> for ModModule { + fn from(node: &'static ast::ModModule) -> Self { ModModule(node) } } impl ToPyObject for ModModule { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Mod) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ModModule { +impl ToPyWrapper for ast::ModModule { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ModModule(self).to_object(py)) } } @@ -67,38 +67,38 @@ impl ModModule { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_type_ignores(&self, py: Python) -> PyResult { - self.0.type_ignores.to_pyo3_wrapper(py) + self.0.type_ignores.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Interactive", extends=Mod, frozen)] #[derive(Clone, Debug)] -pub struct ModInteractive(pub &'static crate::ModInteractive); +pub struct ModInteractive(pub &'static ast::ModInteractive); -impl From<&'static crate::ModInteractive> for ModInteractive { - fn from(node: &'static crate::ModInteractive) -> Self { +impl From<&'static ast::ModInteractive> for ModInteractive { + fn from(node: &'static ast::ModInteractive) -> Self { ModInteractive(node) } } impl ToPyObject for ModInteractive { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Mod) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ModInteractive { +impl ToPyWrapper for ast::ModInteractive { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ModInteractive(self).to_object(py)) } } @@ -108,32 +108,32 @@ impl ModInteractive { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Expression", extends=Mod, frozen)] #[derive(Clone, Debug)] -pub struct ModExpression(pub &'static crate::ModExpression); +pub struct ModExpression(pub &'static ast::ModExpression); -impl From<&'static crate::ModExpression> for ModExpression { - fn from(node: &'static crate::ModExpression) -> Self { +impl From<&'static ast::ModExpression> for ModExpression { + fn from(node: &'static ast::ModExpression) -> Self { ModExpression(node) } } impl ToPyObject for ModExpression { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Mod) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ModExpression { +impl ToPyWrapper for ast::ModExpression { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ModExpression(self).to_object(py)) } } @@ -143,32 +143,32 @@ impl ModExpression { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_FunctionType", extends=Mod, frozen)] #[derive(Clone, Debug)] -pub struct ModFunctionType(pub &'static crate::ModFunctionType); +pub struct ModFunctionType(pub &'static ast::ModFunctionType); -impl From<&'static crate::ModFunctionType> for ModFunctionType { - fn from(node: &'static crate::ModFunctionType) -> Self { +impl From<&'static ast::ModFunctionType> for ModFunctionType { + fn from(node: &'static ast::ModFunctionType) -> Self { ModFunctionType(node) } } impl ToPyObject for ModFunctionType { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Mod) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ModFunctionType { +impl ToPyWrapper for ast::ModFunctionType { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ModFunctionType(self).to_object(py)) } } @@ -178,22 +178,22 @@ impl ModFunctionType { #[getter] #[inline] fn get_argtypes(&self, py: Python) -> PyResult { - self.0.argtypes.to_pyo3_wrapper(py) + self.0.argtypes.to_py_wrapper(py) } #[getter] #[inline] fn get_returns(&self, py: Python) -> PyResult { - self.0.returns.to_pyo3_wrapper(py) + self.0.returns.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_stmt", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_stmt", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Stmt; -impl From<&'static crate::Stmt> for Stmt { - fn from(_node: &'static crate::Stmt) -> Self { +impl From<&'static ast::Stmt> for Stmt { + fn from(_node: &'static ast::Stmt) -> Self { Stmt } } @@ -202,7 +202,7 @@ impl From<&'static crate::Stmt> for Stmt { impl Stmt { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Stmt { @@ -212,63 +212,63 @@ impl ToPyObject for Stmt { } } -impl ToPyo3Wrapper for crate::Stmt { +impl ToPyWrapper for ast::Stmt { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::FunctionDef(cons) => cons.to_pyo3_wrapper(py), - Self::AsyncFunctionDef(cons) => cons.to_pyo3_wrapper(py), - Self::ClassDef(cons) => cons.to_pyo3_wrapper(py), - Self::Return(cons) => cons.to_pyo3_wrapper(py), - Self::Delete(cons) => cons.to_pyo3_wrapper(py), - Self::Assign(cons) => cons.to_pyo3_wrapper(py), - Self::AugAssign(cons) => cons.to_pyo3_wrapper(py), - Self::AnnAssign(cons) => cons.to_pyo3_wrapper(py), - Self::For(cons) => cons.to_pyo3_wrapper(py), - Self::AsyncFor(cons) => cons.to_pyo3_wrapper(py), - Self::While(cons) => cons.to_pyo3_wrapper(py), - Self::If(cons) => cons.to_pyo3_wrapper(py), - Self::With(cons) => cons.to_pyo3_wrapper(py), - Self::AsyncWith(cons) => cons.to_pyo3_wrapper(py), - Self::Match(cons) => cons.to_pyo3_wrapper(py), - Self::Raise(cons) => cons.to_pyo3_wrapper(py), - Self::Try(cons) => cons.to_pyo3_wrapper(py), - Self::TryStar(cons) => cons.to_pyo3_wrapper(py), - Self::Assert(cons) => cons.to_pyo3_wrapper(py), - Self::Import(cons) => cons.to_pyo3_wrapper(py), - Self::ImportFrom(cons) => cons.to_pyo3_wrapper(py), - Self::Global(cons) => cons.to_pyo3_wrapper(py), - Self::Nonlocal(cons) => cons.to_pyo3_wrapper(py), - Self::Expr(cons) => cons.to_pyo3_wrapper(py), - Self::Pass(cons) => cons.to_pyo3_wrapper(py), - Self::Break(cons) => cons.to_pyo3_wrapper(py), - Self::Continue(cons) => cons.to_pyo3_wrapper(py), + Self::FunctionDef(cons) => cons.to_py_wrapper(py), + Self::AsyncFunctionDef(cons) => cons.to_py_wrapper(py), + Self::ClassDef(cons) => cons.to_py_wrapper(py), + Self::Return(cons) => cons.to_py_wrapper(py), + Self::Delete(cons) => cons.to_py_wrapper(py), + Self::Assign(cons) => cons.to_py_wrapper(py), + Self::AugAssign(cons) => cons.to_py_wrapper(py), + Self::AnnAssign(cons) => cons.to_py_wrapper(py), + Self::For(cons) => cons.to_py_wrapper(py), + Self::AsyncFor(cons) => cons.to_py_wrapper(py), + Self::While(cons) => cons.to_py_wrapper(py), + Self::If(cons) => cons.to_py_wrapper(py), + Self::With(cons) => cons.to_py_wrapper(py), + Self::AsyncWith(cons) => cons.to_py_wrapper(py), + Self::Match(cons) => cons.to_py_wrapper(py), + Self::Raise(cons) => cons.to_py_wrapper(py), + Self::Try(cons) => cons.to_py_wrapper(py), + Self::TryStar(cons) => cons.to_py_wrapper(py), + Self::Assert(cons) => cons.to_py_wrapper(py), + Self::Import(cons) => cons.to_py_wrapper(py), + Self::ImportFrom(cons) => cons.to_py_wrapper(py), + Self::Global(cons) => cons.to_py_wrapper(py), + Self::Nonlocal(cons) => cons.to_py_wrapper(py), + Self::Expr(cons) => cons.to_py_wrapper(py), + Self::Pass(cons) => cons.to_py_wrapper(py), + Self::Break(cons) => cons.to_py_wrapper(py), + Self::Continue(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.ranged", name="_FunctionDef", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtFunctionDef(pub &'static crate::StmtFunctionDef); +pub struct StmtFunctionDef(pub &'static ast::StmtFunctionDef); -impl From<&'static crate::StmtFunctionDef> for StmtFunctionDef { - fn from(node: &'static crate::StmtFunctionDef) -> Self { +impl From<&'static ast::StmtFunctionDef> for StmtFunctionDef { + fn from(node: &'static ast::StmtFunctionDef) -> Self { StmtFunctionDef(node) } } impl ToPyObject for StmtFunctionDef { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtFunctionDef { +impl ToPyWrapper for ast::StmtFunctionDef { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtFunctionDef(self).to_object(py)) } } @@ -278,62 +278,62 @@ impl StmtFunctionDef { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_decorator_list(&self, py: Python) -> PyResult { - self.0.decorator_list.to_pyo3_wrapper(py) + self.0.decorator_list.to_py_wrapper(py) } #[getter] #[inline] fn get_returns(&self, py: Python) -> PyResult { - self.0.returns.to_pyo3_wrapper(py) + self.0.returns.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_AsyncFunctionDef", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAsyncFunctionDef(pub &'static crate::StmtAsyncFunctionDef); +pub struct StmtAsyncFunctionDef(pub &'static ast::StmtAsyncFunctionDef); -impl From<&'static crate::StmtAsyncFunctionDef> for StmtAsyncFunctionDef { - fn from(node: &'static crate::StmtAsyncFunctionDef) -> Self { +impl From<&'static ast::StmtAsyncFunctionDef> for StmtAsyncFunctionDef { + fn from(node: &'static ast::StmtAsyncFunctionDef) -> Self { StmtAsyncFunctionDef(node) } } impl ToPyObject for StmtAsyncFunctionDef { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAsyncFunctionDef { +impl ToPyWrapper for ast::StmtAsyncFunctionDef { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAsyncFunctionDef(self).to_object(py)) } } @@ -343,62 +343,62 @@ impl StmtAsyncFunctionDef { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_decorator_list(&self, py: Python) -> PyResult { - self.0.decorator_list.to_pyo3_wrapper(py) + self.0.decorator_list.to_py_wrapper(py) } #[getter] #[inline] fn get_returns(&self, py: Python) -> PyResult { - self.0.returns.to_pyo3_wrapper(py) + self.0.returns.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_ClassDef", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtClassDef(pub &'static crate::StmtClassDef); +pub struct StmtClassDef(pub &'static ast::StmtClassDef); -impl From<&'static crate::StmtClassDef> for StmtClassDef { - fn from(node: &'static crate::StmtClassDef) -> Self { +impl From<&'static ast::StmtClassDef> for StmtClassDef { + fn from(node: &'static ast::StmtClassDef) -> Self { StmtClassDef(node) } } impl ToPyObject for StmtClassDef { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtClassDef { +impl ToPyWrapper for ast::StmtClassDef { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtClassDef(self).to_object(py)) } } @@ -408,56 +408,56 @@ impl StmtClassDef { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_bases(&self, py: Python) -> PyResult { - self.0.bases.to_pyo3_wrapper(py) + self.0.bases.to_py_wrapper(py) } #[getter] #[inline] fn get_keywords(&self, py: Python) -> PyResult { - self.0.keywords.to_pyo3_wrapper(py) + self.0.keywords.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_decorator_list(&self, py: Python) -> PyResult { - self.0.decorator_list.to_pyo3_wrapper(py) + self.0.decorator_list.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Return", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtReturn(pub &'static crate::StmtReturn); +pub struct StmtReturn(pub &'static ast::StmtReturn); -impl From<&'static crate::StmtReturn> for StmtReturn { - fn from(node: &'static crate::StmtReturn) -> Self { +impl From<&'static ast::StmtReturn> for StmtReturn { + fn from(node: &'static ast::StmtReturn) -> Self { StmtReturn(node) } } impl ToPyObject for StmtReturn { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtReturn { +impl ToPyWrapper for ast::StmtReturn { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtReturn(self).to_object(py)) } } @@ -467,32 +467,32 @@ impl StmtReturn { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Delete", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtDelete(pub &'static crate::StmtDelete); +pub struct StmtDelete(pub &'static ast::StmtDelete); -impl From<&'static crate::StmtDelete> for StmtDelete { - fn from(node: &'static crate::StmtDelete) -> Self { +impl From<&'static ast::StmtDelete> for StmtDelete { + fn from(node: &'static ast::StmtDelete) -> Self { StmtDelete(node) } } impl ToPyObject for StmtDelete { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtDelete { +impl ToPyWrapper for ast::StmtDelete { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtDelete(self).to_object(py)) } } @@ -502,32 +502,32 @@ impl StmtDelete { #[getter] #[inline] fn get_targets(&self, py: Python) -> PyResult { - self.0.targets.to_pyo3_wrapper(py) + self.0.targets.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Assign", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAssign(pub &'static crate::StmtAssign); +pub struct StmtAssign(pub &'static ast::StmtAssign); -impl From<&'static crate::StmtAssign> for StmtAssign { - fn from(node: &'static crate::StmtAssign) -> Self { +impl From<&'static ast::StmtAssign> for StmtAssign { + fn from(node: &'static ast::StmtAssign) -> Self { StmtAssign(node) } } impl ToPyObject for StmtAssign { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAssign { +impl ToPyWrapper for ast::StmtAssign { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAssign(self).to_object(py)) } } @@ -537,44 +537,44 @@ impl StmtAssign { #[getter] #[inline] fn get_targets(&self, py: Python) -> PyResult { - self.0.targets.to_pyo3_wrapper(py) + self.0.targets.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_AugAssign", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAugAssign(pub &'static crate::StmtAugAssign); +pub struct StmtAugAssign(pub &'static ast::StmtAugAssign); -impl From<&'static crate::StmtAugAssign> for StmtAugAssign { - fn from(node: &'static crate::StmtAugAssign) -> Self { +impl From<&'static ast::StmtAugAssign> for StmtAugAssign { + fn from(node: &'static ast::StmtAugAssign) -> Self { StmtAugAssign(node) } } impl ToPyObject for StmtAugAssign { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAugAssign { +impl ToPyWrapper for ast::StmtAugAssign { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAugAssign(self).to_object(py)) } } @@ -584,44 +584,44 @@ impl StmtAugAssign { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_op(&self, py: Python) -> PyResult { - self.0.op.to_pyo3_wrapper(py) + self.0.op.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_AnnAssign", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAnnAssign(pub &'static crate::StmtAnnAssign); +pub struct StmtAnnAssign(pub &'static ast::StmtAnnAssign); -impl From<&'static crate::StmtAnnAssign> for StmtAnnAssign { - fn from(node: &'static crate::StmtAnnAssign) -> Self { +impl From<&'static ast::StmtAnnAssign> for StmtAnnAssign { + fn from(node: &'static ast::StmtAnnAssign) -> Self { StmtAnnAssign(node) } } impl ToPyObject for StmtAnnAssign { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAnnAssign { +impl ToPyWrapper for ast::StmtAnnAssign { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAnnAssign(self).to_object(py)) } } @@ -631,50 +631,50 @@ impl StmtAnnAssign { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_annotation(&self, py: Python) -> PyResult { - self.0.annotation.to_pyo3_wrapper(py) + self.0.annotation.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_simple(&self, py: Python) -> PyResult { - self.0.simple.to_pyo3_wrapper(py) + self.0.simple.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_For", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtFor(pub &'static crate::StmtFor); +pub struct StmtFor(pub &'static ast::StmtFor); -impl From<&'static crate::StmtFor> for StmtFor { - fn from(node: &'static crate::StmtFor) -> Self { +impl From<&'static ast::StmtFor> for StmtFor { + fn from(node: &'static ast::StmtFor) -> Self { StmtFor(node) } } impl ToPyObject for StmtFor { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtFor { +impl ToPyWrapper for ast::StmtFor { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtFor(self).to_object(py)) } } @@ -684,56 +684,56 @@ impl StmtFor { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_iter(&self, py: Python) -> PyResult { - self.0.iter.to_pyo3_wrapper(py) + self.0.iter.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_AsyncFor", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAsyncFor(pub &'static crate::StmtAsyncFor); +pub struct StmtAsyncFor(pub &'static ast::StmtAsyncFor); -impl From<&'static crate::StmtAsyncFor> for StmtAsyncFor { - fn from(node: &'static crate::StmtAsyncFor) -> Self { +impl From<&'static ast::StmtAsyncFor> for StmtAsyncFor { + fn from(node: &'static ast::StmtAsyncFor) -> Self { StmtAsyncFor(node) } } impl ToPyObject for StmtAsyncFor { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAsyncFor { +impl ToPyWrapper for ast::StmtAsyncFor { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAsyncFor(self).to_object(py)) } } @@ -743,56 +743,56 @@ impl StmtAsyncFor { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_iter(&self, py: Python) -> PyResult { - self.0.iter.to_pyo3_wrapper(py) + self.0.iter.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_While", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtWhile(pub &'static crate::StmtWhile); +pub struct StmtWhile(pub &'static ast::StmtWhile); -impl From<&'static crate::StmtWhile> for StmtWhile { - fn from(node: &'static crate::StmtWhile) -> Self { +impl From<&'static ast::StmtWhile> for StmtWhile { + fn from(node: &'static ast::StmtWhile) -> Self { StmtWhile(node) } } impl ToPyObject for StmtWhile { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtWhile { +impl ToPyWrapper for ast::StmtWhile { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtWhile(self).to_object(py)) } } @@ -802,44 +802,44 @@ impl StmtWhile { #[getter] #[inline] fn get_test(&self, py: Python) -> PyResult { - self.0.test.to_pyo3_wrapper(py) + self.0.test.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_If", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtIf(pub &'static crate::StmtIf); +pub struct StmtIf(pub &'static ast::StmtIf); -impl From<&'static crate::StmtIf> for StmtIf { - fn from(node: &'static crate::StmtIf) -> Self { +impl From<&'static ast::StmtIf> for StmtIf { + fn from(node: &'static ast::StmtIf) -> Self { StmtIf(node) } } impl ToPyObject for StmtIf { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtIf { +impl ToPyWrapper for ast::StmtIf { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtIf(self).to_object(py)) } } @@ -849,44 +849,44 @@ impl StmtIf { #[getter] #[inline] fn get_test(&self, py: Python) -> PyResult { - self.0.test.to_pyo3_wrapper(py) + self.0.test.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_With", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtWith(pub &'static crate::StmtWith); +pub struct StmtWith(pub &'static ast::StmtWith); -impl From<&'static crate::StmtWith> for StmtWith { - fn from(node: &'static crate::StmtWith) -> Self { +impl From<&'static ast::StmtWith> for StmtWith { + fn from(node: &'static ast::StmtWith) -> Self { StmtWith(node) } } impl ToPyObject for StmtWith { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtWith { +impl ToPyWrapper for ast::StmtWith { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtWith(self).to_object(py)) } } @@ -896,44 +896,44 @@ impl StmtWith { #[getter] #[inline] fn get_items(&self, py: Python) -> PyResult { - self.0.items.to_pyo3_wrapper(py) + self.0.items.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_AsyncWith", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAsyncWith(pub &'static crate::StmtAsyncWith); +pub struct StmtAsyncWith(pub &'static ast::StmtAsyncWith); -impl From<&'static crate::StmtAsyncWith> for StmtAsyncWith { - fn from(node: &'static crate::StmtAsyncWith) -> Self { +impl From<&'static ast::StmtAsyncWith> for StmtAsyncWith { + fn from(node: &'static ast::StmtAsyncWith) -> Self { StmtAsyncWith(node) } } impl ToPyObject for StmtAsyncWith { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAsyncWith { +impl ToPyWrapper for ast::StmtAsyncWith { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAsyncWith(self).to_object(py)) } } @@ -943,44 +943,44 @@ impl StmtAsyncWith { #[getter] #[inline] fn get_items(&self, py: Python) -> PyResult { - self.0.items.to_pyo3_wrapper(py) + self.0.items.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Match", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtMatch(pub &'static crate::StmtMatch); +pub struct StmtMatch(pub &'static ast::StmtMatch); -impl From<&'static crate::StmtMatch> for StmtMatch { - fn from(node: &'static crate::StmtMatch) -> Self { +impl From<&'static ast::StmtMatch> for StmtMatch { + fn from(node: &'static ast::StmtMatch) -> Self { StmtMatch(node) } } impl ToPyObject for StmtMatch { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtMatch { +impl ToPyWrapper for ast::StmtMatch { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtMatch(self).to_object(py)) } } @@ -990,38 +990,38 @@ impl StmtMatch { #[getter] #[inline] fn get_subject(&self, py: Python) -> PyResult { - self.0.subject.to_pyo3_wrapper(py) + self.0.subject.to_py_wrapper(py) } #[getter] #[inline] fn get_cases(&self, py: Python) -> PyResult { - self.0.cases.to_pyo3_wrapper(py) + self.0.cases.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Raise", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtRaise(pub &'static crate::StmtRaise); +pub struct StmtRaise(pub &'static ast::StmtRaise); -impl From<&'static crate::StmtRaise> for StmtRaise { - fn from(node: &'static crate::StmtRaise) -> Self { +impl From<&'static ast::StmtRaise> for StmtRaise { + fn from(node: &'static ast::StmtRaise) -> Self { StmtRaise(node) } } impl ToPyObject for StmtRaise { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtRaise { +impl ToPyWrapper for ast::StmtRaise { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtRaise(self).to_object(py)) } } @@ -1031,38 +1031,38 @@ impl StmtRaise { #[getter] #[inline] fn get_exc(&self, py: Python) -> PyResult { - self.0.exc.to_pyo3_wrapper(py) + self.0.exc.to_py_wrapper(py) } #[getter] #[inline] fn get_cause(&self, py: Python) -> PyResult { - self.0.cause.to_pyo3_wrapper(py) + self.0.cause.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Try", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtTry(pub &'static crate::StmtTry); +pub struct StmtTry(pub &'static ast::StmtTry); -impl From<&'static crate::StmtTry> for StmtTry { - fn from(node: &'static crate::StmtTry) -> Self { +impl From<&'static ast::StmtTry> for StmtTry { + fn from(node: &'static ast::StmtTry) -> Self { StmtTry(node) } } impl ToPyObject for StmtTry { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtTry { +impl ToPyWrapper for ast::StmtTry { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtTry(self).to_object(py)) } } @@ -1072,50 +1072,50 @@ impl StmtTry { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_handlers(&self, py: Python) -> PyResult { - self.0.handlers.to_pyo3_wrapper(py) + self.0.handlers.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } #[getter] #[inline] fn get_finalbody(&self, py: Python) -> PyResult { - self.0.finalbody.to_pyo3_wrapper(py) + self.0.finalbody.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_TryStar", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtTryStar(pub &'static crate::StmtTryStar); +pub struct StmtTryStar(pub &'static ast::StmtTryStar); -impl From<&'static crate::StmtTryStar> for StmtTryStar { - fn from(node: &'static crate::StmtTryStar) -> Self { +impl From<&'static ast::StmtTryStar> for StmtTryStar { + fn from(node: &'static ast::StmtTryStar) -> Self { StmtTryStar(node) } } impl ToPyObject for StmtTryStar { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtTryStar { +impl ToPyWrapper for ast::StmtTryStar { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtTryStar(self).to_object(py)) } } @@ -1125,50 +1125,50 @@ impl StmtTryStar { #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_handlers(&self, py: Python) -> PyResult { - self.0.handlers.to_pyo3_wrapper(py) + self.0.handlers.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } #[getter] #[inline] fn get_finalbody(&self, py: Python) -> PyResult { - self.0.finalbody.to_pyo3_wrapper(py) + self.0.finalbody.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Assert", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtAssert(pub &'static crate::StmtAssert); +pub struct StmtAssert(pub &'static ast::StmtAssert); -impl From<&'static crate::StmtAssert> for StmtAssert { - fn from(node: &'static crate::StmtAssert) -> Self { +impl From<&'static ast::StmtAssert> for StmtAssert { + fn from(node: &'static ast::StmtAssert) -> Self { StmtAssert(node) } } impl ToPyObject for StmtAssert { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtAssert { +impl ToPyWrapper for ast::StmtAssert { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtAssert(self).to_object(py)) } } @@ -1178,38 +1178,38 @@ impl StmtAssert { #[getter] #[inline] fn get_test(&self, py: Python) -> PyResult { - self.0.test.to_pyo3_wrapper(py) + self.0.test.to_py_wrapper(py) } #[getter] #[inline] fn get_msg(&self, py: Python) -> PyResult { - self.0.msg.to_pyo3_wrapper(py) + self.0.msg.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Import", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtImport(pub &'static crate::StmtImport); +pub struct StmtImport(pub &'static ast::StmtImport); -impl From<&'static crate::StmtImport> for StmtImport { - fn from(node: &'static crate::StmtImport) -> Self { +impl From<&'static ast::StmtImport> for StmtImport { + fn from(node: &'static ast::StmtImport) -> Self { StmtImport(node) } } impl ToPyObject for StmtImport { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtImport { +impl ToPyWrapper for ast::StmtImport { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtImport(self).to_object(py)) } } @@ -1219,32 +1219,32 @@ impl StmtImport { #[getter] #[inline] fn get_names(&self, py: Python) -> PyResult { - self.0.names.to_pyo3_wrapper(py) + self.0.names.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_ImportFrom", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtImportFrom(pub &'static crate::StmtImportFrom); +pub struct StmtImportFrom(pub &'static ast::StmtImportFrom); -impl From<&'static crate::StmtImportFrom> for StmtImportFrom { - fn from(node: &'static crate::StmtImportFrom) -> Self { +impl From<&'static ast::StmtImportFrom> for StmtImportFrom { + fn from(node: &'static ast::StmtImportFrom) -> Self { StmtImportFrom(node) } } impl ToPyObject for StmtImportFrom { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtImportFrom { +impl ToPyWrapper for ast::StmtImportFrom { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtImportFrom(self).to_object(py)) } } @@ -1254,44 +1254,44 @@ impl StmtImportFrom { #[getter] #[inline] fn get_module(&self, py: Python) -> PyResult { - self.0.module.to_pyo3_wrapper(py) + self.0.module.to_py_wrapper(py) } #[getter] #[inline] fn get_names(&self, py: Python) -> PyResult { - self.0.names.to_pyo3_wrapper(py) + self.0.names.to_py_wrapper(py) } #[getter] #[inline] fn get_level(&self, py: Python) -> PyResult { - self.0.level.to_pyo3_wrapper(py) + self.0.level.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Global", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtGlobal(pub &'static crate::StmtGlobal); +pub struct StmtGlobal(pub &'static ast::StmtGlobal); -impl From<&'static crate::StmtGlobal> for StmtGlobal { - fn from(node: &'static crate::StmtGlobal) -> Self { +impl From<&'static ast::StmtGlobal> for StmtGlobal { + fn from(node: &'static ast::StmtGlobal) -> Self { StmtGlobal(node) } } impl ToPyObject for StmtGlobal { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtGlobal { +impl ToPyWrapper for ast::StmtGlobal { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtGlobal(self).to_object(py)) } } @@ -1301,32 +1301,32 @@ impl StmtGlobal { #[getter] #[inline] fn get_names(&self, py: Python) -> PyResult { - self.0.names.to_pyo3_wrapper(py) + self.0.names.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Nonlocal", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtNonlocal(pub &'static crate::StmtNonlocal); +pub struct StmtNonlocal(pub &'static ast::StmtNonlocal); -impl From<&'static crate::StmtNonlocal> for StmtNonlocal { - fn from(node: &'static crate::StmtNonlocal) -> Self { +impl From<&'static ast::StmtNonlocal> for StmtNonlocal { + fn from(node: &'static ast::StmtNonlocal) -> Self { StmtNonlocal(node) } } impl ToPyObject for StmtNonlocal { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtNonlocal { +impl ToPyWrapper for ast::StmtNonlocal { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtNonlocal(self).to_object(py)) } } @@ -1336,32 +1336,32 @@ impl StmtNonlocal { #[getter] #[inline] fn get_names(&self, py: Python) -> PyResult { - self.0.names.to_pyo3_wrapper(py) + self.0.names.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Expr", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtExpr(pub &'static crate::StmtExpr); +pub struct StmtExpr(pub &'static ast::StmtExpr); -impl From<&'static crate::StmtExpr> for StmtExpr { - fn from(node: &'static crate::StmtExpr) -> Self { +impl From<&'static ast::StmtExpr> for StmtExpr { + fn from(node: &'static ast::StmtExpr) -> Self { StmtExpr(node) } } impl ToPyObject for StmtExpr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtExpr { +impl ToPyWrapper for ast::StmtExpr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtExpr(self).to_object(py)) } } @@ -1371,32 +1371,32 @@ impl StmtExpr { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Pass", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtPass(pub &'static crate::StmtPass); +pub struct StmtPass(pub &'static ast::StmtPass); -impl From<&'static crate::StmtPass> for StmtPass { - fn from(node: &'static crate::StmtPass) -> Self { +impl From<&'static ast::StmtPass> for StmtPass { + fn from(node: &'static ast::StmtPass) -> Self { StmtPass(node) } } impl ToPyObject for StmtPass { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtPass { +impl ToPyWrapper for ast::StmtPass { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtPass(self).to_object(py)) } } @@ -1406,26 +1406,26 @@ impl StmtPass {} #[pyclass(module="rustpython_ast.ranged", name="_Break", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtBreak(pub &'static crate::StmtBreak); +pub struct StmtBreak(pub &'static ast::StmtBreak); -impl From<&'static crate::StmtBreak> for StmtBreak { - fn from(node: &'static crate::StmtBreak) -> Self { +impl From<&'static ast::StmtBreak> for StmtBreak { + fn from(node: &'static ast::StmtBreak) -> Self { StmtBreak(node) } } impl ToPyObject for StmtBreak { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtBreak { +impl ToPyWrapper for ast::StmtBreak { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtBreak(self).to_object(py)) } } @@ -1435,26 +1435,26 @@ impl StmtBreak {} #[pyclass(module="rustpython_ast.ranged", name="_Continue", extends=Stmt, frozen)] #[derive(Clone, Debug)] -pub struct StmtContinue(pub &'static crate::StmtContinue); +pub struct StmtContinue(pub &'static ast::StmtContinue); -impl From<&'static crate::StmtContinue> for StmtContinue { - fn from(node: &'static crate::StmtContinue) -> Self { +impl From<&'static ast::StmtContinue> for StmtContinue { + fn from(node: &'static ast::StmtContinue) -> Self { StmtContinue(node) } } impl ToPyObject for StmtContinue { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Stmt) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::StmtContinue { +impl ToPyWrapper for ast::StmtContinue { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(StmtContinue(self).to_object(py)) } } @@ -1462,12 +1462,12 @@ impl ToPyo3Wrapper for crate::StmtContinue { #[pymethods] impl StmtContinue {} -#[pyclass(module="rustpython_ast.ranged", name="_expr", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_expr", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Expr; -impl From<&'static crate::Expr> for Expr { - fn from(_node: &'static crate::Expr) -> Self { +impl From<&'static ast::Expr> for Expr { + fn from(_node: &'static ast::Expr) -> Self { Expr } } @@ -1476,7 +1476,7 @@ impl From<&'static crate::Expr> for Expr { impl Expr { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Expr { @@ -1486,63 +1486,63 @@ impl ToPyObject for Expr { } } -impl ToPyo3Wrapper for crate::Expr { +impl ToPyWrapper for ast::Expr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::BoolOp(cons) => cons.to_pyo3_wrapper(py), - Self::NamedExpr(cons) => cons.to_pyo3_wrapper(py), - Self::BinOp(cons) => cons.to_pyo3_wrapper(py), - Self::UnaryOp(cons) => cons.to_pyo3_wrapper(py), - Self::Lambda(cons) => cons.to_pyo3_wrapper(py), - Self::IfExp(cons) => cons.to_pyo3_wrapper(py), - Self::Dict(cons) => cons.to_pyo3_wrapper(py), - Self::Set(cons) => cons.to_pyo3_wrapper(py), - Self::ListComp(cons) => cons.to_pyo3_wrapper(py), - Self::SetComp(cons) => cons.to_pyo3_wrapper(py), - Self::DictComp(cons) => cons.to_pyo3_wrapper(py), - Self::GeneratorExp(cons) => cons.to_pyo3_wrapper(py), - Self::Await(cons) => cons.to_pyo3_wrapper(py), - Self::Yield(cons) => cons.to_pyo3_wrapper(py), - Self::YieldFrom(cons) => cons.to_pyo3_wrapper(py), - Self::Compare(cons) => cons.to_pyo3_wrapper(py), - Self::Call(cons) => cons.to_pyo3_wrapper(py), - Self::FormattedValue(cons) => cons.to_pyo3_wrapper(py), - Self::JoinedStr(cons) => cons.to_pyo3_wrapper(py), - Self::Constant(cons) => cons.to_pyo3_wrapper(py), - Self::Attribute(cons) => cons.to_pyo3_wrapper(py), - Self::Subscript(cons) => cons.to_pyo3_wrapper(py), - Self::Starred(cons) => cons.to_pyo3_wrapper(py), - Self::Name(cons) => cons.to_pyo3_wrapper(py), - Self::List(cons) => cons.to_pyo3_wrapper(py), - Self::Tuple(cons) => cons.to_pyo3_wrapper(py), - Self::Slice(cons) => cons.to_pyo3_wrapper(py), + Self::BoolOp(cons) => cons.to_py_wrapper(py), + Self::NamedExpr(cons) => cons.to_py_wrapper(py), + Self::BinOp(cons) => cons.to_py_wrapper(py), + Self::UnaryOp(cons) => cons.to_py_wrapper(py), + Self::Lambda(cons) => cons.to_py_wrapper(py), + Self::IfExp(cons) => cons.to_py_wrapper(py), + Self::Dict(cons) => cons.to_py_wrapper(py), + Self::Set(cons) => cons.to_py_wrapper(py), + Self::ListComp(cons) => cons.to_py_wrapper(py), + Self::SetComp(cons) => cons.to_py_wrapper(py), + Self::DictComp(cons) => cons.to_py_wrapper(py), + Self::GeneratorExp(cons) => cons.to_py_wrapper(py), + Self::Await(cons) => cons.to_py_wrapper(py), + Self::Yield(cons) => cons.to_py_wrapper(py), + Self::YieldFrom(cons) => cons.to_py_wrapper(py), + Self::Compare(cons) => cons.to_py_wrapper(py), + Self::Call(cons) => cons.to_py_wrapper(py), + Self::FormattedValue(cons) => cons.to_py_wrapper(py), + Self::JoinedStr(cons) => cons.to_py_wrapper(py), + Self::Constant(cons) => cons.to_py_wrapper(py), + Self::Attribute(cons) => cons.to_py_wrapper(py), + Self::Subscript(cons) => cons.to_py_wrapper(py), + Self::Starred(cons) => cons.to_py_wrapper(py), + Self::Name(cons) => cons.to_py_wrapper(py), + Self::List(cons) => cons.to_py_wrapper(py), + Self::Tuple(cons) => cons.to_py_wrapper(py), + Self::Slice(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.ranged", name="_BoolOp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprBoolOp(pub &'static crate::ExprBoolOp); +pub struct ExprBoolOp(pub &'static ast::ExprBoolOp); -impl From<&'static crate::ExprBoolOp> for ExprBoolOp { - fn from(node: &'static crate::ExprBoolOp) -> Self { +impl From<&'static ast::ExprBoolOp> for ExprBoolOp { + fn from(node: &'static ast::ExprBoolOp) -> Self { ExprBoolOp(node) } } impl ToPyObject for ExprBoolOp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprBoolOp { +impl ToPyWrapper for ast::ExprBoolOp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprBoolOp(self).to_object(py)) } } @@ -1552,38 +1552,38 @@ impl ExprBoolOp { #[getter] #[inline] fn get_op(&self, py: Python) -> PyResult { - self.0.op.to_pyo3_wrapper(py) + self.0.op.to_py_wrapper(py) } #[getter] #[inline] fn get_values(&self, py: Python) -> PyResult { - self.0.values.to_pyo3_wrapper(py) + self.0.values.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_NamedExpr", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprNamedExpr(pub &'static crate::ExprNamedExpr); +pub struct ExprNamedExpr(pub &'static ast::ExprNamedExpr); -impl From<&'static crate::ExprNamedExpr> for ExprNamedExpr { - fn from(node: &'static crate::ExprNamedExpr) -> Self { +impl From<&'static ast::ExprNamedExpr> for ExprNamedExpr { + fn from(node: &'static ast::ExprNamedExpr) -> Self { ExprNamedExpr(node) } } impl ToPyObject for ExprNamedExpr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprNamedExpr { +impl ToPyWrapper for ast::ExprNamedExpr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprNamedExpr(self).to_object(py)) } } @@ -1593,38 +1593,38 @@ impl ExprNamedExpr { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_BinOp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprBinOp(pub &'static crate::ExprBinOp); +pub struct ExprBinOp(pub &'static ast::ExprBinOp); -impl From<&'static crate::ExprBinOp> for ExprBinOp { - fn from(node: &'static crate::ExprBinOp) -> Self { +impl From<&'static ast::ExprBinOp> for ExprBinOp { + fn from(node: &'static ast::ExprBinOp) -> Self { ExprBinOp(node) } } impl ToPyObject for ExprBinOp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprBinOp { +impl ToPyWrapper for ast::ExprBinOp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprBinOp(self).to_object(py)) } } @@ -1634,44 +1634,44 @@ impl ExprBinOp { #[getter] #[inline] fn get_left(&self, py: Python) -> PyResult { - self.0.left.to_pyo3_wrapper(py) + self.0.left.to_py_wrapper(py) } #[getter] #[inline] fn get_op(&self, py: Python) -> PyResult { - self.0.op.to_pyo3_wrapper(py) + self.0.op.to_py_wrapper(py) } #[getter] #[inline] fn get_right(&self, py: Python) -> PyResult { - self.0.right.to_pyo3_wrapper(py) + self.0.right.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_UnaryOp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprUnaryOp(pub &'static crate::ExprUnaryOp); +pub struct ExprUnaryOp(pub &'static ast::ExprUnaryOp); -impl From<&'static crate::ExprUnaryOp> for ExprUnaryOp { - fn from(node: &'static crate::ExprUnaryOp) -> Self { +impl From<&'static ast::ExprUnaryOp> for ExprUnaryOp { + fn from(node: &'static ast::ExprUnaryOp) -> Self { ExprUnaryOp(node) } } impl ToPyObject for ExprUnaryOp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprUnaryOp { +impl ToPyWrapper for ast::ExprUnaryOp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprUnaryOp(self).to_object(py)) } } @@ -1681,38 +1681,38 @@ impl ExprUnaryOp { #[getter] #[inline] fn get_op(&self, py: Python) -> PyResult { - self.0.op.to_pyo3_wrapper(py) + self.0.op.to_py_wrapper(py) } #[getter] #[inline] fn get_operand(&self, py: Python) -> PyResult { - self.0.operand.to_pyo3_wrapper(py) + self.0.operand.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Lambda", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprLambda(pub &'static crate::ExprLambda); +pub struct ExprLambda(pub &'static ast::ExprLambda); -impl From<&'static crate::ExprLambda> for ExprLambda { - fn from(node: &'static crate::ExprLambda) -> Self { +impl From<&'static ast::ExprLambda> for ExprLambda { + fn from(node: &'static ast::ExprLambda) -> Self { ExprLambda(node) } } impl ToPyObject for ExprLambda { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprLambda { +impl ToPyWrapper for ast::ExprLambda { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprLambda(self).to_object(py)) } } @@ -1722,38 +1722,38 @@ impl ExprLambda { #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_IfExp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprIfExp(pub &'static crate::ExprIfExp); +pub struct ExprIfExp(pub &'static ast::ExprIfExp); -impl From<&'static crate::ExprIfExp> for ExprIfExp { - fn from(node: &'static crate::ExprIfExp) -> Self { +impl From<&'static ast::ExprIfExp> for ExprIfExp { + fn from(node: &'static ast::ExprIfExp) -> Self { ExprIfExp(node) } } impl ToPyObject for ExprIfExp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprIfExp { +impl ToPyWrapper for ast::ExprIfExp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprIfExp(self).to_object(py)) } } @@ -1763,44 +1763,44 @@ impl ExprIfExp { #[getter] #[inline] fn get_test(&self, py: Python) -> PyResult { - self.0.test.to_pyo3_wrapper(py) + self.0.test.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } #[getter] #[inline] fn get_orelse(&self, py: Python) -> PyResult { - self.0.orelse.to_pyo3_wrapper(py) + self.0.orelse.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Dict", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprDict(pub &'static crate::ExprDict); +pub struct ExprDict(pub &'static ast::ExprDict); -impl From<&'static crate::ExprDict> for ExprDict { - fn from(node: &'static crate::ExprDict) -> Self { +impl From<&'static ast::ExprDict> for ExprDict { + fn from(node: &'static ast::ExprDict) -> Self { ExprDict(node) } } impl ToPyObject for ExprDict { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprDict { +impl ToPyWrapper for ast::ExprDict { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprDict(self).to_object(py)) } } @@ -1810,38 +1810,38 @@ impl ExprDict { #[getter] #[inline] fn get_keys(&self, py: Python) -> PyResult { - self.0.keys.to_pyo3_wrapper(py) + self.0.keys.to_py_wrapper(py) } #[getter] #[inline] fn get_values(&self, py: Python) -> PyResult { - self.0.values.to_pyo3_wrapper(py) + self.0.values.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Set", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprSet(pub &'static crate::ExprSet); +pub struct ExprSet(pub &'static ast::ExprSet); -impl From<&'static crate::ExprSet> for ExprSet { - fn from(node: &'static crate::ExprSet) -> Self { +impl From<&'static ast::ExprSet> for ExprSet { + fn from(node: &'static ast::ExprSet) -> Self { ExprSet(node) } } impl ToPyObject for ExprSet { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprSet { +impl ToPyWrapper for ast::ExprSet { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprSet(self).to_object(py)) } } @@ -1851,32 +1851,32 @@ impl ExprSet { #[getter] #[inline] fn get_elts(&self, py: Python) -> PyResult { - self.0.elts.to_pyo3_wrapper(py) + self.0.elts.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_ListComp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprListComp(pub &'static crate::ExprListComp); +pub struct ExprListComp(pub &'static ast::ExprListComp); -impl From<&'static crate::ExprListComp> for ExprListComp { - fn from(node: &'static crate::ExprListComp) -> Self { +impl From<&'static ast::ExprListComp> for ExprListComp { + fn from(node: &'static ast::ExprListComp) -> Self { ExprListComp(node) } } impl ToPyObject for ExprListComp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprListComp { +impl ToPyWrapper for ast::ExprListComp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprListComp(self).to_object(py)) } } @@ -1886,38 +1886,38 @@ impl ExprListComp { #[getter] #[inline] fn get_elt(&self, py: Python) -> PyResult { - self.0.elt.to_pyo3_wrapper(py) + self.0.elt.to_py_wrapper(py) } #[getter] #[inline] fn get_generators(&self, py: Python) -> PyResult { - self.0.generators.to_pyo3_wrapper(py) + self.0.generators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_SetComp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprSetComp(pub &'static crate::ExprSetComp); +pub struct ExprSetComp(pub &'static ast::ExprSetComp); -impl From<&'static crate::ExprSetComp> for ExprSetComp { - fn from(node: &'static crate::ExprSetComp) -> Self { +impl From<&'static ast::ExprSetComp> for ExprSetComp { + fn from(node: &'static ast::ExprSetComp) -> Self { ExprSetComp(node) } } impl ToPyObject for ExprSetComp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprSetComp { +impl ToPyWrapper for ast::ExprSetComp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprSetComp(self).to_object(py)) } } @@ -1927,38 +1927,38 @@ impl ExprSetComp { #[getter] #[inline] fn get_elt(&self, py: Python) -> PyResult { - self.0.elt.to_pyo3_wrapper(py) + self.0.elt.to_py_wrapper(py) } #[getter] #[inline] fn get_generators(&self, py: Python) -> PyResult { - self.0.generators.to_pyo3_wrapper(py) + self.0.generators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_DictComp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprDictComp(pub &'static crate::ExprDictComp); +pub struct ExprDictComp(pub &'static ast::ExprDictComp); -impl From<&'static crate::ExprDictComp> for ExprDictComp { - fn from(node: &'static crate::ExprDictComp) -> Self { +impl From<&'static ast::ExprDictComp> for ExprDictComp { + fn from(node: &'static ast::ExprDictComp) -> Self { ExprDictComp(node) } } impl ToPyObject for ExprDictComp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprDictComp { +impl ToPyWrapper for ast::ExprDictComp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprDictComp(self).to_object(py)) } } @@ -1968,44 +1968,44 @@ impl ExprDictComp { #[getter] #[inline] fn get_key(&self, py: Python) -> PyResult { - self.0.key.to_pyo3_wrapper(py) + self.0.key.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_generators(&self, py: Python) -> PyResult { - self.0.generators.to_pyo3_wrapper(py) + self.0.generators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_GeneratorExp", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprGeneratorExp(pub &'static crate::ExprGeneratorExp); +pub struct ExprGeneratorExp(pub &'static ast::ExprGeneratorExp); -impl From<&'static crate::ExprGeneratorExp> for ExprGeneratorExp { - fn from(node: &'static crate::ExprGeneratorExp) -> Self { +impl From<&'static ast::ExprGeneratorExp> for ExprGeneratorExp { + fn from(node: &'static ast::ExprGeneratorExp) -> Self { ExprGeneratorExp(node) } } impl ToPyObject for ExprGeneratorExp { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprGeneratorExp { +impl ToPyWrapper for ast::ExprGeneratorExp { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprGeneratorExp(self).to_object(py)) } } @@ -2015,38 +2015,38 @@ impl ExprGeneratorExp { #[getter] #[inline] fn get_elt(&self, py: Python) -> PyResult { - self.0.elt.to_pyo3_wrapper(py) + self.0.elt.to_py_wrapper(py) } #[getter] #[inline] fn get_generators(&self, py: Python) -> PyResult { - self.0.generators.to_pyo3_wrapper(py) + self.0.generators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Await", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprAwait(pub &'static crate::ExprAwait); +pub struct ExprAwait(pub &'static ast::ExprAwait); -impl From<&'static crate::ExprAwait> for ExprAwait { - fn from(node: &'static crate::ExprAwait) -> Self { +impl From<&'static ast::ExprAwait> for ExprAwait { + fn from(node: &'static ast::ExprAwait) -> Self { ExprAwait(node) } } impl ToPyObject for ExprAwait { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprAwait { +impl ToPyWrapper for ast::ExprAwait { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprAwait(self).to_object(py)) } } @@ -2056,32 +2056,32 @@ impl ExprAwait { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Yield", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprYield(pub &'static crate::ExprYield); +pub struct ExprYield(pub &'static ast::ExprYield); -impl From<&'static crate::ExprYield> for ExprYield { - fn from(node: &'static crate::ExprYield) -> Self { +impl From<&'static ast::ExprYield> for ExprYield { + fn from(node: &'static ast::ExprYield) -> Self { ExprYield(node) } } impl ToPyObject for ExprYield { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprYield { +impl ToPyWrapper for ast::ExprYield { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprYield(self).to_object(py)) } } @@ -2091,32 +2091,32 @@ impl ExprYield { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_YieldFrom", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprYieldFrom(pub &'static crate::ExprYieldFrom); +pub struct ExprYieldFrom(pub &'static ast::ExprYieldFrom); -impl From<&'static crate::ExprYieldFrom> for ExprYieldFrom { - fn from(node: &'static crate::ExprYieldFrom) -> Self { +impl From<&'static ast::ExprYieldFrom> for ExprYieldFrom { + fn from(node: &'static ast::ExprYieldFrom) -> Self { ExprYieldFrom(node) } } impl ToPyObject for ExprYieldFrom { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprYieldFrom { +impl ToPyWrapper for ast::ExprYieldFrom { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprYieldFrom(self).to_object(py)) } } @@ -2126,32 +2126,32 @@ impl ExprYieldFrom { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Compare", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprCompare(pub &'static crate::ExprCompare); +pub struct ExprCompare(pub &'static ast::ExprCompare); -impl From<&'static crate::ExprCompare> for ExprCompare { - fn from(node: &'static crate::ExprCompare) -> Self { +impl From<&'static ast::ExprCompare> for ExprCompare { + fn from(node: &'static ast::ExprCompare) -> Self { ExprCompare(node) } } impl ToPyObject for ExprCompare { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprCompare { +impl ToPyWrapper for ast::ExprCompare { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprCompare(self).to_object(py)) } } @@ -2161,44 +2161,44 @@ impl ExprCompare { #[getter] #[inline] fn get_left(&self, py: Python) -> PyResult { - self.0.left.to_pyo3_wrapper(py) + self.0.left.to_py_wrapper(py) } #[getter] #[inline] fn get_ops(&self, py: Python) -> PyResult { - self.0.ops.to_pyo3_wrapper(py) + self.0.ops.to_py_wrapper(py) } #[getter] #[inline] fn get_comparators(&self, py: Python) -> PyResult { - self.0.comparators.to_pyo3_wrapper(py) + self.0.comparators.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Call", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprCall(pub &'static crate::ExprCall); +pub struct ExprCall(pub &'static ast::ExprCall); -impl From<&'static crate::ExprCall> for ExprCall { - fn from(node: &'static crate::ExprCall) -> Self { +impl From<&'static ast::ExprCall> for ExprCall { + fn from(node: &'static ast::ExprCall) -> Self { ExprCall(node) } } impl ToPyObject for ExprCall { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprCall { +impl ToPyWrapper for ast::ExprCall { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprCall(self).to_object(py)) } } @@ -2208,44 +2208,44 @@ impl ExprCall { #[getter] #[inline] fn get_func(&self, py: Python) -> PyResult { - self.0.func.to_pyo3_wrapper(py) + self.0.func.to_py_wrapper(py) } #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_keywords(&self, py: Python) -> PyResult { - self.0.keywords.to_pyo3_wrapper(py) + self.0.keywords.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_FormattedValue", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprFormattedValue(pub &'static crate::ExprFormattedValue); +pub struct ExprFormattedValue(pub &'static ast::ExprFormattedValue); -impl From<&'static crate::ExprFormattedValue> for ExprFormattedValue { - fn from(node: &'static crate::ExprFormattedValue) -> Self { +impl From<&'static ast::ExprFormattedValue> for ExprFormattedValue { + fn from(node: &'static ast::ExprFormattedValue) -> Self { ExprFormattedValue(node) } } impl ToPyObject for ExprFormattedValue { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprFormattedValue { +impl ToPyWrapper for ast::ExprFormattedValue { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprFormattedValue(self).to_object(py)) } } @@ -2255,44 +2255,44 @@ impl ExprFormattedValue { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_conversion(&self, py: Python) -> PyResult { - self.0.conversion.to_pyo3_wrapper(py) + self.0.conversion.to_py_wrapper(py) } #[getter] #[inline] fn get_format_spec(&self, py: Python) -> PyResult { - self.0.format_spec.to_pyo3_wrapper(py) + self.0.format_spec.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_JoinedStr", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprJoinedStr(pub &'static crate::ExprJoinedStr); +pub struct ExprJoinedStr(pub &'static ast::ExprJoinedStr); -impl From<&'static crate::ExprJoinedStr> for ExprJoinedStr { - fn from(node: &'static crate::ExprJoinedStr) -> Self { +impl From<&'static ast::ExprJoinedStr> for ExprJoinedStr { + fn from(node: &'static ast::ExprJoinedStr) -> Self { ExprJoinedStr(node) } } impl ToPyObject for ExprJoinedStr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprJoinedStr { +impl ToPyWrapper for ast::ExprJoinedStr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprJoinedStr(self).to_object(py)) } } @@ -2302,32 +2302,32 @@ impl ExprJoinedStr { #[getter] #[inline] fn get_values(&self, py: Python) -> PyResult { - self.0.values.to_pyo3_wrapper(py) + self.0.values.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Constant", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprConstant(pub &'static crate::ExprConstant); +pub struct ExprConstant(pub &'static ast::ExprConstant); -impl From<&'static crate::ExprConstant> for ExprConstant { - fn from(node: &'static crate::ExprConstant) -> Self { +impl From<&'static ast::ExprConstant> for ExprConstant { + fn from(node: &'static ast::ExprConstant) -> Self { ExprConstant(node) } } impl ToPyObject for ExprConstant { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprConstant { +impl ToPyWrapper for ast::ExprConstant { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprConstant(self).to_object(py)) } } @@ -2337,38 +2337,38 @@ impl ExprConstant { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_kind(&self, py: Python) -> PyResult { - self.0.kind.to_pyo3_wrapper(py) + self.0.kind.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Attribute", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprAttribute(pub &'static crate::ExprAttribute); +pub struct ExprAttribute(pub &'static ast::ExprAttribute); -impl From<&'static crate::ExprAttribute> for ExprAttribute { - fn from(node: &'static crate::ExprAttribute) -> Self { +impl From<&'static ast::ExprAttribute> for ExprAttribute { + fn from(node: &'static ast::ExprAttribute) -> Self { ExprAttribute(node) } } impl ToPyObject for ExprAttribute { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprAttribute { +impl ToPyWrapper for ast::ExprAttribute { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprAttribute(self).to_object(py)) } } @@ -2378,44 +2378,44 @@ impl ExprAttribute { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_attr(&self, py: Python) -> PyResult { - self.0.attr.to_pyo3_wrapper(py) + self.0.attr.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Subscript", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprSubscript(pub &'static crate::ExprSubscript); +pub struct ExprSubscript(pub &'static ast::ExprSubscript); -impl From<&'static crate::ExprSubscript> for ExprSubscript { - fn from(node: &'static crate::ExprSubscript) -> Self { +impl From<&'static ast::ExprSubscript> for ExprSubscript { + fn from(node: &'static ast::ExprSubscript) -> Self { ExprSubscript(node) } } impl ToPyObject for ExprSubscript { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprSubscript { +impl ToPyWrapper for ast::ExprSubscript { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprSubscript(self).to_object(py)) } } @@ -2425,44 +2425,44 @@ impl ExprSubscript { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_slice(&self, py: Python) -> PyResult { - self.0.slice.to_pyo3_wrapper(py) + self.0.slice.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Starred", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprStarred(pub &'static crate::ExprStarred); +pub struct ExprStarred(pub &'static ast::ExprStarred); -impl From<&'static crate::ExprStarred> for ExprStarred { - fn from(node: &'static crate::ExprStarred) -> Self { +impl From<&'static ast::ExprStarred> for ExprStarred { + fn from(node: &'static ast::ExprStarred) -> Self { ExprStarred(node) } } impl ToPyObject for ExprStarred { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprStarred { +impl ToPyWrapper for ast::ExprStarred { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprStarred(self).to_object(py)) } } @@ -2472,38 +2472,38 @@ impl ExprStarred { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Name", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprName(pub &'static crate::ExprName); +pub struct ExprName(pub &'static ast::ExprName); -impl From<&'static crate::ExprName> for ExprName { - fn from(node: &'static crate::ExprName) -> Self { +impl From<&'static ast::ExprName> for ExprName { + fn from(node: &'static ast::ExprName) -> Self { ExprName(node) } } impl ToPyObject for ExprName { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprName { +impl ToPyWrapper for ast::ExprName { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprName(self).to_object(py)) } } @@ -2513,38 +2513,38 @@ impl ExprName { #[getter] #[inline] fn get_id(&self, py: Python) -> PyResult { - self.0.id.to_pyo3_wrapper(py) + self.0.id.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_List", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprList(pub &'static crate::ExprList); +pub struct ExprList(pub &'static ast::ExprList); -impl From<&'static crate::ExprList> for ExprList { - fn from(node: &'static crate::ExprList) -> Self { +impl From<&'static ast::ExprList> for ExprList { + fn from(node: &'static ast::ExprList) -> Self { ExprList(node) } } impl ToPyObject for ExprList { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprList { +impl ToPyWrapper for ast::ExprList { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprList(self).to_object(py)) } } @@ -2554,38 +2554,38 @@ impl ExprList { #[getter] #[inline] fn get_elts(&self, py: Python) -> PyResult { - self.0.elts.to_pyo3_wrapper(py) + self.0.elts.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Tuple", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprTuple(pub &'static crate::ExprTuple); +pub struct ExprTuple(pub &'static ast::ExprTuple); -impl From<&'static crate::ExprTuple> for ExprTuple { - fn from(node: &'static crate::ExprTuple) -> Self { +impl From<&'static ast::ExprTuple> for ExprTuple { + fn from(node: &'static ast::ExprTuple) -> Self { ExprTuple(node) } } impl ToPyObject for ExprTuple { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprTuple { +impl ToPyWrapper for ast::ExprTuple { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprTuple(self).to_object(py)) } } @@ -2595,38 +2595,38 @@ impl ExprTuple { #[getter] #[inline] fn get_elts(&self, py: Python) -> PyResult { - self.0.elts.to_pyo3_wrapper(py) + self.0.elts.to_py_wrapper(py) } #[getter] #[inline] fn get_ctx(&self, py: Python) -> PyResult { - self.0.ctx.to_pyo3_wrapper(py) + self.0.ctx.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_Slice", extends=Expr, frozen)] #[derive(Clone, Debug)] -pub struct ExprSlice(pub &'static crate::ExprSlice); +pub struct ExprSlice(pub &'static ast::ExprSlice); -impl From<&'static crate::ExprSlice> for ExprSlice { - fn from(node: &'static crate::ExprSlice) -> Self { +impl From<&'static ast::ExprSlice> for ExprSlice { + fn from(node: &'static ast::ExprSlice) -> Self { ExprSlice(node) } } impl ToPyObject for ExprSlice { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Expr) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExprSlice { +impl ToPyWrapper for ast::ExprSlice { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExprSlice(self).to_object(py)) } } @@ -2636,28 +2636,28 @@ impl ExprSlice { #[getter] #[inline] fn get_lower(&self, py: Python) -> PyResult { - self.0.lower.to_pyo3_wrapper(py) + self.0.lower.to_py_wrapper(py) } #[getter] #[inline] fn get_upper(&self, py: Python) -> PyResult { - self.0.upper.to_pyo3_wrapper(py) + self.0.upper.to_py_wrapper(py) } #[getter] #[inline] fn get_step(&self, py: Python) -> PyResult { - self.0.step.to_pyo3_wrapper(py) + self.0.step.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_expr_context", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_expr_context", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct ExprContext; -impl From<&'static crate::ExprContext> for ExprContext { - fn from(_node: &'static crate::ExprContext) -> Self { +impl From<&'static ast::ExprContext> for ExprContext { + fn from(_node: &'static ast::ExprContext) -> Self { ExprContext } } @@ -2666,7 +2666,7 @@ impl From<&'static crate::ExprContext> for ExprContext { impl ExprContext { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for ExprContext { @@ -2681,7 +2681,7 @@ pub struct ExprContextLoad; impl ToPyObject for ExprContextLoad { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(ExprContext) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2693,7 +2693,7 @@ pub struct ExprContextStore; impl ToPyObject for ExprContextStore { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(ExprContext) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2705,19 +2705,19 @@ pub struct ExprContextDel; impl ToPyObject for ExprContextDel { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(ExprContext) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_boolop", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_boolop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Boolop; -impl From<&'static crate::Boolop> for Boolop { - fn from(_node: &'static crate::Boolop) -> Self { +impl From<&'static ast::Boolop> for Boolop { + fn from(_node: &'static ast::Boolop) -> Self { Boolop } } @@ -2726,7 +2726,7 @@ impl From<&'static crate::Boolop> for Boolop { impl Boolop { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Boolop { @@ -2741,7 +2741,7 @@ pub struct BoolopAnd; impl ToPyObject for BoolopAnd { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Boolop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2753,19 +2753,19 @@ pub struct BoolopOr; impl ToPyObject for BoolopOr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Boolop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_operator", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_operator", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Operator; -impl From<&'static crate::Operator> for Operator { - fn from(_node: &'static crate::Operator) -> Self { +impl From<&'static ast::Operator> for Operator { + fn from(_node: &'static ast::Operator) -> Self { Operator } } @@ -2774,7 +2774,7 @@ impl From<&'static crate::Operator> for Operator { impl Operator { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Operator { @@ -2789,7 +2789,7 @@ pub struct OperatorAdd; impl ToPyObject for OperatorAdd { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2801,7 +2801,7 @@ pub struct OperatorSub; impl ToPyObject for OperatorSub { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2813,7 +2813,7 @@ pub struct OperatorMult; impl ToPyObject for OperatorMult { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2825,7 +2825,7 @@ pub struct OperatorMatMult; impl ToPyObject for OperatorMatMult { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2837,7 +2837,7 @@ pub struct OperatorDiv; impl ToPyObject for OperatorDiv { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2849,7 +2849,7 @@ pub struct OperatorMod; impl ToPyObject for OperatorMod { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2861,7 +2861,7 @@ pub struct OperatorPow; impl ToPyObject for OperatorPow { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2873,7 +2873,7 @@ pub struct OperatorLShift; impl ToPyObject for OperatorLShift { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2885,7 +2885,7 @@ pub struct OperatorRShift; impl ToPyObject for OperatorRShift { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2897,7 +2897,7 @@ pub struct OperatorBitOr; impl ToPyObject for OperatorBitOr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2909,7 +2909,7 @@ pub struct OperatorBitXor; impl ToPyObject for OperatorBitXor { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2921,7 +2921,7 @@ pub struct OperatorBitAnd; impl ToPyObject for OperatorBitAnd { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2933,19 +2933,19 @@ pub struct OperatorFloorDiv; impl ToPyObject for OperatorFloorDiv { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Operator) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_unaryop", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_unaryop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Unaryop; -impl From<&'static crate::Unaryop> for Unaryop { - fn from(_node: &'static crate::Unaryop) -> Self { +impl From<&'static ast::Unaryop> for Unaryop { + fn from(_node: &'static ast::Unaryop) -> Self { Unaryop } } @@ -2954,7 +2954,7 @@ impl From<&'static crate::Unaryop> for Unaryop { impl Unaryop { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Unaryop { @@ -2969,7 +2969,7 @@ pub struct UnaryopInvert; impl ToPyObject for UnaryopInvert { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Unaryop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2981,7 +2981,7 @@ pub struct UnaryopNot; impl ToPyObject for UnaryopNot { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Unaryop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -2993,7 +2993,7 @@ pub struct UnaryopUAdd; impl ToPyObject for UnaryopUAdd { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Unaryop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3005,19 +3005,19 @@ pub struct UnaryopUSub; impl ToPyObject for UnaryopUSub { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Unaryop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_cmpop", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_cmpop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Cmpop; -impl From<&'static crate::Cmpop> for Cmpop { - fn from(_node: &'static crate::Cmpop) -> Self { +impl From<&'static ast::Cmpop> for Cmpop { + fn from(_node: &'static ast::Cmpop) -> Self { Cmpop } } @@ -3026,7 +3026,7 @@ impl From<&'static crate::Cmpop> for Cmpop { impl Cmpop { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Cmpop { @@ -3041,7 +3041,7 @@ pub struct CmpopEq; impl ToPyObject for CmpopEq { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3053,7 +3053,7 @@ pub struct CmpopNotEq; impl ToPyObject for CmpopNotEq { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3065,7 +3065,7 @@ pub struct CmpopLt; impl ToPyObject for CmpopLt { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3077,7 +3077,7 @@ pub struct CmpopLtE; impl ToPyObject for CmpopLtE { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3089,7 +3089,7 @@ pub struct CmpopGt; impl ToPyObject for CmpopGt { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3101,7 +3101,7 @@ pub struct CmpopGtE; impl ToPyObject for CmpopGtE { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3113,7 +3113,7 @@ pub struct CmpopIs; impl ToPyObject for CmpopIs { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3125,7 +3125,7 @@ pub struct CmpopIsNot; impl ToPyObject for CmpopIsNot { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3137,7 +3137,7 @@ pub struct CmpopIn; impl ToPyObject for CmpopIn { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -3149,33 +3149,33 @@ pub struct CmpopNotIn; impl ToPyObject for CmpopNotIn { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Cmpop) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_comprehension", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.ranged", name="_comprehension", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Comprehension(pub &'static crate::Comprehension); +pub struct Comprehension(pub &'static ast::Comprehension); -impl From<&'static crate::Comprehension> for Comprehension { - fn from(node: &'static crate::Comprehension) -> Self { +impl From<&'static ast::Comprehension> for Comprehension { + fn from(node: &'static ast::Comprehension) -> Self { Comprehension(node) } } impl ToPyObject for Comprehension { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Comprehension { +impl ToPyWrapper for ast::Comprehension { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Comprehension(self).to_object(py)) } } @@ -3185,34 +3185,34 @@ impl Comprehension { #[getter] #[inline] fn get_target(&self, py: Python) -> PyResult { - self.0.target.to_pyo3_wrapper(py) + self.0.target.to_py_wrapper(py) } #[getter] #[inline] fn get_iter(&self, py: Python) -> PyResult { - self.0.iter.to_pyo3_wrapper(py) + self.0.iter.to_py_wrapper(py) } #[getter] #[inline] fn get_ifs(&self, py: Python) -> PyResult { - self.0.ifs.to_pyo3_wrapper(py) + self.0.ifs.to_py_wrapper(py) } #[getter] #[inline] fn get_is_async(&self, py: Python) -> PyResult { - self.0.is_async.to_pyo3_wrapper(py) + self.0.is_async.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_excepthandler", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_excepthandler", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Excepthandler; -impl From<&'static crate::Excepthandler> for Excepthandler { - fn from(_node: &'static crate::Excepthandler) -> Self { +impl From<&'static ast::Excepthandler> for Excepthandler { + fn from(_node: &'static ast::Excepthandler) -> Self { Excepthandler } } @@ -3221,7 +3221,7 @@ impl From<&'static crate::Excepthandler> for Excepthandler { impl Excepthandler { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Excepthandler { @@ -3231,37 +3231,37 @@ impl ToPyObject for Excepthandler { } } -impl ToPyo3Wrapper for crate::Excepthandler { +impl ToPyWrapper for ast::Excepthandler { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::ExceptHandler(cons) => cons.to_pyo3_wrapper(py), + Self::ExceptHandler(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.ranged", name="_ExceptHandler", extends=Excepthandler, frozen)] #[derive(Clone, Debug)] -pub struct ExcepthandlerExceptHandler(pub &'static crate::ExcepthandlerExceptHandler); +pub struct ExcepthandlerExceptHandler(pub &'static ast::ExcepthandlerExceptHandler); -impl From<&'static crate::ExcepthandlerExceptHandler> for ExcepthandlerExceptHandler { - fn from(node: &'static crate::ExcepthandlerExceptHandler) -> Self { +impl From<&'static ast::ExcepthandlerExceptHandler> for ExcepthandlerExceptHandler { + fn from(node: &'static ast::ExcepthandlerExceptHandler) -> Self { ExcepthandlerExceptHandler(node) } } impl ToPyObject for ExcepthandlerExceptHandler { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Excepthandler) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::ExcepthandlerExceptHandler { +impl ToPyWrapper for ast::ExcepthandlerExceptHandler { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(ExcepthandlerExceptHandler(self).to_object(py)) } } @@ -3271,42 +3271,42 @@ impl ExcepthandlerExceptHandler { #[getter] #[inline] fn get_type(&self, py: Python) -> PyResult { - self.0.type_.to_pyo3_wrapper(py) + self.0.type_.to_py_wrapper(py) } #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_arguments", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.ranged", name="_arguments", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Arguments(pub &'static crate::Arguments); +pub struct Arguments(pub &'static ast::Arguments); -impl From<&'static crate::Arguments> for Arguments { - fn from(node: &'static crate::Arguments) -> Self { +impl From<&'static ast::Arguments> for Arguments { + fn from(node: &'static ast::Arguments) -> Self { Arguments(node) } } impl ToPyObject for Arguments { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Arguments { +impl ToPyWrapper for ast::Arguments { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Arguments(self).to_object(py)) } } @@ -3316,66 +3316,66 @@ impl Arguments { #[getter] #[inline] fn get_posonlyargs(&self, py: Python) -> PyResult { - self.0.posonlyargs.to_pyo3_wrapper(py) + self.0.posonlyargs.to_py_wrapper(py) } #[getter] #[inline] fn get_args(&self, py: Python) -> PyResult { - self.0.args.to_pyo3_wrapper(py) + self.0.args.to_py_wrapper(py) } #[getter] #[inline] fn get_vararg(&self, py: Python) -> PyResult { - self.0.vararg.to_pyo3_wrapper(py) + self.0.vararg.to_py_wrapper(py) } #[getter] #[inline] fn get_kwonlyargs(&self, py: Python) -> PyResult { - self.0.kwonlyargs.to_pyo3_wrapper(py) + self.0.kwonlyargs.to_py_wrapper(py) } #[getter] #[inline] fn get_kw_defaults(&self, py: Python) -> PyResult { - self.0.kw_defaults.to_pyo3_wrapper(py) + self.0.kw_defaults.to_py_wrapper(py) } #[getter] #[inline] fn get_kwarg(&self, py: Python) -> PyResult { - self.0.kwarg.to_pyo3_wrapper(py) + self.0.kwarg.to_py_wrapper(py) } #[getter] #[inline] fn get_defaults(&self, py: Python) -> PyResult { - self.0.defaults.to_pyo3_wrapper(py) + self.0.defaults.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_arg", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.ranged", name="_arg", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Arg(pub &'static crate::Arg); +pub struct Arg(pub &'static ast::Arg); -impl From<&'static crate::Arg> for Arg { - fn from(node: &'static crate::Arg) -> Self { +impl From<&'static ast::Arg> for Arg { + fn from(node: &'static ast::Arg) -> Self { Arg(node) } } impl ToPyObject for Arg { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Arg { +impl ToPyWrapper for ast::Arg { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Arg(self).to_object(py)) } } @@ -3385,42 +3385,42 @@ impl Arg { #[getter] #[inline] fn get_arg(&self, py: Python) -> PyResult { - self.0.arg.to_pyo3_wrapper(py) + self.0.arg.to_py_wrapper(py) } #[getter] #[inline] fn get_annotation(&self, py: Python) -> PyResult { - self.0.annotation.to_pyo3_wrapper(py) + self.0.annotation.to_py_wrapper(py) } #[getter] #[inline] fn get_type_comment(&self, py: Python) -> PyResult { - self.0.type_comment.to_pyo3_wrapper(py) + self.0.type_comment.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_keyword", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.ranged", name="_keyword", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Keyword(pub &'static crate::Keyword); +pub struct Keyword(pub &'static ast::Keyword); -impl From<&'static crate::Keyword> for Keyword { - fn from(node: &'static crate::Keyword) -> Self { +impl From<&'static ast::Keyword> for Keyword { + fn from(node: &'static ast::Keyword) -> Self { Keyword(node) } } impl ToPyObject for Keyword { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Keyword { +impl ToPyWrapper for ast::Keyword { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Keyword(self).to_object(py)) } } @@ -3430,36 +3430,36 @@ impl Keyword { #[getter] #[inline] fn get_arg(&self, py: Python) -> PyResult { - self.0.arg.to_pyo3_wrapper(py) + self.0.arg.to_py_wrapper(py) } #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_alias", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.ranged", name="_alias", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Alias(pub &'static crate::Alias); +pub struct Alias(pub &'static ast::Alias); -impl From<&'static crate::Alias> for Alias { - fn from(node: &'static crate::Alias) -> Self { +impl From<&'static ast::Alias> for Alias { + fn from(node: &'static ast::Alias) -> Self { Alias(node) } } impl ToPyObject for Alias { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Alias { +impl ToPyWrapper for ast::Alias { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Alias(self).to_object(py)) } } @@ -3469,36 +3469,36 @@ impl Alias { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } #[getter] #[inline] fn get_asname(&self, py: Python) -> PyResult { - self.0.asname.to_pyo3_wrapper(py) + self.0.asname.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_withitem", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.ranged", name="_withitem", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Withitem(pub &'static crate::Withitem); +pub struct Withitem(pub &'static ast::Withitem); -impl From<&'static crate::Withitem> for Withitem { - fn from(node: &'static crate::Withitem) -> Self { +impl From<&'static ast::Withitem> for Withitem { + fn from(node: &'static ast::Withitem) -> Self { Withitem(node) } } impl ToPyObject for Withitem { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::Withitem { +impl ToPyWrapper for ast::Withitem { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(Withitem(self).to_object(py)) } } @@ -3508,36 +3508,36 @@ impl Withitem { #[getter] #[inline] fn get_context_expr(&self, py: Python) -> PyResult { - self.0.context_expr.to_pyo3_wrapper(py) + self.0.context_expr.to_py_wrapper(py) } #[getter] #[inline] fn get_optional_vars(&self, py: Python) -> PyResult { - self.0.optional_vars.to_pyo3_wrapper(py) + self.0.optional_vars.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_match_case", extends=super::AST, frozen)] +#[pyclass(module="rustpython_ast.ranged", name="_match_case", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct MatchCase(pub &'static crate::MatchCase); +pub struct MatchCase(pub &'static ast::MatchCase); -impl From<&'static crate::MatchCase> for MatchCase { - fn from(node: &'static crate::MatchCase) -> Self { +impl From<&'static ast::MatchCase> for MatchCase { + fn from(node: &'static ast::MatchCase) -> Self { MatchCase(node) } } impl ToPyObject for MatchCase { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST).add_subclass(self.clone()); + let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::MatchCase { +impl ToPyWrapper for ast::MatchCase { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(MatchCase(self).to_object(py)) } } @@ -3547,28 +3547,28 @@ impl MatchCase { #[getter] #[inline] fn get_pattern(&self, py: Python) -> PyResult { - self.0.pattern.to_pyo3_wrapper(py) + self.0.pattern.to_py_wrapper(py) } #[getter] #[inline] fn get_guard(&self, py: Python) -> PyResult { - self.0.guard.to_pyo3_wrapper(py) + self.0.guard.to_py_wrapper(py) } #[getter] #[inline] fn get_body(&self, py: Python) -> PyResult { - self.0.body.to_pyo3_wrapper(py) + self.0.body.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_pattern", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_pattern", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct Pattern; -impl From<&'static crate::Pattern> for Pattern { - fn from(_node: &'static crate::Pattern) -> Self { +impl From<&'static ast::Pattern> for Pattern { + fn from(_node: &'static ast::Pattern) -> Self { Pattern } } @@ -3577,7 +3577,7 @@ impl From<&'static crate::Pattern> for Pattern { impl Pattern { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for Pattern { @@ -3587,44 +3587,44 @@ impl ToPyObject for Pattern { } } -impl ToPyo3Wrapper for crate::Pattern { +impl ToPyWrapper for ast::Pattern { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::MatchValue(cons) => cons.to_pyo3_wrapper(py), - Self::MatchSingleton(cons) => cons.to_pyo3_wrapper(py), - Self::MatchSequence(cons) => cons.to_pyo3_wrapper(py), - Self::MatchMapping(cons) => cons.to_pyo3_wrapper(py), - Self::MatchClass(cons) => cons.to_pyo3_wrapper(py), - Self::MatchStar(cons) => cons.to_pyo3_wrapper(py), - Self::MatchAs(cons) => cons.to_pyo3_wrapper(py), - Self::MatchOr(cons) => cons.to_pyo3_wrapper(py), + Self::MatchValue(cons) => cons.to_py_wrapper(py), + Self::MatchSingleton(cons) => cons.to_py_wrapper(py), + Self::MatchSequence(cons) => cons.to_py_wrapper(py), + Self::MatchMapping(cons) => cons.to_py_wrapper(py), + Self::MatchClass(cons) => cons.to_py_wrapper(py), + Self::MatchStar(cons) => cons.to_py_wrapper(py), + Self::MatchAs(cons) => cons.to_py_wrapper(py), + Self::MatchOr(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.ranged", name="_MatchValue", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchValue(pub &'static crate::PatternMatchValue); +pub struct PatternMatchValue(pub &'static ast::PatternMatchValue); -impl From<&'static crate::PatternMatchValue> for PatternMatchValue { - fn from(node: &'static crate::PatternMatchValue) -> Self { +impl From<&'static ast::PatternMatchValue> for PatternMatchValue { + fn from(node: &'static ast::PatternMatchValue) -> Self { PatternMatchValue(node) } } impl ToPyObject for PatternMatchValue { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchValue { +impl ToPyWrapper for ast::PatternMatchValue { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchValue(self).to_object(py)) } } @@ -3634,32 +3634,32 @@ impl PatternMatchValue { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_MatchSingleton", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchSingleton(pub &'static crate::PatternMatchSingleton); +pub struct PatternMatchSingleton(pub &'static ast::PatternMatchSingleton); -impl From<&'static crate::PatternMatchSingleton> for PatternMatchSingleton { - fn from(node: &'static crate::PatternMatchSingleton) -> Self { +impl From<&'static ast::PatternMatchSingleton> for PatternMatchSingleton { + fn from(node: &'static ast::PatternMatchSingleton) -> Self { PatternMatchSingleton(node) } } impl ToPyObject for PatternMatchSingleton { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchSingleton { +impl ToPyWrapper for ast::PatternMatchSingleton { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchSingleton(self).to_object(py)) } } @@ -3669,32 +3669,32 @@ impl PatternMatchSingleton { #[getter] #[inline] fn get_value(&self, py: Python) -> PyResult { - self.0.value.to_pyo3_wrapper(py) + self.0.value.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_MatchSequence", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchSequence(pub &'static crate::PatternMatchSequence); +pub struct PatternMatchSequence(pub &'static ast::PatternMatchSequence); -impl From<&'static crate::PatternMatchSequence> for PatternMatchSequence { - fn from(node: &'static crate::PatternMatchSequence) -> Self { +impl From<&'static ast::PatternMatchSequence> for PatternMatchSequence { + fn from(node: &'static ast::PatternMatchSequence) -> Self { PatternMatchSequence(node) } } impl ToPyObject for PatternMatchSequence { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchSequence { +impl ToPyWrapper for ast::PatternMatchSequence { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchSequence(self).to_object(py)) } } @@ -3704,32 +3704,32 @@ impl PatternMatchSequence { #[getter] #[inline] fn get_patterns(&self, py: Python) -> PyResult { - self.0.patterns.to_pyo3_wrapper(py) + self.0.patterns.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_MatchMapping", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchMapping(pub &'static crate::PatternMatchMapping); +pub struct PatternMatchMapping(pub &'static ast::PatternMatchMapping); -impl From<&'static crate::PatternMatchMapping> for PatternMatchMapping { - fn from(node: &'static crate::PatternMatchMapping) -> Self { +impl From<&'static ast::PatternMatchMapping> for PatternMatchMapping { + fn from(node: &'static ast::PatternMatchMapping) -> Self { PatternMatchMapping(node) } } impl ToPyObject for PatternMatchMapping { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchMapping { +impl ToPyWrapper for ast::PatternMatchMapping { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchMapping(self).to_object(py)) } } @@ -3739,44 +3739,44 @@ impl PatternMatchMapping { #[getter] #[inline] fn get_keys(&self, py: Python) -> PyResult { - self.0.keys.to_pyo3_wrapper(py) + self.0.keys.to_py_wrapper(py) } #[getter] #[inline] fn get_patterns(&self, py: Python) -> PyResult { - self.0.patterns.to_pyo3_wrapper(py) + self.0.patterns.to_py_wrapper(py) } #[getter] #[inline] fn get_rest(&self, py: Python) -> PyResult { - self.0.rest.to_pyo3_wrapper(py) + self.0.rest.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_MatchClass", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchClass(pub &'static crate::PatternMatchClass); +pub struct PatternMatchClass(pub &'static ast::PatternMatchClass); -impl From<&'static crate::PatternMatchClass> for PatternMatchClass { - fn from(node: &'static crate::PatternMatchClass) -> Self { +impl From<&'static ast::PatternMatchClass> for PatternMatchClass { + fn from(node: &'static ast::PatternMatchClass) -> Self { PatternMatchClass(node) } } impl ToPyObject for PatternMatchClass { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchClass { +impl ToPyWrapper for ast::PatternMatchClass { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchClass(self).to_object(py)) } } @@ -3786,50 +3786,50 @@ impl PatternMatchClass { #[getter] #[inline] fn get_cls(&self, py: Python) -> PyResult { - self.0.cls.to_pyo3_wrapper(py) + self.0.cls.to_py_wrapper(py) } #[getter] #[inline] fn get_patterns(&self, py: Python) -> PyResult { - self.0.patterns.to_pyo3_wrapper(py) + self.0.patterns.to_py_wrapper(py) } #[getter] #[inline] fn get_kwd_attrs(&self, py: Python) -> PyResult { - self.0.kwd_attrs.to_pyo3_wrapper(py) + self.0.kwd_attrs.to_py_wrapper(py) } #[getter] #[inline] fn get_kwd_patterns(&self, py: Python) -> PyResult { - self.0.kwd_patterns.to_pyo3_wrapper(py) + self.0.kwd_patterns.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_MatchStar", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchStar(pub &'static crate::PatternMatchStar); +pub struct PatternMatchStar(pub &'static ast::PatternMatchStar); -impl From<&'static crate::PatternMatchStar> for PatternMatchStar { - fn from(node: &'static crate::PatternMatchStar) -> Self { +impl From<&'static ast::PatternMatchStar> for PatternMatchStar { + fn from(node: &'static ast::PatternMatchStar) -> Self { PatternMatchStar(node) } } impl ToPyObject for PatternMatchStar { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchStar { +impl ToPyWrapper for ast::PatternMatchStar { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchStar(self).to_object(py)) } } @@ -3839,32 +3839,32 @@ impl PatternMatchStar { #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_MatchAs", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchAs(pub &'static crate::PatternMatchAs); +pub struct PatternMatchAs(pub &'static ast::PatternMatchAs); -impl From<&'static crate::PatternMatchAs> for PatternMatchAs { - fn from(node: &'static crate::PatternMatchAs) -> Self { +impl From<&'static ast::PatternMatchAs> for PatternMatchAs { + fn from(node: &'static ast::PatternMatchAs) -> Self { PatternMatchAs(node) } } impl ToPyObject for PatternMatchAs { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchAs { +impl ToPyWrapper for ast::PatternMatchAs { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchAs(self).to_object(py)) } } @@ -3874,38 +3874,38 @@ impl PatternMatchAs { #[getter] #[inline] fn get_pattern(&self, py: Python) -> PyResult { - self.0.pattern.to_pyo3_wrapper(py) + self.0.pattern.to_py_wrapper(py) } #[getter] #[inline] fn get_name(&self, py: Python) -> PyResult { - self.0.name.to_pyo3_wrapper(py) + self.0.name.to_py_wrapper(py) } } #[pyclass(module="rustpython_ast.ranged", name="_MatchOr", extends=Pattern, frozen)] #[derive(Clone, Debug)] -pub struct PatternMatchOr(pub &'static crate::PatternMatchOr); +pub struct PatternMatchOr(pub &'static ast::PatternMatchOr); -impl From<&'static crate::PatternMatchOr> for PatternMatchOr { - fn from(node: &'static crate::PatternMatchOr) -> Self { +impl From<&'static ast::PatternMatchOr> for PatternMatchOr { + fn from(node: &'static ast::PatternMatchOr) -> Self { PatternMatchOr(node) } } impl ToPyObject for PatternMatchOr { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(Pattern) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::PatternMatchOr { +impl ToPyWrapper for ast::PatternMatchOr { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(PatternMatchOr(self).to_object(py)) } } @@ -3915,16 +3915,16 @@ impl PatternMatchOr { #[getter] #[inline] fn get_patterns(&self, py: Python) -> PyResult { - self.0.patterns.to_pyo3_wrapper(py) + self.0.patterns.to_py_wrapper(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_type_ignore", extends=super::AST, frozen, subclass)] +#[pyclass(module="rustpython_ast.ranged", name="_type_ignore", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] pub struct TypeIgnore; -impl From<&'static crate::TypeIgnore> for TypeIgnore { - fn from(_node: &'static crate::TypeIgnore) -> Self { +impl From<&'static ast::TypeIgnore> for TypeIgnore { + fn from(_node: &'static ast::TypeIgnore) -> Self { TypeIgnore } } @@ -3933,7 +3933,7 @@ impl From<&'static crate::TypeIgnore> for TypeIgnore { impl TypeIgnore { #[new] fn new() -> PyClassInitializer { - PyClassInitializer::from(AST).add_subclass(Self) + PyClassInitializer::from(Ast).add_subclass(Self) } } impl ToPyObject for TypeIgnore { @@ -3943,37 +3943,37 @@ impl ToPyObject for TypeIgnore { } } -impl ToPyo3Wrapper for crate::TypeIgnore { +impl ToPyWrapper for ast::TypeIgnore { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { - Self::TypeIgnore(cons) => cons.to_pyo3_wrapper(py), + Self::TypeIgnore(cons) => cons.to_py_wrapper(py), } } } #[pyclass(module="rustpython_ast.ranged", name="_TypeIgnore", extends=TypeIgnore, frozen)] #[derive(Clone, Debug)] -pub struct TypeIgnoreTypeIgnore(pub &'static crate::TypeIgnoreTypeIgnore); +pub struct TypeIgnoreTypeIgnore(pub &'static ast::TypeIgnoreTypeIgnore); -impl From<&'static crate::TypeIgnoreTypeIgnore> for TypeIgnoreTypeIgnore { - fn from(node: &'static crate::TypeIgnoreTypeIgnore) -> Self { +impl From<&'static ast::TypeIgnoreTypeIgnore> for TypeIgnoreTypeIgnore { + fn from(node: &'static ast::TypeIgnoreTypeIgnore) -> Self { TypeIgnoreTypeIgnore(node) } } impl ToPyObject for TypeIgnoreTypeIgnore { fn to_object(&self, py: Python) -> PyObject { - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass(TypeIgnore) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyo3Wrapper for crate::TypeIgnoreTypeIgnore { +impl ToPyWrapper for ast::TypeIgnoreTypeIgnore { #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { Ok(TypeIgnoreTypeIgnore(self).to_object(py)) } } @@ -3983,137 +3983,135 @@ impl TypeIgnoreTypeIgnore { #[getter] #[inline] fn get_lineno(&self, py: Python) -> PyResult { - self.0.lineno.to_pyo3_wrapper(py) + self.0.lineno.to_py_wrapper(py) } #[getter] #[inline] fn get_tag(&self, py: Python) -> PyResult { - self.0.tag.to_pyo3_wrapper(py) + self.0.tag.to_py_wrapper(py) } } pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> { super::init_module(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::( - py, m, - )?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; Ok(()) } diff --git a/ast-pyo3/src/lib.rs b/ast-pyo3/src/lib.rs new file mode 100644 index 00000000..5a5b6a72 --- /dev/null +++ b/ast-pyo3/src/lib.rs @@ -0,0 +1,5 @@ +mod py_ast; +#[cfg(feature = "wrapper")] +pub mod wrapper; + +pub use py_ast::{init, PyNode, ToPyAst}; diff --git a/ast-pyo3/src/py_ast.rs b/ast-pyo3/src/py_ast.rs new file mode 100644 index 00000000..e53e7b2a --- /dev/null +++ b/ast-pyo3/src/py_ast.rs @@ -0,0 +1,190 @@ +use num_complex::Complex64; +use once_cell::sync::OnceCell; +use pyo3::{ + prelude::*, + types::{PyBool, PyBytes, PyList, PyString, PyTuple}, + ToPyObject, +}; +use rustpython_ast::{ + self as ast, source_code::SourceRange, text_size::TextRange, ConversionFlag, Node, +}; + +pub trait PyNode { + fn py_type_cache() -> &'static OnceCell<(Py, Py)> { + { + static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); + &PY_TYPE + } + } +} + +pub trait ToPyAst { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>; +} + +impl ToPyAst for Box { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + (**self).to_py_ast(py) + } +} + +impl ToPyAst for Option { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + match self { + Some(ast) => ast.to_py_ast(py), + None => Ok(ast_cache().none_ref(py)), + } + } +} + +impl ToPyAst for Vec { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + let elts = self + .iter() + .map(|item| item.to_py_ast(py)) + .collect::, _>>()?; + let list = PyList::new(py, elts); + Ok(list.into()) + } +} + +impl ToPyAst for ast::Identifier { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + Ok(PyString::new(py, self.as_str()).into()) + } +} + +impl ToPyAst for ast::String { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + Ok(PyString::new(py, self.as_str()).into()) + } +} + +impl ToPyAst for bool { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + Ok(ast_cache().bool_int(py, *self)) + } +} + +impl ToPyAst for ConversionFlag { + #[inline] + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + Ok(ast_cache().conversion_flag(py, *self)) + } +} + +fn constant_to_object(constant: &ast::Constant, py: Python) -> PyObject { + let cache = ast_cache(); + match constant { + ast::Constant::None => cache.none.clone_ref(py), + ast::Constant::Bool(bool) => cache.bool(py, *bool).into(), + ast::Constant::Str(string) => string.to_object(py), + ast::Constant::Bytes(bytes) => PyBytes::new(py, bytes).into(), + ast::Constant::Int(int) => int.to_object(py), + ast::Constant::Tuple(elts) => { + let elts: Vec<_> = elts.iter().map(|c| constant_to_object(c, py)).collect(); + PyTuple::new(py, elts).into() + } + ast::Constant::Float(f64) => f64.to_object(py), + ast::Constant::Complex { real, imag } => Complex64::new(*real, *imag).to_object(py), + ast::Constant::Ellipsis => py.Ellipsis(), + } +} + +#[pyclass(module = "rustpython_ast", subclass)] +pub struct Ast; + +#[pymethods] +impl Ast { + #[new] + fn new() -> Self { + Self + } +} + +fn cache_py_type(ast_module: &PyAny) -> PyResult<()> { + let class = ast_module.getattr(N::NAME)?; + let base = if std::mem::size_of::() == 0 { + class.call0()? + } else { + class.getattr("__new__")? + }; + N::py_type_cache().get_or_init(|| (class.into(), base.into())); + Ok(()) +} + +// TODO: This cache must be bound to 'py +struct AstCache { + lineno: Py, + col_offset: Py, + end_lineno: Py, + end_col_offset: Py, + none: Py, + bool_values: (Py, Py), + bool_int_values: (Py, Py), + conversion_flags: (Py, Py, Py, Py), +} + +impl AstCache { + #[inline] + fn none_ref<'py>(&'static self, py: Python<'py>) -> &'py PyAny { + Py::::as_ref(&self.none, py) + } + #[inline] + fn bool_int<'py>(&'static self, py: Python<'py>, value: bool) -> &'py PyAny { + let v = &self.bool_int_values; + Py::::as_ref(if value { &v.1 } else { &v.0 }, py) + } + #[inline] + fn bool(&'static self, py: Python, value: bool) -> Py { + let v = &self.bool_values; + (if value { &v.1 } else { &v.0 }).clone_ref(py) + } + fn conversion_flag<'py>(&'static self, py: Python<'py>, value: ConversionFlag) -> &'py PyAny { + let v = &self.conversion_flags; + match value { + ConversionFlag::None => v.0.as_ref(py), + ConversionFlag::Str => v.1.as_ref(py), + ConversionFlag::Ascii => v.2.as_ref(py), + ConversionFlag::Repr => v.3.as_ref(py), + } + } +} + +fn ast_cache_cell() -> &'static OnceCell { + { + static PY_TYPE: OnceCell = OnceCell::new(); + &PY_TYPE + } +} + +fn ast_cache() -> &'static AstCache { + ast_cache_cell().get().unwrap() +} + +pub fn init(py: Python) -> PyResult<()> { + ast_cache_cell().get_or_init(|| AstCache { + lineno: pyo3::intern!(py, "lineno").into_py(py), + col_offset: pyo3::intern!(py, "col_offset").into_py(py), + end_lineno: pyo3::intern!(py, "end_lineno").into_py(py), + end_col_offset: pyo3::intern!(py, "end_col_offset").into_py(py), + none: py.None(), + bool_values: (PyBool::new(py, false).into(), PyBool::new(py, true).into()), + bool_int_values: ((0).to_object(py), (1).to_object(py)), + conversion_flags: ( + (-1).to_object(py), + (b's').to_object(py), + (b'a').to_object(py), + (b'r').to_object(py), + ), + }); + + init_types(py) +} + +include!("gen/to_py_ast.rs"); diff --git a/ast-pyo3/src/wrapper.rs b/ast-pyo3/src/wrapper.rs new file mode 100644 index 00000000..9a8b1152 --- /dev/null +++ b/ast-pyo3/src/wrapper.rs @@ -0,0 +1,141 @@ +use crate::PyNode; +use num_complex::Complex64; +use pyo3::prelude::*; +use pyo3::types::{PyBytes, PyList, PyTuple}; +use rustpython_ast::{ + self as ast, source_code::SourceRange, text_size::TextRange, ConversionFlag, Node, +}; + +pub trait ToPyWrapper { + fn to_py_wrapper(&'static self, py: Python) -> PyResult>; +} + +impl ToPyWrapper for Box { + #[inline] + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + (**self).to_py_wrapper(py) + } +} + +impl ToPyWrapper for Option { + #[inline] + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + match self { + Some(ast) => ast.to_py_wrapper(py), + None => Ok(py.None()), + } + } +} + +impl ToPyWrapper for ast::Identifier { + #[inline] + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + Ok(self.as_str().to_object(py)) + } +} + +impl ToPyWrapper for ast::String { + #[inline] + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + Ok(self.as_str().to_object(py)) + } +} + +impl ToPyWrapper for ast::Int { + #[inline] + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + Ok((self.to_u32()).to_object(py)) + } +} + +impl ToPyWrapper for bool { + #[inline] + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + Ok((*self as u32).to_object(py)) + } +} + +impl ToPyWrapper for ConversionFlag { + #[inline] + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + Ok((*self as i8).to_object(py)) + } +} + +impl ToPyWrapper for ast::Constant { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + let value = match self { + ast::Constant::None => py.None(), + ast::Constant::Bool(bool) => bool.to_object(py), + ast::Constant::Str(string) => string.to_object(py), + ast::Constant::Bytes(bytes) => PyBytes::new(py, bytes).into(), + ast::Constant::Int(int) => int.to_object(py), + ast::Constant::Tuple(elts) => { + let elts: PyResult> = elts.iter().map(|c| c.to_py_wrapper(py)).collect(); + PyTuple::new(py, elts?).into() + } + ast::Constant::Float(f64) => f64.to_object(py), + ast::Constant::Complex { real, imag } => Complex64::new(*real, *imag).to_object(py), + ast::Constant::Ellipsis => py.Ellipsis(), + }; + Ok(value) + } +} + +impl ToPyWrapper for Vec { + fn to_py_wrapper(&'static self, py: Python) -> PyResult> { + let list = PyList::empty(py); + for item in self { + let py_item = item.to_py_wrapper(py)?; + list.append(py_item)?; + } + Ok(list.into()) + } +} + +#[pyclass(module = "rustpython_ast", subclass)] +pub struct Ast; + +#[pymethods] +impl Ast { + #[new] + fn new() -> Self { + Self + } +} + +pub mod located { + pub use super::Ast; + use super::*; + include!("gen/wrapper_located.rs"); +} + +pub mod ranged { + pub use super::Ast; + use super::*; + include!("gen/wrapper_ranged.rs"); +} + +fn init_type(py: Python, m: &PyModule) -> PyResult<()> { + m.add_class::

()?; + let node = m.getattr(P::NAME)?; + if P::NAME != N::NAME { + // TODO: no idea how to escape rust keyword on #[pyclass] + m.setattr(P::NAME, node)?; + } + let names: Vec<&'static str> = N::FIELD_NAMES.to_vec(); + let fields = PyTuple::new(py, names); + node.setattr("_fields", fields)?; + Ok(()) +} + +/// A Python module implemented in Rust. +fn init_module(py: Python, m: &PyModule) -> PyResult<()> { + m.add_class::()?; + + let ast = m.getattr("AST")?; + let fields = PyTuple::empty(py); + ast.setattr("_fields", fields)?; + + Ok(()) +} diff --git a/ast/Cargo.toml b/ast/Cargo.toml index bee7c188..cedfa50e 100644 --- a/ast/Cargo.toml +++ b/ast/Cargo.toml @@ -15,11 +15,6 @@ fold = [] unparse = ["rustpython-literal"] visitor = [] all-nodes-with-ranges = [] -pyo3 = ["dep:pyo3", "num-complex", "once_cell"] - -# This feature is experimental -# It reimplements AST types, but currently both slower than python AST types and limited to use in other API -pyo3-wrapper = ["pyo3"] [dependencies] rustpython-parser-core = { workspace = true } @@ -28,6 +23,5 @@ rustpython-literal = { workspace = true, optional = true } is-macro = { workspace = true } num-bigint = { workspace = true } static_assertions = "1.1.0" -num-complex = { workspace = true, optional = true } -once_cell = { workspace = true, optional = true } + pyo3 = { workspace = true, optional = true, features = ["num-bigint", "num-complex"] } diff --git a/ast/asdl_rs.py b/ast/asdl_rs.py index 7f0edd26..9fc36393 100755 --- a/ast/asdl_rs.py +++ b/ast/asdl_rs.py @@ -300,10 +300,13 @@ def emit_range(self, has_attributes, depth): def visitModule(self, mod): self.emit_attrs(0) - self.emit(""" + self.emit( + """ #[derive(is_macro::Is)] pub enum Ast { - """, 0) + """, + 0, + ) for dfn in mod.dfns: rust_name = rust_type_name(dfn.name) generics = "" if self.type_info[dfn.name].is_simple else "" @@ -315,23 +318,29 @@ def visitModule(self, mod): # "ast_" prefix to everywhere seems less useful. self.emit('#[is(name = "module")]', 1) self.emit(f"{rust_name}({rust_name}{generics}),", 1) - self.emit(""" - } - impl Node for Ast { - const NAME: &'static str = "AST"; - const FIELD_NAMES: &'static [&'static str] = &[]; - } - """, 0) + self.emit( + """ + } + impl Node for Ast { + const NAME: &'static str = "AST"; + const FIELD_NAMES: &'static [&'static str] = &[]; + } + """, + 0, + ) for dfn in mod.dfns: rust_name = rust_type_name(dfn.name) generics = "" if self.type_info[dfn.name].is_simple else "" - self.emit(f""" + self.emit( + f""" impl From<{rust_name}{generics}> for Ast {{ fn from(node: {rust_name}{generics}) -> Self {{ Ast::{rust_name}(node) }} }} - """, 0) + """, + 0, + ) for dfn in mod.dfns: self.visit(dfn) @@ -663,9 +672,7 @@ def visitConstructor(self, cons, type, depth): cons_type_name = f"{enum_name}{cons.name}" - self.emit( - f"impl Foldable for {cons_type_name}{apply_t} {{", depth - ) + self.emit(f"impl Foldable for {cons_type_name}{apply_t} {{", depth) self.emit(f"type Mapped = {cons_type_name}{apply_u};", depth + 1) self.emit( "fn fold + ?Sized>(self, folder: &mut F) -> Result {", @@ -1095,16 +1102,16 @@ def visitSum(self, sum, type): self.emit( f""" - impl ToPyo3Ast for crate::generic::{rust_name}{self.generics} {{ + impl ToPyAst for ast::{rust_name}{self.generics} {{ #[inline] - fn to_pyo3_ast(&self, {"_" if simple else ""}py: Python) -> PyResult> {{ + fn to_py_ast<'py>(&self, {"_" if simple else ""}py: Python<'py>) -> PyResult<&'py PyAny> {{ let instance = match &self {{ """, 0, ) for cons in sum.types: self.emit( - f"crate::{rust_name}::{cons.name}(cons) => cons.to_pyo3_ast(py)?,", + f"ast::{rust_name}::{cons.name}(cons) => cons.to_py_ast(py)?,", 1, ) self.emit( @@ -1128,9 +1135,9 @@ def emit_to_pyo3_with_fields(self, cons, type, name): type_info = self.type_info[type.name] self.emit( f""" - impl ToPyo3Ast for crate::{name}{self.generics} {{ + impl ToPyAst for ast::{name}{self.generics} {{ #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> {{ + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {{ let cache = Self::py_type_cache().get().unwrap(); """, 0, @@ -1144,12 +1151,39 @@ def emit_to_pyo3_with_fields(self, cons, type, name): 1, ) self.emit( - "let instance = cache.0.call1(py, (", + """ + let instance = Py::::as_ref(&cache.0, py).call1(( + """, 1, ) for field in cons.fields: + if field.type == "constant": + self.emit( + f"constant_to_object({rust_field(field.name)}, py),", + 3, + ) + continue + if field.type == "int": + if field.name == "level": + assert field.opt + self.emit( + f"{rust_field(field.name)}.map_or_else(|| py.None(), |level| level.to_u32().to_object(py)),", + 3, + ) + continue + if field.name in ( + "lineno", + "col_offset", + "end_lineno", + "end_col_offset", + ): + self.emit( + f"{rust_field(field.name)}.to_u32().to_object(py),", + 3, + ) + continue self.emit( - f"{rust_field(field.name)}.to_pyo3_ast(py)?,", + f"{rust_field(field.name)}.to_py_ast(py)?,", 3, ) self.emit( @@ -1158,7 +1192,7 @@ def emit_to_pyo3_with_fields(self, cons, type, name): ) else: self.emit( - "let instance = cache.0.call0(py)?;", + "let instance = Py::::as_ref(&cache.0, py).call0()?;", 1, ) self.emit( @@ -1168,12 +1202,12 @@ def emit_to_pyo3_with_fields(self, cons, type, name): if type.value.attributes and self.namespace == "located": self.emit( """ - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; + let cache = ast_cache(); + instance.setattr(cache.lineno.as_ref(py), _range.start.row.get())?; + instance.setattr(cache.col_offset.as_ref(py), _range.start.column.get())?; if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; + instance.setattr(cache.end_lineno.as_ref(py), end.row.get())?; + instance.setattr(cache.end_col_offset.as_ref(py), end.column.get())?; } """, 1, @@ -1218,7 +1252,7 @@ def ref_def(self): def ref(self): return "&" if self.borrow else "" - def emit_class(self, name, rust_name, simple, base="super::AST"): + def emit_class(self, name, rust_name, simple, base="super::Ast"): info = self.type_info[name] if simple: generics = "" @@ -1230,7 +1264,7 @@ def emit_class(self, name, rust_name, simple, base="super::AST"): into = f"{rust_name}" else: subclass = "" - body = f"(pub {self.ref_def} crate::{rust_name}{generics})" + body = f"(pub {self.ref_def} ast::{rust_name}{generics})" into = f"{rust_name}(node)" self.emit( @@ -1239,8 +1273,8 @@ def emit_class(self, name, rust_name, simple, base="super::AST"): #[derive(Clone, Debug)] pub struct {rust_name} {body}; - impl From<{self.ref_def} crate::{rust_name}{generics}> for {rust_name} {{ - fn from({"" if body else "_"}node: {self.ref_def} crate::{rust_name}{generics}) -> Self {{ + impl From<{self.ref_def} ast::{rust_name}{generics}> for {rust_name} {{ + fn from({"" if body else "_"}node: {self.ref_def} ast::{rust_name}{generics}) -> Self {{ {into} }} }} @@ -1254,7 +1288,7 @@ def emit_class(self, name, rust_name, simple, base="super::AST"): impl {rust_name} {{ #[new] fn new() -> PyClassInitializer {{ - PyClassInitializer::from(AST) + PyClassInitializer::from(Ast) .add_subclass(Self) }} @@ -1269,7 +1303,7 @@ def emit_class(self, name, rust_name, simple, base="super::AST"): 0, ) else: - if base != "super::AST": + if base != "super::Ast": add_subclass = f".add_subclass({base})" else: add_subclass = "" @@ -1277,7 +1311,7 @@ def emit_class(self, name, rust_name, simple, base="super::AST"): f""" impl ToPyObject for {rust_name} {{ fn to_object(&self, py: Python) -> PyObject {{ - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) {add_subclass} .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) @@ -1305,7 +1339,7 @@ def emit_getter(self, owner, type_name): #[getter] #[inline] fn get_{field.name}(&self, py: Python) -> PyResult {{ - self.0.{rust_field(field.name)}.to_pyo3_wrapper(py) + self.0.{rust_field(field.name)}.to_py_wrapper(py) }} """, 3, @@ -1331,7 +1365,7 @@ def emit_getattr(self, owner, type_name): for field in owner.fields: self.emit( - f'"{field.name}" => self.0.{rust_field(field.name)}.to_pyo3_wrapper(py)?,', + f'"{field.name}" => self.0.{rust_field(field.name)}.to_py_wrapper(py)?,', 3, ) @@ -1349,9 +1383,9 @@ def emit_getattr(self, owner, type_name): def emit_wrapper(self, rust_name): self.emit( f""" - impl ToPyo3Wrapper for crate::{rust_name}{self.generics} {{ + impl ToPyWrapper for ast::{rust_name}{self.generics} {{ #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> {{ + fn to_py_wrapper(&'static self, py: Python) -> PyResult> {{ Ok({rust_name}(self).to_object(py)) }} }} @@ -1375,16 +1409,16 @@ def visitSum(self, sum, type, depth=0): if not simple: self.emit( f""" - impl ToPyo3Wrapper for crate::{rust_name}{self.generics} {{ + impl ToPyWrapper for ast::{rust_name}{self.generics} {{ #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> {{ + fn to_py_wrapper(&'static self, py: Python) -> PyResult> {{ match &self {{ """, 0, ) for cons in sum.types: - self.emit(f"Self::{cons.name}(cons) => cons.to_pyo3_wrapper(py),", 3) + self.emit(f"Self::{cons.name}(cons) => cons.to_py_wrapper(py),", 3) self.emit( """ @@ -1413,7 +1447,7 @@ def visitConstructor(self, cons, parent, simple, depth): impl ToPyObject for {parent}{cons.name} {{ fn to_object(&self, py: Python) -> PyObject {{ - let initializer = PyClassInitializer::from(AST) + let initializer = PyClassInitializer::from(Ast) .add_subclass({parent}) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) @@ -1462,9 +1496,7 @@ def visitConstructor(self, cons, parent, simple, depth): self.emit_fields(cons.name, rust_name, simple) def emit_fields(self, name, rust_name, simple): - self.emit( - f"super::init_type::<{rust_name}, crate::generic::{rust_name}>(py, m)?;", 1 - ) + self.emit(f"super::init_type::<{rust_name}, ast::{rust_name}>(py, m)?;", 1) class StdlibClassDefVisitor(EmitVisitor): @@ -1812,7 +1844,7 @@ def write(info: TypeInfo): f.write( f""" - impl{generics} Pyo3Node for crate::generic::{rust_name}{generics} {{ + impl{generics} PyNode for ast::{rust_name}{generics} {{ #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> {{ static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -1842,7 +1874,7 @@ def write_to_pyo3(mod, type_info, f): for info in type_info.values(): rust_name = info.rust_sum_name - f.write(f"cache_py_type::(ast_module)?;\n") + f.write(f"cache_py_type::(ast_module)?;\n") f.write("Ok(())\n}") @@ -1856,20 +1888,20 @@ def write_to_pyo3_simple(type_info, f): rust_name = type_info.rust_sum_name f.write( f""" - impl ToPyo3Ast for crate::generic::{rust_name} {{ + impl ToPyAst for ast::{rust_name} {{ #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> {{ + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {{ let cell = match &self {{ """, ) for cons in type_info.type.value.types: f.write( - f"""crate::{rust_name}::{cons.name} => crate::{rust_name}{cons.name}::py_type_cache(),""", + f"""ast::{rust_name}::{cons.name} => ast::{rust_name}{cons.name}::py_type_cache(),""", ) f.write( """ }; - Ok(cell.get().unwrap().1.clone()) + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } } """, @@ -1887,9 +1919,9 @@ def write_pyo3_wrapper(mod, type_info, namespace, f): rust_name = type_info.rust_sum_name f.write( f""" - impl ToPyo3Wrapper for crate::generic::{rust_name} {{ + impl ToPyWrapper for ast::{rust_name} {{ #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> {{ + fn to_py_wrapper(&self, py: Python) -> PyResult> {{ match &self {{ """, ) @@ -1908,9 +1940,9 @@ def write_pyo3_wrapper(mod, type_info, namespace, f): for cons in type_info.type.value.types: f.write( f""" - impl ToPyo3Wrapper for crate::generic::{rust_name}{cons.name} {{ + impl ToPyWrapper for ast::{rust_name}{cons.name} {{ #[inline] - fn to_pyo3_wrapper(&self, py: Python) -> PyResult> {{ + fn to_py_wrapper(&self, py: Python) -> PyResult> {{ Ok({rust_name}{cons.name}.to_object(py)) }} }} @@ -1949,6 +1981,7 @@ def write_ast_mod(mod, type_info, f): def main( input_filename, ast_dir, + ast_pyo3_dir, module_filename, dump_module=False, ): @@ -1971,14 +2004,20 @@ def main( ("ranged", p(write_ranged_def, mod, type_info)), ("located", p(write_located_def, mod, type_info)), ("visitor", p(write_visitor_def, mod, type_info)), - ("to_pyo3", p(write_to_pyo3, mod, type_info)), - ("pyo3_wrapper_located", p(write_pyo3_wrapper, mod, type_info, "located")), - ("pyo3_wrapper_ranged", p(write_pyo3_wrapper, mod, type_info, "ranged")), ]: with (ast_dir / f"{filename}.rs").open("w") as f: f.write(auto_gen_msg) write(f) + for filename, write in [ + ("to_py_ast", p(write_to_pyo3, mod, type_info)), + ("wrapper_located", p(write_pyo3_wrapper, mod, type_info, "located")), + ("wrapper_ranged", p(write_pyo3_wrapper, mod, type_info, "ranged")), + ]: + with (ast_pyo3_dir / f"{filename}.rs").open("w") as f: + f.write(auto_gen_msg) + write(f) + with module_filename.open("w") as module_file: module_file.write(auto_gen_msg) write_ast_mod(mod, type_info, module_file) @@ -1990,6 +2029,7 @@ def main( parser = ArgumentParser() parser.add_argument("input_file", type=Path) parser.add_argument("-A", "--ast-dir", type=Path, required=True) + parser.add_argument("-O", "--ast-pyo3-dir", type=Path, required=True) parser.add_argument("-M", "--module-file", type=Path, required=True) parser.add_argument("-d", "--dump-module", action="store_true") @@ -1997,6 +2037,7 @@ def main( main( args.input_file, args.ast_dir, + args.ast_pyo3_dir, args.module_file, args.dump_module, ) diff --git a/ast/src/gen/to_pyo3.rs b/ast/src/gen/to_pyo3.rs deleted file mode 100644 index c8a7478f..00000000 --- a/ast/src/gen/to_pyo3.rs +++ /dev/null @@ -1,4937 +0,0 @@ -// File automatically generated by ast/asdl_rs.py. - -impl Pyo3Node for crate::generic::Mod { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ModModule { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ModInteractive { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ModExpression { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ModFunctionType { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Stmt { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtFunctionDef { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtAsyncFunctionDef { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtClassDef { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtReturn { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtDelete { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtAssign { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtAugAssign { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtAnnAssign { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtFor { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtAsyncFor { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtWhile { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtIf { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtWith { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtAsyncWith { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtMatch { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtRaise { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtTry { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtTryStar { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtAssert { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtImport { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtImportFrom { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtGlobal { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtNonlocal { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtExpr { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtPass { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtBreak { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::StmtContinue { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Expr { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprBoolOp { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprNamedExpr { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprBinOp { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprUnaryOp { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprLambda { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprIfExp { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprDict { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprSet { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprListComp { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprSetComp { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprDictComp { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprGeneratorExp { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprAwait { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprYield { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprYieldFrom { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprCompare { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprCall { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprFormattedValue { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprJoinedStr { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprConstant { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprAttribute { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprSubscript { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprStarred { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprName { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprList { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprTuple { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprSlice { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprContext { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprContextLoad { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprContextStore { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExprContextDel { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Boolop { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::BoolopAnd { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::BoolopOr { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Operator { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorAdd { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorSub { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorMult { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorMatMult { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorDiv { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorMod { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorPow { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorLShift { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorRShift { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorBitOr { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorBitXor { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorBitAnd { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::OperatorFloorDiv { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Unaryop { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::UnaryopInvert { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::UnaryopNot { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::UnaryopUAdd { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::UnaryopUSub { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Cmpop { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopEq { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopNotEq { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopLt { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopLtE { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopGt { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopGtE { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopIs { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopIsNot { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopIn { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::CmpopNotIn { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Comprehension { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Excepthandler { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::ExcepthandlerExceptHandler { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Arguments { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Arg { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Keyword { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Alias { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Withitem { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::MatchCase { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::Pattern { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::PatternMatchValue { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::PatternMatchSingleton { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::PatternMatchSequence { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::PatternMatchMapping { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::PatternMatchClass { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::PatternMatchStar { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::PatternMatchAs { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::PatternMatchOr { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::TypeIgnore { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl Pyo3Node for crate::generic::TypeIgnoreTypeIgnore { - #[inline] - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } -} - -impl ToPyo3Ast for crate::generic::ExprContext { - #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { - let cell = match &self { - crate::ExprContext::Load => crate::ExprContextLoad::py_type_cache(), - crate::ExprContext::Store => crate::ExprContextStore::py_type_cache(), - crate::ExprContext::Del => crate::ExprContextDel::py_type_cache(), - }; - Ok(cell.get().unwrap().1.clone()) - } -} - -impl ToPyo3Ast for crate::generic::Boolop { - #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { - let cell = match &self { - crate::Boolop::And => crate::BoolopAnd::py_type_cache(), - crate::Boolop::Or => crate::BoolopOr::py_type_cache(), - }; - Ok(cell.get().unwrap().1.clone()) - } -} - -impl ToPyo3Ast for crate::generic::Operator { - #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { - let cell = match &self { - crate::Operator::Add => crate::OperatorAdd::py_type_cache(), - crate::Operator::Sub => crate::OperatorSub::py_type_cache(), - crate::Operator::Mult => crate::OperatorMult::py_type_cache(), - crate::Operator::MatMult => crate::OperatorMatMult::py_type_cache(), - crate::Operator::Div => crate::OperatorDiv::py_type_cache(), - crate::Operator::Mod => crate::OperatorMod::py_type_cache(), - crate::Operator::Pow => crate::OperatorPow::py_type_cache(), - crate::Operator::LShift => crate::OperatorLShift::py_type_cache(), - crate::Operator::RShift => crate::OperatorRShift::py_type_cache(), - crate::Operator::BitOr => crate::OperatorBitOr::py_type_cache(), - crate::Operator::BitXor => crate::OperatorBitXor::py_type_cache(), - crate::Operator::BitAnd => crate::OperatorBitAnd::py_type_cache(), - crate::Operator::FloorDiv => crate::OperatorFloorDiv::py_type_cache(), - }; - Ok(cell.get().unwrap().1.clone()) - } -} - -impl ToPyo3Ast for crate::generic::Unaryop { - #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { - let cell = match &self { - crate::Unaryop::Invert => crate::UnaryopInvert::py_type_cache(), - crate::Unaryop::Not => crate::UnaryopNot::py_type_cache(), - crate::Unaryop::UAdd => crate::UnaryopUAdd::py_type_cache(), - crate::Unaryop::USub => crate::UnaryopUSub::py_type_cache(), - }; - Ok(cell.get().unwrap().1.clone()) - } -} - -impl ToPyo3Ast for crate::generic::Cmpop { - #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { - let cell = match &self { - crate::Cmpop::Eq => crate::CmpopEq::py_type_cache(), - crate::Cmpop::NotEq => crate::CmpopNotEq::py_type_cache(), - crate::Cmpop::Lt => crate::CmpopLt::py_type_cache(), - crate::Cmpop::LtE => crate::CmpopLtE::py_type_cache(), - crate::Cmpop::Gt => crate::CmpopGt::py_type_cache(), - crate::Cmpop::GtE => crate::CmpopGtE::py_type_cache(), - crate::Cmpop::Is => crate::CmpopIs::py_type_cache(), - crate::Cmpop::IsNot => crate::CmpopIsNot::py_type_cache(), - crate::Cmpop::In => crate::CmpopIn::py_type_cache(), - crate::Cmpop::NotIn => crate::CmpopNotIn::py_type_cache(), - }; - Ok(cell.get().unwrap().1.clone()) - } -} - -impl ToPyo3Ast for crate::generic::Mod { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Mod::Module(cons) => cons.to_pyo3_ast(py)?, - crate::Mod::Interactive(cons) => cons.to_pyo3_ast(py)?, - crate::Mod::Expression(cons) => cons.to_pyo3_ast(py)?, - crate::Mod::FunctionType(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ModModule { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - type_ignores, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (body.to_pyo3_ast(py)?, type_ignores.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ModInteractive { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - range: _range, - } = self; - let instance = cache.0.call1(py, (body.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ModExpression { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - range: _range, - } = self; - let instance = cache.0.call1(py, (body.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ModFunctionType { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - argtypes, - returns, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (argtypes.to_pyo3_ast(py)?, returns.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Stmt { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Stmt::FunctionDef(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AsyncFunctionDef(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::ClassDef(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Return(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Delete(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Assign(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AugAssign(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AnnAssign(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::For(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AsyncFor(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::While(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::If(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::With(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AsyncWith(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Match(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Raise(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Try(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::TryStar(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Assert(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Import(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::ImportFrom(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Global(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Nonlocal(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Expr(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Pass(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Break(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Continue(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtFunctionDef { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - args, - body, - decorator_list, - returns, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - name.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - decorator_list.to_pyo3_ast(py)?, - returns.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAsyncFunctionDef { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - args, - body, - decorator_list, - returns, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - name.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - decorator_list.to_pyo3_ast(py)?, - returns.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtClassDef { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - bases, - keywords, - body, - decorator_list, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - name.to_pyo3_ast(py)?, - bases.to_pyo3_ast(py)?, - keywords.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - decorator_list.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtReturn { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtDelete { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - targets, - range: _range, - } = self; - let instance = cache.0.call1(py, (targets.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAssign { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - targets, - value, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - targets.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAugAssign { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - op, - value, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - op.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAnnAssign { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - annotation, - value, - simple, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - annotation.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - simple.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtFor { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - iter, - body, - orelse, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - iter.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAsyncFor { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - iter, - body, - orelse, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - iter.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtWhile { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - test, - body, - orelse, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtIf { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - test, - body, - orelse, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtWith { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - items, - body, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - items.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAsyncWith { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - items, - body, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - items.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtMatch { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - subject, - cases, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (subject.to_pyo3_ast(py)?, cases.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtRaise { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - exc, - cause, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (exc.to_pyo3_ast(py)?, cause.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtTry { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - handlers, - orelse, - finalbody, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - body.to_pyo3_ast(py)?, - handlers.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - finalbody.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtTryStar { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - handlers, - orelse, - finalbody, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - body.to_pyo3_ast(py)?, - handlers.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - finalbody.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAssert { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - test, - msg, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (test.to_pyo3_ast(py)?, msg.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtImport { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - names, - range: _range, - } = self; - let instance = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtImportFrom { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - module, - names, - level, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - module.to_pyo3_ast(py)?, - names.to_pyo3_ast(py)?, - level.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtGlobal { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - names, - range: _range, - } = self; - let instance = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtNonlocal { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - names, - range: _range, - } = self; - let instance = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtExpr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtPass { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let instance = cache.0.call0(py)?; - let Self { range: _range } = self; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtBreak { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let instance = cache.0.call0(py)?; - let Self { range: _range } = self; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtContinue { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let instance = cache.0.call0(py)?; - let Self { range: _range } = self; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Expr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Expr::BoolOp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::NamedExpr(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::BinOp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::UnaryOp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Lambda(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::IfExp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Dict(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Set(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::ListComp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::SetComp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::DictComp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::GeneratorExp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Await(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Yield(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::YieldFrom(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Compare(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Call(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::FormattedValue(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::JoinedStr(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Constant(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Attribute(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Subscript(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Starred(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Name(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::List(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Tuple(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Slice(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprBoolOp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - op, - values, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (op.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprNamedExpr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - value, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (target.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprBinOp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - left, - op, - right, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - left.to_pyo3_ast(py)?, - op.to_pyo3_ast(py)?, - right.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprUnaryOp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - op, - operand, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (op.to_pyo3_ast(py)?, operand.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprLambda { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - args, - body, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (args.to_pyo3_ast(py)?, body.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprIfExp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - test, - body, - orelse, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprDict { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - keys, - values, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (keys.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprSet { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elts, - range: _range, - } = self; - let instance = cache.0.call1(py, (elts.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprListComp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elt, - generators, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprSetComp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elt, - generators, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprDictComp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - key, - value, - generators, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - key.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - generators.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprGeneratorExp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elt, - generators, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprAwait { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprYield { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprYieldFrom { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprCompare { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - left, - ops, - comparators, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - left.to_pyo3_ast(py)?, - ops.to_pyo3_ast(py)?, - comparators.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprCall { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - func, - args, - keywords, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - func.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - keywords.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprFormattedValue { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - conversion, - format_spec, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - value.to_pyo3_ast(py)?, - conversion.to_pyo3_ast(py)?, - format_spec.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprJoinedStr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - values, - range: _range, - } = self; - let instance = cache.0.call1(py, (values.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprConstant { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - kind, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (value.to_pyo3_ast(py)?, kind.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprAttribute { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - attr, - ctx, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - value.to_pyo3_ast(py)?, - attr.to_pyo3_ast(py)?, - ctx.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprSubscript { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - slice, - ctx, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - value.to_pyo3_ast(py)?, - slice.to_pyo3_ast(py)?, - ctx.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprStarred { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - ctx, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (value.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprName { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - id, - ctx, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (id.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprList { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elts, - ctx, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprTuple { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elts, - ctx, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprSlice { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - lower, - upper, - step, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - lower.to_pyo3_ast(py)?, - upper.to_pyo3_ast(py)?, - step.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Comprehension { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - iter, - ifs, - is_async, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - iter.to_pyo3_ast(py)?, - ifs.to_pyo3_ast(py)?, - is_async.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Excepthandler { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Excepthandler::ExceptHandler(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - type_, - name, - body, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - type_.to_pyo3_ast(py)?, - name.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Arguments { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - posonlyargs, - args, - vararg, - kwonlyargs, - kw_defaults, - kwarg, - defaults, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - posonlyargs.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - vararg.to_pyo3_ast(py)?, - kwonlyargs.to_pyo3_ast(py)?, - kw_defaults.to_pyo3_ast(py)?, - kwarg.to_pyo3_ast(py)?, - defaults.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Arg { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - arg, - annotation, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - arg.to_pyo3_ast(py)?, - annotation.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Keyword { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - arg, - value, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (arg.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Alias { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - asname, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (name.to_pyo3_ast(py)?, asname.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Withitem { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - context_expr, - optional_vars, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - context_expr.to_pyo3_ast(py)?, - optional_vars.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::MatchCase { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - pattern, - guard, - body, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - pattern.to_pyo3_ast(py)?, - guard.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Pattern { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Pattern::MatchValue(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchSingleton(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchSequence(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchMapping(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchClass(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchStar(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchAs(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchOr(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchValue { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchSingleton { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchSequence { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - patterns, - range: _range, - } = self; - let instance = cache.0.call1(py, (patterns.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchMapping { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - keys, - patterns, - rest, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - keys.to_pyo3_ast(py)?, - patterns.to_pyo3_ast(py)?, - rest.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchClass { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - cls, - patterns, - kwd_attrs, - kwd_patterns, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - cls.to_pyo3_ast(py)?, - patterns.to_pyo3_ast(py)?, - kwd_attrs.to_pyo3_ast(py)?, - kwd_patterns.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchStar { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - range: _range, - } = self; - let instance = cache.0.call1(py, (name.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchAs { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - pattern, - name, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (pattern.to_pyo3_ast(py)?, name.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchOr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - patterns, - range: _range, - } = self; - let instance = cache.0.call1(py, (patterns.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::TypeIgnore { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::TypeIgnore::TypeIgnore(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - lineno, - tag, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (lineno.to_pyo3_ast(py)?, tag.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Mod { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Mod::Module(cons) => cons.to_pyo3_ast(py)?, - crate::Mod::Interactive(cons) => cons.to_pyo3_ast(py)?, - crate::Mod::Expression(cons) => cons.to_pyo3_ast(py)?, - crate::Mod::FunctionType(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ModModule { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - type_ignores, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (body.to_pyo3_ast(py)?, type_ignores.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ModInteractive { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - range: _range, - } = self; - let instance = cache.0.call1(py, (body.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ModExpression { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - range: _range, - } = self; - let instance = cache.0.call1(py, (body.to_pyo3_ast(py)?,))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ModFunctionType { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - argtypes, - returns, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (argtypes.to_pyo3_ast(py)?, returns.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Stmt { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Stmt::FunctionDef(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AsyncFunctionDef(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::ClassDef(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Return(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Delete(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Assign(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AugAssign(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AnnAssign(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::For(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AsyncFor(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::While(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::If(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::With(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::AsyncWith(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Match(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Raise(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Try(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::TryStar(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Assert(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Import(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::ImportFrom(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Global(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Nonlocal(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Expr(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Pass(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Break(cons) => cons.to_pyo3_ast(py)?, - crate::Stmt::Continue(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtFunctionDef { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - args, - body, - decorator_list, - returns, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - name.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - decorator_list.to_pyo3_ast(py)?, - returns.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAsyncFunctionDef { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - args, - body, - decorator_list, - returns, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - name.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - decorator_list.to_pyo3_ast(py)?, - returns.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtClassDef { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - bases, - keywords, - body, - decorator_list, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - name.to_pyo3_ast(py)?, - bases.to_pyo3_ast(py)?, - keywords.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - decorator_list.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtReturn { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtDelete { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - targets, - range: _range, - } = self; - let instance = cache.0.call1(py, (targets.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAssign { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - targets, - value, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - targets.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAugAssign { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - op, - value, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - op.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAnnAssign { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - annotation, - value, - simple, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - annotation.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - simple.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtFor { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - iter, - body, - orelse, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - iter.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAsyncFor { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - iter, - body, - orelse, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - iter.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtWhile { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - test, - body, - orelse, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtIf { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - test, - body, - orelse, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtWith { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - items, - body, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - items.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAsyncWith { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - items, - body, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - items.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtMatch { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - subject, - cases, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (subject.to_pyo3_ast(py)?, cases.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtRaise { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - exc, - cause, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (exc.to_pyo3_ast(py)?, cause.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtTry { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - handlers, - orelse, - finalbody, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - body.to_pyo3_ast(py)?, - handlers.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - finalbody.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtTryStar { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - body, - handlers, - orelse, - finalbody, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - body.to_pyo3_ast(py)?, - handlers.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - finalbody.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtAssert { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - test, - msg, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (test.to_pyo3_ast(py)?, msg.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtImport { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - names, - range: _range, - } = self; - let instance = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtImportFrom { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - module, - names, - level, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - module.to_pyo3_ast(py)?, - names.to_pyo3_ast(py)?, - level.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtGlobal { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - names, - range: _range, - } = self; - let instance = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtNonlocal { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - names, - range: _range, - } = self; - let instance = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtExpr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtPass { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let instance = cache.0.call0(py)?; - let Self { range: _range } = self; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtBreak { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let instance = cache.0.call0(py)?; - let Self { range: _range } = self; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::StmtContinue { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let instance = cache.0.call0(py)?; - let Self { range: _range } = self; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Expr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Expr::BoolOp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::NamedExpr(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::BinOp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::UnaryOp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Lambda(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::IfExp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Dict(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Set(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::ListComp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::SetComp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::DictComp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::GeneratorExp(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Await(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Yield(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::YieldFrom(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Compare(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Call(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::FormattedValue(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::JoinedStr(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Constant(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Attribute(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Subscript(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Starred(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Name(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::List(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Tuple(cons) => cons.to_pyo3_ast(py)?, - crate::Expr::Slice(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprBoolOp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - op, - values, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (op.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprNamedExpr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - value, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (target.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprBinOp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - left, - op, - right, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - left.to_pyo3_ast(py)?, - op.to_pyo3_ast(py)?, - right.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprUnaryOp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - op, - operand, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (op.to_pyo3_ast(py)?, operand.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprLambda { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - args, - body, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (args.to_pyo3_ast(py)?, body.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprIfExp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - test, - body, - orelse, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprDict { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - keys, - values, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (keys.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprSet { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elts, - range: _range, - } = self; - let instance = cache.0.call1(py, (elts.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprListComp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elt, - generators, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprSetComp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elt, - generators, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprDictComp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - key, - value, - generators, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - key.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - generators.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprGeneratorExp { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elt, - generators, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprAwait { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprYield { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprYieldFrom { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprCompare { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - left, - ops, - comparators, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - left.to_pyo3_ast(py)?, - ops.to_pyo3_ast(py)?, - comparators.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprCall { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - func, - args, - keywords, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - func.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - keywords.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprFormattedValue { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - conversion, - format_spec, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - value.to_pyo3_ast(py)?, - conversion.to_pyo3_ast(py)?, - format_spec.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprJoinedStr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - values, - range: _range, - } = self; - let instance = cache.0.call1(py, (values.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprConstant { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - kind, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (value.to_pyo3_ast(py)?, kind.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprAttribute { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - attr, - ctx, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - value.to_pyo3_ast(py)?, - attr.to_pyo3_ast(py)?, - ctx.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprSubscript { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - slice, - ctx, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - value.to_pyo3_ast(py)?, - slice.to_pyo3_ast(py)?, - ctx.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprStarred { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - ctx, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (value.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprName { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - id, - ctx, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (id.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprList { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elts, - ctx, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprTuple { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - elts, - ctx, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExprSlice { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - lower, - upper, - step, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - lower.to_pyo3_ast(py)?, - upper.to_pyo3_ast(py)?, - step.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Comprehension { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - target, - iter, - ifs, - is_async, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - target.to_pyo3_ast(py)?, - iter.to_pyo3_ast(py)?, - ifs.to_pyo3_ast(py)?, - is_async.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Excepthandler { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Excepthandler::ExceptHandler(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - type_, - name, - body, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - type_.to_pyo3_ast(py)?, - name.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Arguments { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - posonlyargs, - args, - vararg, - kwonlyargs, - kw_defaults, - kwarg, - defaults, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - posonlyargs.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - vararg.to_pyo3_ast(py)?, - kwonlyargs.to_pyo3_ast(py)?, - kw_defaults.to_pyo3_ast(py)?, - kwarg.to_pyo3_ast(py)?, - defaults.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Arg { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - arg, - annotation, - type_comment, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - arg.to_pyo3_ast(py)?, - annotation.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Keyword { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - arg, - value, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (arg.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Alias { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - asname, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (name.to_pyo3_ast(py)?, asname.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::Withitem { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - context_expr, - optional_vars, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - context_expr.to_pyo3_ast(py)?, - optional_vars.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::MatchCase { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - pattern, - guard, - body, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - pattern.to_pyo3_ast(py)?, - guard.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - ), - )?; - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::Pattern { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::Pattern::MatchValue(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchSingleton(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchSequence(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchMapping(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchClass(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchStar(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchAs(cons) => cons.to_pyo3_ast(py)?, - crate::Pattern::MatchOr(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchValue { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchSingleton { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - value, - range: _range, - } = self; - let instance = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchSequence { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - patterns, - range: _range, - } = self; - let instance = cache.0.call1(py, (patterns.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchMapping { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - keys, - patterns, - rest, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - keys.to_pyo3_ast(py)?, - patterns.to_pyo3_ast(py)?, - rest.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchClass { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - cls, - patterns, - kwd_attrs, - kwd_patterns, - range: _range, - } = self; - let instance = cache.0.call1( - py, - ( - cls.to_pyo3_ast(py)?, - patterns.to_pyo3_ast(py)?, - kwd_attrs.to_pyo3_ast(py)?, - kwd_patterns.to_pyo3_ast(py)?, - ), - )?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchStar { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - name, - range: _range, - } = self; - let instance = cache.0.call1(py, (name.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchAs { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - pattern, - name, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (pattern.to_pyo3_ast(py)?, name.to_pyo3_ast(py)?))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::PatternMatchOr { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - patterns, - range: _range, - } = self; - let instance = cache.0.call1(py, (patterns.to_pyo3_ast(py)?,))?; - - let cache = ast_key_cache().get().unwrap(); - instance.setattr(py, cache.lineno.as_ref(py), _range.start.row.get())?; - instance.setattr(py, cache.col_offset.as_ref(py), _range.start.column.get())?; - if let Some(end) = _range.end { - instance.setattr(py, cache.end_lineno.as_ref(py), end.row.get())?; - instance.setattr(py, cache.end_col_offset.as_ref(py), end.column.get())?; - } - - Ok(instance) - } -} - -impl ToPyo3Ast for crate::generic::TypeIgnore { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let instance = match &self { - crate::TypeIgnore::TypeIgnore(cons) => cons.to_pyo3_ast(py)?, - }; - Ok(instance) - } -} - -impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let cache = Self::py_type_cache().get().unwrap(); - - let Self { - lineno, - tag, - range: _range, - } = self; - let instance = cache - .0 - .call1(py, (lineno.to_pyo3_ast(py)?, tag.to_pyo3_ast(py)?))?; - - Ok(instance) - } -} - -fn init_types(py: Python) -> PyResult<()> { - let ast_module = PyModule::import(py, "_ast")?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - Ok(()) -} diff --git a/ast/src/lib.rs b/ast/src/lib.rs index 21cca63e..5a3c1ff5 100644 --- a/ast/src/lib.rs +++ b/ast/src/lib.rs @@ -41,8 +41,3 @@ pub use visitor::Visitor; mod optimizer; #[cfg(feature = "constant-optimization")] pub use optimizer::ConstantOptimizer; - -#[cfg(feature = "pyo3")] -pub mod pyo3; -#[cfg(feature = "pyo3-wrapper")] -pub mod pyo3_wrapper; diff --git a/ast/src/pyo3.rs b/ast/src/pyo3.rs deleted file mode 100644 index 74e51720..00000000 --- a/ast/src/pyo3.rs +++ /dev/null @@ -1,153 +0,0 @@ -use crate::{source_code::SourceRange, text_size::TextRange, ConversionFlag, Node}; -use num_complex::Complex64; -use once_cell::sync::OnceCell; -use pyo3::{ - prelude::*, - types::{PyBytes, PyList, PyString, PyTuple}, -}; - -pub trait Pyo3Node { - fn py_type_cache() -> &'static OnceCell<(Py, Py)> { - { - static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); - &PY_TYPE - } - } -} - -pub trait ToPyo3Ast { - fn to_pyo3_ast(&self, py: Python) -> PyResult>; -} - -impl ToPyo3Ast for Box { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - (**self).to_pyo3_ast(py) - } -} - -impl ToPyo3Ast for Option { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - match self { - Some(ast) => ast.to_pyo3_ast(py), - None => Ok(py.None()), - } - } -} - -impl ToPyo3Ast for Vec { - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let elts = self - .iter() - .map(|item| item.to_pyo3_ast(py)) - .collect::, _>>()?; - let list = PyList::new(py, elts); - Ok(list.into()) - } -} - -impl ToPyo3Ast for crate::Identifier { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - Ok(self.as_str().to_object(py)) - } -} - -impl ToPyo3Ast for crate::String { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - Ok(self.as_str().to_object(py)) - } -} - -impl ToPyo3Ast for crate::Int { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - Ok((self.to_u32()).to_object(py)) - } -} - -impl ToPyo3Ast for bool { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - Ok((*self as u32).to_object(py)) - } -} - -impl ToPyo3Ast for ConversionFlag { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - Ok((*self as i8).to_object(py)) - } -} - -impl ToPyo3Ast for crate::Constant { - #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - let value = match self { - crate::Constant::None => py.None(), - crate::Constant::Bool(bool) => bool.to_object(py), - crate::Constant::Str(string) => string.to_object(py), - crate::Constant::Bytes(bytes) => PyBytes::new(py, bytes).into(), - crate::Constant::Int(int) => int.to_object(py), - crate::Constant::Tuple(elts) => { - let elts: PyResult> = elts.iter().map(|c| c.to_pyo3_ast(py)).collect(); - PyTuple::new(py, elts?).into() - } - crate::Constant::Float(f64) => f64.to_object(py), - crate::Constant::Complex { real, imag } => Complex64::new(*real, *imag).to_object(py), - crate::Constant::Ellipsis => py.Ellipsis(), - }; - Ok(value) - } -} - -#[pyclass(module = "rustpython_ast", subclass)] -pub struct AST; - -#[pymethods] -impl AST { - #[new] - fn new() -> Self { - Self - } -} - -fn cache_py_type(ast_module: &PyAny) -> PyResult<()> { - let class = ast_module.getattr(N::NAME)?; - let base = if std::mem::size_of::() == 0 { - class.call0()? - } else { - class.getattr("__new__")? - }; - N::py_type_cache().get_or_init(|| (class.into(), base.into())); - Ok(()) -} - -struct AstKeyCache { - lineno: Py, - col_offset: Py, - end_lineno: Py, - end_col_offset: Py, -} - -fn ast_key_cache() -> &'static OnceCell { - { - static PY_TYPE: OnceCell = OnceCell::new(); - &PY_TYPE - } -} - -pub fn init(py: Python) -> PyResult<()> { - ast_key_cache().get_or_init(|| AstKeyCache { - lineno: pyo3::intern!(py, "lineno").into_py(py), - col_offset: pyo3::intern!(py, "col_offset").into_py(py), - end_lineno: pyo3::intern!(py, "end_lineno").into_py(py), - end_col_offset: pyo3::intern!(py, "end_col_offset").into_py(py), - }); - - init_types(py) -} - -include!("gen/to_pyo3.rs"); diff --git a/ast/src/pyo3_wrapper.rs b/ast/src/pyo3_wrapper.rs deleted file mode 100644 index a622ed06..00000000 --- a/ast/src/pyo3_wrapper.rs +++ /dev/null @@ -1,128 +0,0 @@ -use crate::pyo3::{Pyo3Node, AST}; -use crate::{source_code::SourceRange, text_size::TextRange, ConversionFlag, Node}; -use num_complex::Complex64; -use pyo3::prelude::*; -use pyo3::types::{PyBytes, PyList, PyTuple}; - -pub trait ToPyo3Wrapper { - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult>; -} - -impl ToPyo3Wrapper for Box { - #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - (**self).to_pyo3_wrapper(py) - } -} - -impl ToPyo3Wrapper for Option { - #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - match self { - Some(ast) => ast.to_pyo3_wrapper(py), - None => Ok(py.None()), - } - } -} - -impl ToPyo3Wrapper for crate::Identifier { - #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - Ok(self.as_str().to_object(py)) - } -} - -impl ToPyo3Wrapper for crate::String { - #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - Ok(self.as_str().to_object(py)) - } -} - -impl ToPyo3Wrapper for crate::Int { - #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - Ok((self.to_u32()).to_object(py)) - } -} - -impl ToPyo3Wrapper for bool { - #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - Ok((*self as u32).to_object(py)) - } -} - -impl ToPyo3Wrapper for ConversionFlag { - #[inline] - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - Ok((*self as i8).to_object(py)) - } -} - -impl ToPyo3Wrapper for crate::Constant { - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - let value = match self { - crate::Constant::None => py.None(), - crate::Constant::Bool(bool) => bool.to_object(py), - crate::Constant::Str(string) => string.to_object(py), - crate::Constant::Bytes(bytes) => PyBytes::new(py, bytes).into(), - crate::Constant::Int(int) => int.to_object(py), - crate::Constant::Tuple(elts) => { - let elts: PyResult> = elts.iter().map(|c| c.to_pyo3_wrapper(py)).collect(); - PyTuple::new(py, elts?).into() - } - crate::Constant::Float(f64) => f64.to_object(py), - crate::Constant::Complex { real, imag } => Complex64::new(*real, *imag).to_object(py), - crate::Constant::Ellipsis => py.Ellipsis(), - }; - Ok(value) - } -} - -impl ToPyo3Wrapper for Vec { - fn to_pyo3_wrapper(&'static self, py: Python) -> PyResult> { - let list = PyList::empty(py); - for item in self { - let py_item = item.to_pyo3_wrapper(py)?; - list.append(py_item)?; - } - Ok(list.into()) - } -} - -pub mod located { - use super::*; - pub use crate::pyo3::AST; - include!("gen/pyo3_wrapper_located.rs"); -} - -pub mod ranged { - use super::*; - pub use crate::pyo3::AST; - include!("gen/pyo3_wrapper_ranged.rs"); -} - -fn init_type(py: Python, m: &PyModule) -> PyResult<()> { - m.add_class::

()?; - let node = m.getattr(P::NAME)?; - if P::NAME != N::NAME { - // TODO: no idea how to escape rust keyword on #[pyclass] - m.setattr(P::NAME, node)?; - } - let names: Vec<&'static str> = N::FIELD_NAMES.to_vec(); - let fields = PyTuple::new(py, names); - node.setattr("_fields", fields)?; - Ok(()) -} - -/// A Python module implemented in Rust. -fn init_module(py: Python, m: &PyModule) -> PyResult<()> { - m.add_class::()?; - - let ast = m.getattr("AST")?; - let fields = PyTuple::empty(py); - ast.setattr("_fields", fields)?; - - Ok(()) -} diff --git a/scripts/update_asdl.sh b/scripts/update_asdl.sh index f2e3db25..af34cd22 100755 --- a/scripts/update_asdl.sh +++ b/scripts/update_asdl.sh @@ -4,5 +4,5 @@ set -e cd "$(dirname "$(dirname "$0")")" # rm ast/src/gen/*.rs -python ast/asdl_rs.py --ast-dir ast/src/gen/ --module-file ../RustPython/vm/src/stdlib/ast/gen.rs ast/Python.asdl -rustfmt ast/src/gen/*.rs ../RustPython/vm/src/stdlib/ast/gen.rs +python ast/asdl_rs.py --ast-dir ast/src/gen/ --ast-pyo3-dir ast-pyo3/src/gen/ --module-file ../RustPython/vm/src/stdlib/ast/gen.rs ast/Python.asdl +rustfmt ast/src/gen/*.rs ast-pyo3/src/gen/*.rs ../RustPython/vm/src/stdlib/ast/gen.rs