From b81273e9bc48d04f910619f3379041cee1b9f22e Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Mon, 22 May 2023 23:55:39 +0900 Subject: [PATCH 1/2] to_pyo3_ast to return &'py --- ast/asdl_rs.py | 84 +- ast/src/gen/to_pyo3.rs | 2374 +++++++++++++++++++--------------------- ast/src/pyo3.rs | 129 ++- 3 files changed, 1294 insertions(+), 1293 deletions(-) diff --git a/ast/asdl_rs.py b/ast/asdl_rs.py index 7f0edd26..c61a553e 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 {", @@ -1097,7 +1104,7 @@ def visitSum(self, sum, type): f""" impl ToPyo3Ast for crate::generic::{rust_name}{self.generics} {{ #[inline] - fn to_pyo3_ast(&self, {"_" if simple else ""}py: Python) -> PyResult> {{ + fn to_pyo3_ast<'py>(&self, {"_" if simple else ""}py: Python<'py>) -> PyResult<&'py PyAny> {{ let instance = match &self {{ """, 0, @@ -1130,7 +1137,7 @@ def emit_to_pyo3_with_fields(self, cons, type, name): f""" impl ToPyo3Ast for crate::{name}{self.generics} {{ #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> {{ + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {{ let cache = Self::py_type_cache().get().unwrap(); """, 0, @@ -1144,10 +1151,37 @@ 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"{rust_field(field.name)}.to_object(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)?,", 3, @@ -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, @@ -1858,7 +1892,7 @@ def write_to_pyo3_simple(type_info, f): f""" impl ToPyo3Ast for crate::generic::{rust_name} {{ #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> {{ + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {{ let cell = match &self {{ """, ) @@ -1869,7 +1903,7 @@ def write_to_pyo3_simple(type_info, f): f.write( """ }; - Ok(cell.get().unwrap().1.clone()) + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } } """, diff --git a/ast/src/gen/to_pyo3.rs b/ast/src/gen/to_pyo3.rs index c8a7478f..07c4bb06 100644 --- a/ast/src/gen/to_pyo3.rs +++ b/ast/src/gen/to_pyo3.rs @@ -946,30 +946,30 @@ impl Pyo3Node for crate::generic::TypeIgnoreTypeIgnore { impl ToPyo3Ast for crate::generic::ExprContext { #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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()) + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } } impl ToPyo3Ast for crate::generic::Boolop { #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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()) + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } } impl ToPyo3Ast for crate::generic::Operator { #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cell = match &self { crate::Operator::Add => crate::OperatorAdd::py_type_cache(), crate::Operator::Sub => crate::OperatorSub::py_type_cache(), @@ -985,26 +985,26 @@ impl ToPyo3Ast for crate::generic::Operator { crate::Operator::BitAnd => crate::OperatorBitAnd::py_type_cache(), crate::Operator::FloorDiv => crate::OperatorFloorDiv::py_type_cache(), }; - Ok(cell.get().unwrap().1.clone()) + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } } impl ToPyo3Ast for crate::generic::Unaryop { #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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()) + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } } impl ToPyo3Ast for crate::generic::Cmpop { #[inline] - fn to_pyo3_ast(&self, _py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cell = match &self { crate::Cmpop::Eq => crate::CmpopEq::py_type_cache(), crate::Cmpop::NotEq => crate::CmpopNotEq::py_type_cache(), @@ -1017,13 +1017,13 @@ impl ToPyo3Ast for crate::generic::Cmpop { crate::Cmpop::In => crate::CmpopIn::py_type_cache(), crate::Cmpop::NotIn => crate::CmpopNotIn::py_type_cache(), }; - Ok(cell.get().unwrap().1.clone()) + Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } } impl ToPyo3Ast for crate::generic::Mod { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Mod::Module(cons) => cons.to_pyo3_ast(py)?, crate::Mod::Interactive(cons) => cons.to_pyo3_ast(py)?, @@ -1036,7 +1036,7 @@ impl ToPyo3Ast for crate::generic::Mod { impl ToPyo3Ast for crate::ModModule { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1044,9 +1044,9 @@ impl ToPyo3Ast for crate::ModModule { type_ignores, range: _range, } = self; - let instance = cache - .0 - .call1(py, (body.to_pyo3_ast(py)?, type_ignores.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((body.to_pyo3_ast(py)?, type_ignores.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1054,14 +1054,15 @@ impl ToPyo3Ast for crate::ModModule { impl ToPyo3Ast for crate::ModInteractive { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (body.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((body.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1069,14 +1070,15 @@ impl ToPyo3Ast for crate::ModInteractive { impl ToPyo3Ast for crate::ModExpression { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (body.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((body.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1084,7 +1086,7 @@ impl ToPyo3Ast for crate::ModExpression { impl ToPyo3Ast for crate::ModFunctionType { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1092,9 +1094,9 @@ impl ToPyo3Ast for crate::ModFunctionType { returns, range: _range, } = self; - let instance = cache - .0 - .call1(py, (argtypes.to_pyo3_ast(py)?, returns.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((argtypes.to_pyo3_ast(py)?, returns.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1102,7 +1104,7 @@ impl ToPyo3Ast for crate::ModFunctionType { impl ToPyo3Ast for crate::generic::Stmt { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Stmt::FunctionDef(cons) => cons.to_pyo3_ast(py)?, crate::Stmt::AsyncFunctionDef(cons) => cons.to_pyo3_ast(py)?, @@ -1138,7 +1140,7 @@ impl ToPyo3Ast for crate::generic::Stmt { impl ToPyo3Ast for crate::StmtFunctionDef { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1150,17 +1152,15 @@ impl ToPyo3Ast for crate::StmtFunctionDef { 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 instance = Py::::as_ref(&cache.0, py).call1(( + 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) } @@ -1168,7 +1168,7 @@ impl ToPyo3Ast for crate::StmtFunctionDef { impl ToPyo3Ast for crate::StmtAsyncFunctionDef { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1180,17 +1180,15 @@ impl ToPyo3Ast for crate::StmtAsyncFunctionDef { 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 instance = Py::::as_ref(&cache.0, py).call1(( + 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) } @@ -1198,7 +1196,7 @@ impl ToPyo3Ast for crate::StmtAsyncFunctionDef { impl ToPyo3Ast for crate::StmtClassDef { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1209,16 +1207,14 @@ impl ToPyo3Ast for crate::StmtClassDef { 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 instance = Py::::as_ref(&cache.0, py).call1(( + 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) } @@ -1226,14 +1222,15 @@ impl ToPyo3Ast for crate::StmtClassDef { impl ToPyo3Ast for crate::StmtReturn { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1241,14 +1238,15 @@ impl ToPyo3Ast for crate::StmtReturn { impl ToPyo3Ast for crate::StmtDelete { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (targets.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((targets.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1256,7 +1254,7 @@ impl ToPyo3Ast for crate::StmtDelete { impl ToPyo3Ast for crate::StmtAssign { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1265,14 +1263,12 @@ impl ToPyo3Ast for crate::StmtAssign { 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 instance = Py::::as_ref(&cache.0, py).call1(( + targets.to_pyo3_ast(py)?, + value.to_pyo3_ast(py)?, + type_comment.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1280,7 +1276,7 @@ impl ToPyo3Ast for crate::StmtAssign { impl ToPyo3Ast for crate::StmtAugAssign { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1289,14 +1285,12 @@ impl ToPyo3Ast for crate::StmtAugAssign { 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 instance = Py::::as_ref(&cache.0, py).call1(( + target.to_pyo3_ast(py)?, + op.to_pyo3_ast(py)?, + value.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1304,7 +1298,7 @@ impl ToPyo3Ast for crate::StmtAugAssign { impl ToPyo3Ast for crate::StmtAnnAssign { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1314,15 +1308,13 @@ impl ToPyo3Ast for crate::StmtAnnAssign { 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 instance = Py::::as_ref(&cache.0, py).call1(( + target.to_pyo3_ast(py)?, + annotation.to_pyo3_ast(py)?, + value.to_pyo3_ast(py)?, + simple.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1330,7 +1322,7 @@ impl ToPyo3Ast for crate::StmtAnnAssign { impl ToPyo3Ast for crate::StmtFor { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1341,16 +1333,14 @@ impl ToPyo3Ast for crate::StmtFor { 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 instance = Py::::as_ref(&cache.0, py).call1(( + 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) } @@ -1358,7 +1348,7 @@ impl ToPyo3Ast for crate::StmtFor { impl ToPyo3Ast for crate::StmtAsyncFor { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1369,16 +1359,14 @@ impl ToPyo3Ast for crate::StmtAsyncFor { 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 instance = Py::::as_ref(&cache.0, py).call1(( + 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) } @@ -1386,7 +1374,7 @@ impl ToPyo3Ast for crate::StmtAsyncFor { impl ToPyo3Ast for crate::StmtWhile { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1395,14 +1383,12 @@ impl ToPyo3Ast for crate::StmtWhile { 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 instance = Py::::as_ref(&cache.0, py).call1(( + test.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + orelse.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1410,7 +1396,7 @@ impl ToPyo3Ast for crate::StmtWhile { impl ToPyo3Ast for crate::StmtIf { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1419,14 +1405,12 @@ impl ToPyo3Ast for crate::StmtIf { 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 instance = Py::::as_ref(&cache.0, py).call1(( + test.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + orelse.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1434,7 +1418,7 @@ impl ToPyo3Ast for crate::StmtIf { impl ToPyo3Ast for crate::StmtWith { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1443,14 +1427,12 @@ impl ToPyo3Ast for crate::StmtWith { 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 instance = Py::::as_ref(&cache.0, py).call1(( + items.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + type_comment.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1458,7 +1440,7 @@ impl ToPyo3Ast for crate::StmtWith { impl ToPyo3Ast for crate::StmtAsyncWith { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1467,14 +1449,12 @@ impl ToPyo3Ast for crate::StmtAsyncWith { 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 instance = Py::::as_ref(&cache.0, py).call1(( + items.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + type_comment.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1482,7 +1462,7 @@ impl ToPyo3Ast for crate::StmtAsyncWith { impl ToPyo3Ast for crate::StmtMatch { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1490,9 +1470,9 @@ impl ToPyo3Ast for crate::StmtMatch { cases, range: _range, } = self; - let instance = cache - .0 - .call1(py, (subject.to_pyo3_ast(py)?, cases.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((subject.to_pyo3_ast(py)?, cases.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1500,7 +1480,7 @@ impl ToPyo3Ast for crate::StmtMatch { impl ToPyo3Ast for crate::StmtRaise { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1508,9 +1488,9 @@ impl ToPyo3Ast for crate::StmtRaise { cause, range: _range, } = self; - let instance = cache - .0 - .call1(py, (exc.to_pyo3_ast(py)?, cause.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((exc.to_pyo3_ast(py)?, cause.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1518,7 +1498,7 @@ impl ToPyo3Ast for crate::StmtRaise { impl ToPyo3Ast for crate::StmtTry { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1528,15 +1508,13 @@ impl ToPyo3Ast for crate::StmtTry { 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 instance = Py::::as_ref(&cache.0, py).call1(( + body.to_pyo3_ast(py)?, + handlers.to_pyo3_ast(py)?, + orelse.to_pyo3_ast(py)?, + finalbody.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1544,7 +1522,7 @@ impl ToPyo3Ast for crate::StmtTry { impl ToPyo3Ast for crate::StmtTryStar { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1554,15 +1532,13 @@ impl ToPyo3Ast for crate::StmtTryStar { 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 instance = Py::::as_ref(&cache.0, py).call1(( + body.to_pyo3_ast(py)?, + handlers.to_pyo3_ast(py)?, + orelse.to_pyo3_ast(py)?, + finalbody.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1570,7 +1546,7 @@ impl ToPyo3Ast for crate::StmtTryStar { impl ToPyo3Ast for crate::StmtAssert { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1578,9 +1554,9 @@ impl ToPyo3Ast for crate::StmtAssert { msg, range: _range, } = self; - let instance = cache - .0 - .call1(py, (test.to_pyo3_ast(py)?, msg.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((test.to_pyo3_ast(py)?, msg.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1588,14 +1564,15 @@ impl ToPyo3Ast for crate::StmtAssert { impl ToPyo3Ast for crate::StmtImport { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1603,7 +1580,7 @@ impl ToPyo3Ast for crate::StmtImport { impl ToPyo3Ast for crate::StmtImportFrom { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1612,14 +1589,12 @@ impl ToPyo3Ast for crate::StmtImportFrom { 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 instance = Py::::as_ref(&cache.0, py).call1(( + module.to_pyo3_ast(py)?, + names.to_pyo3_ast(py)?, + level.map_or_else(|| py.None(), |level| level.to_u32().to_object(py)), + ))?; Ok(instance) } @@ -1627,14 +1602,15 @@ impl ToPyo3Ast for crate::StmtImportFrom { impl ToPyo3Ast for crate::StmtGlobal { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1642,14 +1618,15 @@ impl ToPyo3Ast for crate::StmtGlobal { impl ToPyo3Ast for crate::StmtNonlocal { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (names.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1657,14 +1634,15 @@ impl ToPyo3Ast for crate::StmtNonlocal { impl ToPyo3Ast for crate::StmtExpr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1672,10 +1650,10 @@ impl ToPyo3Ast for crate::StmtExpr { impl ToPyo3Ast for crate::StmtPass { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); - let instance = cache.0.call0(py)?; + let instance = Py::::as_ref(&cache.0, py).call0()?; let Self { range: _range } = self; Ok(instance) @@ -1684,10 +1662,10 @@ impl ToPyo3Ast for crate::StmtPass { impl ToPyo3Ast for crate::StmtBreak { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); - let instance = cache.0.call0(py)?; + let instance = Py::::as_ref(&cache.0, py).call0()?; let Self { range: _range } = self; Ok(instance) @@ -1696,10 +1674,10 @@ impl ToPyo3Ast for crate::StmtBreak { impl ToPyo3Ast for crate::StmtContinue { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); - let instance = cache.0.call0(py)?; + let instance = Py::::as_ref(&cache.0, py).call0()?; let Self { range: _range } = self; Ok(instance) @@ -1708,7 +1686,7 @@ impl ToPyo3Ast for crate::StmtContinue { impl ToPyo3Ast for crate::generic::Expr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Expr::BoolOp(cons) => cons.to_pyo3_ast(py)?, crate::Expr::NamedExpr(cons) => cons.to_pyo3_ast(py)?, @@ -1744,7 +1722,7 @@ impl ToPyo3Ast for crate::generic::Expr { impl ToPyo3Ast for crate::ExprBoolOp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1752,9 +1730,9 @@ impl ToPyo3Ast for crate::ExprBoolOp { values, range: _range, } = self; - let instance = cache - .0 - .call1(py, (op.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((op.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1762,7 +1740,7 @@ impl ToPyo3Ast for crate::ExprBoolOp { impl ToPyo3Ast for crate::ExprNamedExpr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1770,9 +1748,9 @@ impl ToPyo3Ast for crate::ExprNamedExpr { value, range: _range, } = self; - let instance = cache - .0 - .call1(py, (target.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((target.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1780,7 +1758,7 @@ impl ToPyo3Ast for crate::ExprNamedExpr { impl ToPyo3Ast for crate::ExprBinOp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1789,14 +1767,12 @@ impl ToPyo3Ast for crate::ExprBinOp { 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 instance = Py::::as_ref(&cache.0, py).call1(( + left.to_pyo3_ast(py)?, + op.to_pyo3_ast(py)?, + right.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1804,7 +1780,7 @@ impl ToPyo3Ast for crate::ExprBinOp { impl ToPyo3Ast for crate::ExprUnaryOp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1812,9 +1788,9 @@ impl ToPyo3Ast for crate::ExprUnaryOp { operand, range: _range, } = self; - let instance = cache - .0 - .call1(py, (op.to_pyo3_ast(py)?, operand.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((op.to_pyo3_ast(py)?, operand.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1822,7 +1798,7 @@ impl ToPyo3Ast for crate::ExprUnaryOp { impl ToPyo3Ast for crate::ExprLambda { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1830,9 +1806,9 @@ impl ToPyo3Ast for crate::ExprLambda { body, range: _range, } = self; - let instance = cache - .0 - .call1(py, (args.to_pyo3_ast(py)?, body.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((args.to_pyo3_ast(py)?, body.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1840,7 +1816,7 @@ impl ToPyo3Ast for crate::ExprLambda { impl ToPyo3Ast for crate::ExprIfExp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1849,14 +1825,12 @@ impl ToPyo3Ast for crate::ExprIfExp { 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 instance = Py::::as_ref(&cache.0, py).call1(( + test.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + orelse.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1864,7 +1838,7 @@ impl ToPyo3Ast for crate::ExprIfExp { impl ToPyo3Ast for crate::ExprDict { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1872,9 +1846,9 @@ impl ToPyo3Ast for crate::ExprDict { values, range: _range, } = self; - let instance = cache - .0 - .call1(py, (keys.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((keys.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1882,14 +1856,15 @@ impl ToPyo3Ast for crate::ExprDict { impl ToPyo3Ast for crate::ExprSet { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (elts.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((elts.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1897,7 +1872,7 @@ impl ToPyo3Ast for crate::ExprSet { impl ToPyo3Ast for crate::ExprListComp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1905,9 +1880,9 @@ impl ToPyo3Ast for crate::ExprListComp { generators, range: _range, } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1915,7 +1890,7 @@ impl ToPyo3Ast for crate::ExprListComp { impl ToPyo3Ast for crate::ExprSetComp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1923,9 +1898,9 @@ impl ToPyo3Ast for crate::ExprSetComp { generators, range: _range, } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1933,7 +1908,7 @@ impl ToPyo3Ast for crate::ExprSetComp { impl ToPyo3Ast for crate::ExprDictComp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1942,14 +1917,12 @@ impl ToPyo3Ast for crate::ExprDictComp { 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 instance = Py::::as_ref(&cache.0, py).call1(( + key.to_pyo3_ast(py)?, + value.to_pyo3_ast(py)?, + generators.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -1957,7 +1930,7 @@ impl ToPyo3Ast for crate::ExprDictComp { impl ToPyo3Ast for crate::ExprGeneratorExp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1965,9 +1938,9 @@ impl ToPyo3Ast for crate::ExprGeneratorExp { generators, range: _range, } = self; - let instance = cache - .0 - .call1(py, (elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; Ok(instance) } @@ -1975,14 +1948,15 @@ impl ToPyo3Ast for crate::ExprGeneratorExp { impl ToPyo3Ast for crate::ExprAwait { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -1990,14 +1964,15 @@ impl ToPyo3Ast for crate::ExprAwait { impl ToPyo3Ast for crate::ExprYield { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2005,14 +1980,15 @@ impl ToPyo3Ast for crate::ExprYield { impl ToPyo3Ast for crate::ExprYieldFrom { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2020,7 +1996,7 @@ impl ToPyo3Ast for crate::ExprYieldFrom { impl ToPyo3Ast for crate::ExprCompare { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2029,14 +2005,12 @@ impl ToPyo3Ast for crate::ExprCompare { 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 instance = Py::::as_ref(&cache.0, py).call1(( + left.to_pyo3_ast(py)?, + ops.to_pyo3_ast(py)?, + comparators.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2044,7 +2018,7 @@ impl ToPyo3Ast for crate::ExprCompare { impl ToPyo3Ast for crate::ExprCall { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2053,14 +2027,12 @@ impl ToPyo3Ast for crate::ExprCall { 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 instance = Py::::as_ref(&cache.0, py).call1(( + func.to_pyo3_ast(py)?, + args.to_pyo3_ast(py)?, + keywords.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2068,7 +2040,7 @@ impl ToPyo3Ast for crate::ExprCall { impl ToPyo3Ast for crate::ExprFormattedValue { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2077,14 +2049,12 @@ impl ToPyo3Ast for crate::ExprFormattedValue { 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 instance = Py::::as_ref(&cache.0, py).call1(( + value.to_pyo3_ast(py)?, + conversion.to_pyo3_ast(py)?, + format_spec.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2092,14 +2062,15 @@ impl ToPyo3Ast for crate::ExprFormattedValue { impl ToPyo3Ast for crate::ExprJoinedStr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (values.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((values.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2107,7 +2078,7 @@ impl ToPyo3Ast for crate::ExprJoinedStr { impl ToPyo3Ast for crate::ExprConstant { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2115,9 +2086,9 @@ impl ToPyo3Ast for crate::ExprConstant { kind, range: _range, } = self; - let instance = cache - .0 - .call1(py, (value.to_pyo3_ast(py)?, kind.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((value.to_object(py), kind.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2125,7 +2096,7 @@ impl ToPyo3Ast for crate::ExprConstant { impl ToPyo3Ast for crate::ExprAttribute { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2134,14 +2105,12 @@ impl ToPyo3Ast for crate::ExprAttribute { 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 instance = Py::::as_ref(&cache.0, py).call1(( + value.to_pyo3_ast(py)?, + attr.to_pyo3_ast(py)?, + ctx.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2149,7 +2118,7 @@ impl ToPyo3Ast for crate::ExprAttribute { impl ToPyo3Ast for crate::ExprSubscript { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2158,14 +2127,12 @@ impl ToPyo3Ast for crate::ExprSubscript { 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 instance = Py::::as_ref(&cache.0, py).call1(( + value.to_pyo3_ast(py)?, + slice.to_pyo3_ast(py)?, + ctx.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2173,7 +2140,7 @@ impl ToPyo3Ast for crate::ExprSubscript { impl ToPyo3Ast for crate::ExprStarred { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2181,9 +2148,9 @@ impl ToPyo3Ast for crate::ExprStarred { ctx, range: _range, } = self; - let instance = cache - .0 - .call1(py, (value.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((value.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2191,7 +2158,7 @@ impl ToPyo3Ast for crate::ExprStarred { impl ToPyo3Ast for crate::ExprName { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2199,9 +2166,9 @@ impl ToPyo3Ast for crate::ExprName { ctx, range: _range, } = self; - let instance = cache - .0 - .call1(py, (id.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + + let instance = + Py::::as_ref(&cache.0, py).call1((id.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2209,7 +2176,7 @@ impl ToPyo3Ast for crate::ExprName { impl ToPyo3Ast for crate::ExprList { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2217,9 +2184,9 @@ impl ToPyo3Ast for crate::ExprList { ctx, range: _range, } = self; - let instance = cache - .0 - .call1(py, (elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2227,7 +2194,7 @@ impl ToPyo3Ast for crate::ExprList { impl ToPyo3Ast for crate::ExprTuple { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2235,9 +2202,9 @@ impl ToPyo3Ast for crate::ExprTuple { ctx, range: _range, } = self; - let instance = cache - .0 - .call1(py, (elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2245,7 +2212,7 @@ impl ToPyo3Ast for crate::ExprTuple { impl ToPyo3Ast for crate::ExprSlice { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2254,14 +2221,12 @@ impl ToPyo3Ast for crate::ExprSlice { 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 instance = Py::::as_ref(&cache.0, py).call1(( + lower.to_pyo3_ast(py)?, + upper.to_pyo3_ast(py)?, + step.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2269,7 +2234,7 @@ impl ToPyo3Ast for crate::ExprSlice { impl ToPyo3Ast for crate::Comprehension { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2279,15 +2244,13 @@ impl ToPyo3Ast for crate::Comprehension { 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)?, - ), - )?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_pyo3_ast(py)?, + iter.to_pyo3_ast(py)?, + ifs.to_pyo3_ast(py)?, + is_async.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2295,7 +2258,7 @@ impl ToPyo3Ast for crate::Comprehension { impl ToPyo3Ast for crate::generic::Excepthandler { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Excepthandler::ExceptHandler(cons) => cons.to_pyo3_ast(py)?, }; @@ -2305,7 +2268,7 @@ impl ToPyo3Ast for crate::generic::Excepthandler { impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2314,14 +2277,12 @@ impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { 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 instance = Py::::as_ref(&cache.0, py).call1(( + type_.to_pyo3_ast(py)?, + name.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2329,7 +2290,7 @@ impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { impl ToPyo3Ast for crate::Arguments { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2342,18 +2303,16 @@ impl ToPyo3Ast for crate::Arguments { 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)?, - ), - )?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + 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) } @@ -2361,7 +2320,7 @@ impl ToPyo3Ast for crate::Arguments { impl ToPyo3Ast for crate::Arg { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2370,14 +2329,12 @@ impl ToPyo3Ast for crate::Arg { 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 instance = Py::::as_ref(&cache.0, py).call1(( + arg.to_pyo3_ast(py)?, + annotation.to_pyo3_ast(py)?, + type_comment.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2385,7 +2342,7 @@ impl ToPyo3Ast for crate::Arg { impl ToPyo3Ast for crate::Keyword { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2393,9 +2350,9 @@ impl ToPyo3Ast for crate::Keyword { value, range: _range, } = self; - let instance = cache - .0 - .call1(py, (arg.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((arg.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2403,7 +2360,7 @@ impl ToPyo3Ast for crate::Keyword { impl ToPyo3Ast for crate::Alias { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2411,9 +2368,9 @@ impl ToPyo3Ast for crate::Alias { asname, range: _range, } = self; - let instance = cache - .0 - .call1(py, (name.to_pyo3_ast(py)?, asname.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((name.to_pyo3_ast(py)?, asname.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2421,7 +2378,7 @@ impl ToPyo3Ast for crate::Alias { impl ToPyo3Ast for crate::Withitem { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2429,13 +2386,11 @@ impl ToPyo3Ast for crate::Withitem { optional_vars, range: _range, } = self; - let instance = cache.0.call1( - py, - ( - context_expr.to_pyo3_ast(py)?, - optional_vars.to_pyo3_ast(py)?, - ), - )?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + context_expr.to_pyo3_ast(py)?, + optional_vars.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2443,7 +2398,7 @@ impl ToPyo3Ast for crate::Withitem { impl ToPyo3Ast for crate::MatchCase { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2452,14 +2407,12 @@ impl ToPyo3Ast for crate::MatchCase { 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)?, - ), - )?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + pattern.to_pyo3_ast(py)?, + guard.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2467,7 +2420,7 @@ impl ToPyo3Ast for crate::MatchCase { impl ToPyo3Ast for crate::generic::Pattern { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Pattern::MatchValue(cons) => cons.to_pyo3_ast(py)?, crate::Pattern::MatchSingleton(cons) => cons.to_pyo3_ast(py)?, @@ -2484,14 +2437,15 @@ impl ToPyo3Ast for crate::generic::Pattern { impl ToPyo3Ast for crate::PatternMatchValue { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2499,14 +2453,15 @@ impl ToPyo3Ast for crate::PatternMatchValue { impl ToPyo3Ast for crate::PatternMatchSingleton { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (value.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((value.to_object(py),))?; Ok(instance) } @@ -2514,14 +2469,15 @@ impl ToPyo3Ast for crate::PatternMatchSingleton { impl ToPyo3Ast for crate::PatternMatchSequence { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (patterns.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2529,7 +2485,7 @@ impl ToPyo3Ast for crate::PatternMatchSequence { impl ToPyo3Ast for crate::PatternMatchMapping { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2538,14 +2494,12 @@ impl ToPyo3Ast for crate::PatternMatchMapping { 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 instance = Py::::as_ref(&cache.0, py).call1(( + keys.to_pyo3_ast(py)?, + patterns.to_pyo3_ast(py)?, + rest.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2553,7 +2507,7 @@ impl ToPyo3Ast for crate::PatternMatchMapping { impl ToPyo3Ast for crate::PatternMatchClass { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2563,15 +2517,13 @@ impl ToPyo3Ast for crate::PatternMatchClass { 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 instance = Py::::as_ref(&cache.0, py).call1(( + cls.to_pyo3_ast(py)?, + patterns.to_pyo3_ast(py)?, + kwd_attrs.to_pyo3_ast(py)?, + kwd_patterns.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -2579,14 +2531,15 @@ impl ToPyo3Ast for crate::PatternMatchClass { impl ToPyo3Ast for crate::PatternMatchStar { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (name.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((name.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2594,7 +2547,7 @@ impl ToPyo3Ast for crate::PatternMatchStar { impl ToPyo3Ast for crate::PatternMatchAs { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2602,9 +2555,9 @@ impl ToPyo3Ast for crate::PatternMatchAs { name, range: _range, } = self; - let instance = cache - .0 - .call1(py, (pattern.to_pyo3_ast(py)?, name.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((pattern.to_pyo3_ast(py)?, name.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2612,14 +2565,15 @@ impl ToPyo3Ast for crate::PatternMatchAs { impl ToPyo3Ast for crate::PatternMatchOr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (patterns.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2627,7 +2581,7 @@ impl ToPyo3Ast for crate::PatternMatchOr { impl ToPyo3Ast for crate::generic::TypeIgnore { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::TypeIgnore::TypeIgnore(cons) => cons.to_pyo3_ast(py)?, }; @@ -2637,7 +2591,7 @@ impl ToPyo3Ast for crate::generic::TypeIgnore { impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2645,9 +2599,9 @@ impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { tag, range: _range, } = self; - let instance = cache - .0 - .call1(py, (lineno.to_pyo3_ast(py)?, tag.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((lineno.to_u32().to_object(py), tag.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2655,7 +2609,7 @@ impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { impl ToPyo3Ast for crate::generic::Mod { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Mod::Module(cons) => cons.to_pyo3_ast(py)?, crate::Mod::Interactive(cons) => cons.to_pyo3_ast(py)?, @@ -2668,7 +2622,7 @@ impl ToPyo3Ast for crate::generic::Mod { impl ToPyo3Ast for crate::ModModule { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2676,9 +2630,9 @@ impl ToPyo3Ast for crate::ModModule { type_ignores, range: _range, } = self; - let instance = cache - .0 - .call1(py, (body.to_pyo3_ast(py)?, type_ignores.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((body.to_pyo3_ast(py)?, type_ignores.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2686,14 +2640,15 @@ impl ToPyo3Ast for crate::ModModule { impl ToPyo3Ast for crate::ModInteractive { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (body.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((body.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2701,14 +2656,15 @@ impl ToPyo3Ast for crate::ModInteractive { impl ToPyo3Ast for crate::ModExpression { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = cache.0.call1(py, (body.to_pyo3_ast(py)?,))?; + + let instance = Py::::as_ref(&cache.0, py).call1((body.to_pyo3_ast(py)?,))?; Ok(instance) } @@ -2716,7 +2672,7 @@ impl ToPyo3Ast for crate::ModExpression { impl ToPyo3Ast for crate::ModFunctionType { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2724,9 +2680,9 @@ impl ToPyo3Ast for crate::ModFunctionType { returns, range: _range, } = self; - let instance = cache - .0 - .call1(py, (argtypes.to_pyo3_ast(py)?, returns.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((argtypes.to_pyo3_ast(py)?, returns.to_pyo3_ast(py)?))?; Ok(instance) } @@ -2734,7 +2690,7 @@ impl ToPyo3Ast for crate::ModFunctionType { impl ToPyo3Ast for crate::generic::Stmt { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Stmt::FunctionDef(cons) => cons.to_pyo3_ast(py)?, crate::Stmt::AsyncFunctionDef(cons) => cons.to_pyo3_ast(py)?, @@ -2770,7 +2726,7 @@ impl ToPyo3Ast for crate::generic::Stmt { impl ToPyo3Ast for crate::StmtFunctionDef { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2782,24 +2738,22 @@ impl ToPyo3Ast for crate::StmtFunctionDef { 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())?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + 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_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())?; } Ok(instance) @@ -2808,7 +2762,7 @@ impl ToPyo3Ast for crate::StmtFunctionDef { impl ToPyo3Ast for crate::StmtAsyncFunctionDef { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2820,24 +2774,22 @@ impl ToPyo3Ast for crate::StmtAsyncFunctionDef { 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())?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + 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_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())?; } Ok(instance) @@ -2846,7 +2798,7 @@ impl ToPyo3Ast for crate::StmtAsyncFunctionDef { impl ToPyo3Ast for crate::StmtClassDef { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2857,23 +2809,21 @@ impl ToPyo3Ast for crate::StmtClassDef { 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())?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + 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_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())?; } Ok(instance) @@ -2882,21 +2832,22 @@ impl ToPyo3Ast for crate::StmtClassDef { impl ToPyo3Ast for crate::StmtReturn { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_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(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())?; } Ok(instance) @@ -2905,21 +2856,22 @@ impl ToPyo3Ast for crate::StmtReturn { impl ToPyo3Ast for crate::StmtDelete { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((targets.to_pyo3_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(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())?; } Ok(instance) @@ -2928,7 +2880,7 @@ impl ToPyo3Ast for crate::StmtDelete { impl ToPyo3Ast for crate::StmtAssign { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2937,21 +2889,19 @@ impl ToPyo3Ast for crate::StmtAssign { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + targets.to_pyo3_ast(py)?, + value.to_pyo3_ast(py)?, + type_comment.to_pyo3_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(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())?; } Ok(instance) @@ -2960,7 +2910,7 @@ impl ToPyo3Ast for crate::StmtAssign { impl ToPyo3Ast for crate::StmtAugAssign { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2969,21 +2919,19 @@ impl ToPyo3Ast for crate::StmtAugAssign { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_pyo3_ast(py)?, + op.to_pyo3_ast(py)?, + value.to_pyo3_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(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())?; } Ok(instance) @@ -2992,7 +2940,7 @@ impl ToPyo3Ast for crate::StmtAugAssign { impl ToPyo3Ast for crate::StmtAnnAssign { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3002,22 +2950,20 @@ impl ToPyo3Ast for crate::StmtAnnAssign { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_pyo3_ast(py)?, + annotation.to_pyo3_ast(py)?, + value.to_pyo3_ast(py)?, + simple.to_pyo3_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(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())?; } Ok(instance) @@ -3026,7 +2972,7 @@ impl ToPyo3Ast for crate::StmtAnnAssign { impl ToPyo3Ast for crate::StmtFor { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3037,23 +2983,21 @@ impl ToPyo3Ast for crate::StmtFor { 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())?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + 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_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())?; } Ok(instance) @@ -3062,7 +3006,7 @@ impl ToPyo3Ast for crate::StmtFor { impl ToPyo3Ast for crate::StmtAsyncFor { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3073,23 +3017,21 @@ impl ToPyo3Ast for crate::StmtAsyncFor { 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())?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + 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_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())?; } Ok(instance) @@ -3098,7 +3040,7 @@ impl ToPyo3Ast for crate::StmtAsyncFor { impl ToPyo3Ast for crate::StmtWhile { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3107,21 +3049,19 @@ impl ToPyo3Ast for crate::StmtWhile { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + orelse.to_pyo3_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(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())?; } Ok(instance) @@ -3130,7 +3070,7 @@ impl ToPyo3Ast for crate::StmtWhile { impl ToPyo3Ast for crate::StmtIf { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3139,21 +3079,19 @@ impl ToPyo3Ast for crate::StmtIf { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + orelse.to_pyo3_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(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())?; } Ok(instance) @@ -3162,7 +3100,7 @@ impl ToPyo3Ast for crate::StmtIf { impl ToPyo3Ast for crate::StmtWith { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3171,21 +3109,19 @@ impl ToPyo3Ast for crate::StmtWith { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + items.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + type_comment.to_pyo3_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(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())?; } Ok(instance) @@ -3194,7 +3130,7 @@ impl ToPyo3Ast for crate::StmtWith { impl ToPyo3Ast for crate::StmtAsyncWith { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3203,21 +3139,19 @@ impl ToPyo3Ast for crate::StmtAsyncWith { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + items.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + type_comment.to_pyo3_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(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())?; } Ok(instance) @@ -3226,7 +3160,7 @@ impl ToPyo3Ast for crate::StmtAsyncWith { impl ToPyo3Ast for crate::StmtMatch { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3234,16 +3168,16 @@ impl ToPyo3Ast for crate::StmtMatch { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((subject.to_pyo3_ast(py)?, cases.to_pyo3_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(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())?; } Ok(instance) @@ -3252,7 +3186,7 @@ impl ToPyo3Ast for crate::StmtMatch { impl ToPyo3Ast for crate::StmtRaise { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3260,16 +3194,16 @@ impl ToPyo3Ast for crate::StmtRaise { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((exc.to_pyo3_ast(py)?, cause.to_pyo3_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(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())?; } Ok(instance) @@ -3278,7 +3212,7 @@ impl ToPyo3Ast for crate::StmtRaise { impl ToPyo3Ast for crate::StmtTry { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3288,22 +3222,20 @@ impl ToPyo3Ast for crate::StmtTry { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + body.to_pyo3_ast(py)?, + handlers.to_pyo3_ast(py)?, + orelse.to_pyo3_ast(py)?, + finalbody.to_pyo3_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(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())?; } Ok(instance) @@ -3312,7 +3244,7 @@ impl ToPyo3Ast for crate::StmtTry { impl ToPyo3Ast for crate::StmtTryStar { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3322,22 +3254,20 @@ impl ToPyo3Ast for crate::StmtTryStar { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + body.to_pyo3_ast(py)?, + handlers.to_pyo3_ast(py)?, + orelse.to_pyo3_ast(py)?, + finalbody.to_pyo3_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(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())?; } Ok(instance) @@ -3346,7 +3276,7 @@ impl ToPyo3Ast for crate::StmtTryStar { impl ToPyo3Ast for crate::StmtAssert { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3354,16 +3284,16 @@ impl ToPyo3Ast for crate::StmtAssert { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((test.to_pyo3_ast(py)?, msg.to_pyo3_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(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())?; } Ok(instance) @@ -3372,21 +3302,22 @@ impl ToPyo3Ast for crate::StmtAssert { impl ToPyo3Ast for crate::StmtImport { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_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(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())?; } Ok(instance) @@ -3395,7 +3326,7 @@ impl ToPyo3Ast for crate::StmtImport { impl ToPyo3Ast for crate::StmtImportFrom { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3404,21 +3335,19 @@ impl ToPyo3Ast for crate::StmtImportFrom { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + module.to_pyo3_ast(py)?, + names.to_pyo3_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(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())?; } Ok(instance) @@ -3427,21 +3356,22 @@ impl ToPyo3Ast for crate::StmtImportFrom { impl ToPyo3Ast for crate::StmtGlobal { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_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(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())?; } Ok(instance) @@ -3450,21 +3380,22 @@ impl ToPyo3Ast for crate::StmtGlobal { impl ToPyo3Ast for crate::StmtNonlocal { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_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(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())?; } Ok(instance) @@ -3473,21 +3404,22 @@ impl ToPyo3Ast for crate::StmtNonlocal { impl ToPyo3Ast for crate::StmtExpr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_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(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())?; } Ok(instance) @@ -3496,18 +3428,18 @@ impl ToPyo3Ast for crate::StmtExpr { impl ToPyo3Ast for crate::StmtPass { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); - let instance = cache.0.call0(py)?; + let instance = Py::::as_ref(&cache.0, py).call0()?; 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())?; + 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())?; } Ok(instance) @@ -3516,18 +3448,18 @@ impl ToPyo3Ast for crate::StmtPass { impl ToPyo3Ast for crate::StmtBreak { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); - let instance = cache.0.call0(py)?; + let instance = Py::::as_ref(&cache.0, py).call0()?; 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())?; + 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())?; } Ok(instance) @@ -3536,18 +3468,18 @@ impl ToPyo3Ast for crate::StmtBreak { impl ToPyo3Ast for crate::StmtContinue { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); - let instance = cache.0.call0(py)?; + let instance = Py::::as_ref(&cache.0, py).call0()?; 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())?; + 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())?; } Ok(instance) @@ -3556,7 +3488,7 @@ impl ToPyo3Ast for crate::StmtContinue { impl ToPyo3Ast for crate::generic::Expr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Expr::BoolOp(cons) => cons.to_pyo3_ast(py)?, crate::Expr::NamedExpr(cons) => cons.to_pyo3_ast(py)?, @@ -3592,7 +3524,7 @@ impl ToPyo3Ast for crate::generic::Expr { impl ToPyo3Ast for crate::ExprBoolOp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3600,16 +3532,16 @@ impl ToPyo3Ast for crate::ExprBoolOp { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((op.to_pyo3_ast(py)?, values.to_pyo3_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(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())?; } Ok(instance) @@ -3618,7 +3550,7 @@ impl ToPyo3Ast for crate::ExprBoolOp { impl ToPyo3Ast for crate::ExprNamedExpr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3626,16 +3558,16 @@ impl ToPyo3Ast for crate::ExprNamedExpr { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((target.to_pyo3_ast(py)?, value.to_pyo3_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(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())?; } Ok(instance) @@ -3644,7 +3576,7 @@ impl ToPyo3Ast for crate::ExprNamedExpr { impl ToPyo3Ast for crate::ExprBinOp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3653,21 +3585,19 @@ impl ToPyo3Ast for crate::ExprBinOp { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + left.to_pyo3_ast(py)?, + op.to_pyo3_ast(py)?, + right.to_pyo3_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(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())?; } Ok(instance) @@ -3676,7 +3606,7 @@ impl ToPyo3Ast for crate::ExprBinOp { impl ToPyo3Ast for crate::ExprUnaryOp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3684,16 +3614,16 @@ impl ToPyo3Ast for crate::ExprUnaryOp { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((op.to_pyo3_ast(py)?, operand.to_pyo3_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(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())?; } Ok(instance) @@ -3702,7 +3632,7 @@ impl ToPyo3Ast for crate::ExprUnaryOp { impl ToPyo3Ast for crate::ExprLambda { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3710,16 +3640,16 @@ impl ToPyo3Ast for crate::ExprLambda { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((args.to_pyo3_ast(py)?, body.to_pyo3_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(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())?; } Ok(instance) @@ -3728,7 +3658,7 @@ impl ToPyo3Ast for crate::ExprLambda { impl ToPyo3Ast for crate::ExprIfExp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3737,21 +3667,19 @@ impl ToPyo3Ast for crate::ExprIfExp { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + test.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + orelse.to_pyo3_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(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())?; } Ok(instance) @@ -3760,7 +3688,7 @@ impl ToPyo3Ast for crate::ExprIfExp { impl ToPyo3Ast for crate::ExprDict { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3768,16 +3696,16 @@ impl ToPyo3Ast for crate::ExprDict { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((keys.to_pyo3_ast(py)?, values.to_pyo3_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(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())?; } Ok(instance) @@ -3786,21 +3714,22 @@ impl ToPyo3Ast for crate::ExprDict { impl ToPyo3Ast for crate::ExprSet { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((elts.to_pyo3_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(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())?; } Ok(instance) @@ -3809,7 +3738,7 @@ impl ToPyo3Ast for crate::ExprSet { impl ToPyo3Ast for crate::ExprListComp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3817,16 +3746,16 @@ impl ToPyo3Ast for crate::ExprListComp { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_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(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())?; } Ok(instance) @@ -3835,7 +3764,7 @@ impl ToPyo3Ast for crate::ExprListComp { impl ToPyo3Ast for crate::ExprSetComp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3843,16 +3772,16 @@ impl ToPyo3Ast for crate::ExprSetComp { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_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(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())?; } Ok(instance) @@ -3861,7 +3790,7 @@ impl ToPyo3Ast for crate::ExprSetComp { impl ToPyo3Ast for crate::ExprDictComp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3870,21 +3799,19 @@ impl ToPyo3Ast for crate::ExprDictComp { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + key.to_pyo3_ast(py)?, + value.to_pyo3_ast(py)?, + generators.to_pyo3_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(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())?; } Ok(instance) @@ -3893,7 +3820,7 @@ impl ToPyo3Ast for crate::ExprDictComp { impl ToPyo3Ast for crate::ExprGeneratorExp { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3901,16 +3828,16 @@ impl ToPyo3Ast for crate::ExprGeneratorExp { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_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(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())?; } Ok(instance) @@ -3919,21 +3846,22 @@ impl ToPyo3Ast for crate::ExprGeneratorExp { impl ToPyo3Ast for crate::ExprAwait { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_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(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())?; } Ok(instance) @@ -3942,21 +3870,22 @@ impl ToPyo3Ast for crate::ExprAwait { impl ToPyo3Ast for crate::ExprYield { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_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(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())?; } Ok(instance) @@ -3965,21 +3894,22 @@ impl ToPyo3Ast for crate::ExprYield { impl ToPyo3Ast for crate::ExprYieldFrom { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_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(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())?; } Ok(instance) @@ -3988,7 +3918,7 @@ impl ToPyo3Ast for crate::ExprYieldFrom { impl ToPyo3Ast for crate::ExprCompare { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3997,21 +3927,19 @@ impl ToPyo3Ast for crate::ExprCompare { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + left.to_pyo3_ast(py)?, + ops.to_pyo3_ast(py)?, + comparators.to_pyo3_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(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())?; } Ok(instance) @@ -4020,7 +3948,7 @@ impl ToPyo3Ast for crate::ExprCompare { impl ToPyo3Ast for crate::ExprCall { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4029,21 +3957,19 @@ impl ToPyo3Ast for crate::ExprCall { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + func.to_pyo3_ast(py)?, + args.to_pyo3_ast(py)?, + keywords.to_pyo3_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(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())?; } Ok(instance) @@ -4052,7 +3978,7 @@ impl ToPyo3Ast for crate::ExprCall { impl ToPyo3Ast for crate::ExprFormattedValue { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4061,21 +3987,19 @@ impl ToPyo3Ast for crate::ExprFormattedValue { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_pyo3_ast(py)?, + conversion.to_pyo3_ast(py)?, + format_spec.to_pyo3_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(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())?; } Ok(instance) @@ -4084,21 +4008,22 @@ impl ToPyo3Ast for crate::ExprFormattedValue { impl ToPyo3Ast for crate::ExprJoinedStr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((values.to_pyo3_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(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())?; } Ok(instance) @@ -4107,7 +4032,7 @@ impl ToPyo3Ast for crate::ExprJoinedStr { impl ToPyo3Ast for crate::ExprConstant { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4115,16 +4040,16 @@ impl ToPyo3Ast for crate::ExprConstant { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((value.to_object(py), kind.to_pyo3_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(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())?; } Ok(instance) @@ -4133,7 +4058,7 @@ impl ToPyo3Ast for crate::ExprConstant { impl ToPyo3Ast for crate::ExprAttribute { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4142,21 +4067,19 @@ impl ToPyo3Ast for crate::ExprAttribute { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_pyo3_ast(py)?, + attr.to_pyo3_ast(py)?, + ctx.to_pyo3_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(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())?; } Ok(instance) @@ -4165,7 +4088,7 @@ impl ToPyo3Ast for crate::ExprAttribute { impl ToPyo3Ast for crate::ExprSubscript { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4174,21 +4097,19 @@ impl ToPyo3Ast for crate::ExprSubscript { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + value.to_pyo3_ast(py)?, + slice.to_pyo3_ast(py)?, + ctx.to_pyo3_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(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())?; } Ok(instance) @@ -4197,7 +4118,7 @@ impl ToPyo3Ast for crate::ExprSubscript { impl ToPyo3Ast for crate::ExprStarred { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4205,16 +4126,16 @@ impl ToPyo3Ast for crate::ExprStarred { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((value.to_pyo3_ast(py)?, ctx.to_pyo3_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(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())?; } Ok(instance) @@ -4223,7 +4144,7 @@ impl ToPyo3Ast for crate::ExprStarred { impl ToPyo3Ast for crate::ExprName { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4231,16 +4152,16 @@ impl ToPyo3Ast for crate::ExprName { 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())?; + let instance = + Py::::as_ref(&cache.0, py).call1((id.to_pyo3_ast(py)?, ctx.to_pyo3_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(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())?; } Ok(instance) @@ -4249,7 +4170,7 @@ impl ToPyo3Ast for crate::ExprName { impl ToPyo3Ast for crate::ExprList { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4257,16 +4178,16 @@ impl ToPyo3Ast for crate::ExprList { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((elts.to_pyo3_ast(py)?, ctx.to_pyo3_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(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())?; } Ok(instance) @@ -4275,7 +4196,7 @@ impl ToPyo3Ast for crate::ExprList { impl ToPyo3Ast for crate::ExprTuple { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4283,16 +4204,16 @@ impl ToPyo3Ast for crate::ExprTuple { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((elts.to_pyo3_ast(py)?, ctx.to_pyo3_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(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())?; } Ok(instance) @@ -4301,7 +4222,7 @@ impl ToPyo3Ast for crate::ExprTuple { impl ToPyo3Ast for crate::ExprSlice { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4310,21 +4231,19 @@ impl ToPyo3Ast for crate::ExprSlice { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + lower.to_pyo3_ast(py)?, + upper.to_pyo3_ast(py)?, + step.to_pyo3_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(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())?; } Ok(instance) @@ -4333,7 +4252,7 @@ impl ToPyo3Ast for crate::ExprSlice { impl ToPyo3Ast for crate::Comprehension { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4343,15 +4262,13 @@ impl ToPyo3Ast for crate::Comprehension { 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)?, - ), - )?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + target.to_pyo3_ast(py)?, + iter.to_pyo3_ast(py)?, + ifs.to_pyo3_ast(py)?, + is_async.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -4359,7 +4276,7 @@ impl ToPyo3Ast for crate::Comprehension { impl ToPyo3Ast for crate::generic::Excepthandler { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Excepthandler::ExceptHandler(cons) => cons.to_pyo3_ast(py)?, }; @@ -4369,7 +4286,7 @@ impl ToPyo3Ast for crate::generic::Excepthandler { impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4378,21 +4295,19 @@ impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + type_.to_pyo3_ast(py)?, + name.to_pyo3_ast(py)?, + body.to_pyo3_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(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())?; } Ok(instance) @@ -4401,7 +4316,7 @@ impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { impl ToPyo3Ast for crate::Arguments { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4414,18 +4329,16 @@ impl ToPyo3Ast for crate::Arguments { 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)?, - ), - )?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + 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) } @@ -4433,7 +4346,7 @@ impl ToPyo3Ast for crate::Arguments { impl ToPyo3Ast for crate::Arg { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4442,21 +4355,19 @@ impl ToPyo3Ast for crate::Arg { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + arg.to_pyo3_ast(py)?, + annotation.to_pyo3_ast(py)?, + type_comment.to_pyo3_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(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())?; } Ok(instance) @@ -4465,7 +4376,7 @@ impl ToPyo3Ast for crate::Arg { impl ToPyo3Ast for crate::Keyword { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4473,16 +4384,16 @@ impl ToPyo3Ast for crate::Keyword { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((arg.to_pyo3_ast(py)?, value.to_pyo3_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(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())?; } Ok(instance) @@ -4491,7 +4402,7 @@ impl ToPyo3Ast for crate::Keyword { impl ToPyo3Ast for crate::Alias { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4499,16 +4410,16 @@ impl ToPyo3Ast for crate::Alias { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((name.to_pyo3_ast(py)?, asname.to_pyo3_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(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())?; } Ok(instance) @@ -4517,7 +4428,7 @@ impl ToPyo3Ast for crate::Alias { impl ToPyo3Ast for crate::Withitem { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4525,13 +4436,11 @@ impl ToPyo3Ast for crate::Withitem { optional_vars, range: _range, } = self; - let instance = cache.0.call1( - py, - ( - context_expr.to_pyo3_ast(py)?, - optional_vars.to_pyo3_ast(py)?, - ), - )?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + context_expr.to_pyo3_ast(py)?, + optional_vars.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -4539,7 +4448,7 @@ impl ToPyo3Ast for crate::Withitem { impl ToPyo3Ast for crate::MatchCase { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4548,14 +4457,12 @@ impl ToPyo3Ast for crate::MatchCase { 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)?, - ), - )?; + + let instance = Py::::as_ref(&cache.0, py).call1(( + pattern.to_pyo3_ast(py)?, + guard.to_pyo3_ast(py)?, + body.to_pyo3_ast(py)?, + ))?; Ok(instance) } @@ -4563,7 +4470,7 @@ impl ToPyo3Ast for crate::MatchCase { impl ToPyo3Ast for crate::generic::Pattern { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::Pattern::MatchValue(cons) => cons.to_pyo3_ast(py)?, crate::Pattern::MatchSingleton(cons) => cons.to_pyo3_ast(py)?, @@ -4580,21 +4487,22 @@ impl ToPyo3Ast for crate::generic::Pattern { impl ToPyo3Ast for crate::PatternMatchValue { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_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(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())?; } Ok(instance) @@ -4603,21 +4511,22 @@ impl ToPyo3Ast for crate::PatternMatchValue { impl ToPyo3Ast for crate::PatternMatchSingleton { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((value.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(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())?; } Ok(instance) @@ -4626,21 +4535,22 @@ impl ToPyo3Ast for crate::PatternMatchSingleton { impl ToPyo3Ast for crate::PatternMatchSequence { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_pyo3_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(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())?; } Ok(instance) @@ -4649,7 +4559,7 @@ impl ToPyo3Ast for crate::PatternMatchSequence { impl ToPyo3Ast for crate::PatternMatchMapping { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4658,21 +4568,19 @@ impl ToPyo3Ast for crate::PatternMatchMapping { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + keys.to_pyo3_ast(py)?, + patterns.to_pyo3_ast(py)?, + rest.to_pyo3_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(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())?; } Ok(instance) @@ -4681,7 +4589,7 @@ impl ToPyo3Ast for crate::PatternMatchMapping { impl ToPyo3Ast for crate::PatternMatchClass { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4691,22 +4599,20 @@ impl ToPyo3Ast for crate::PatternMatchClass { 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())?; + let instance = Py::::as_ref(&cache.0, py).call1(( + 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_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())?; } Ok(instance) @@ -4715,21 +4621,22 @@ impl ToPyo3Ast for crate::PatternMatchClass { impl ToPyo3Ast for crate::PatternMatchStar { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((name.to_pyo3_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(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())?; } Ok(instance) @@ -4738,7 +4645,7 @@ impl ToPyo3Ast for crate::PatternMatchStar { impl ToPyo3Ast for crate::PatternMatchAs { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4746,16 +4653,16 @@ impl ToPyo3Ast for crate::PatternMatchAs { 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())?; + let instance = Py::::as_ref(&cache.0, py) + .call1((pattern.to_pyo3_ast(py)?, name.to_pyo3_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(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())?; } Ok(instance) @@ -4764,21 +4671,22 @@ impl ToPyo3Ast for crate::PatternMatchAs { impl ToPyo3Ast for crate::PatternMatchOr { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_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 = 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())?; + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_pyo3_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(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())?; } Ok(instance) @@ -4787,7 +4695,7 @@ impl ToPyo3Ast for crate::PatternMatchOr { impl ToPyo3Ast for crate::generic::TypeIgnore { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { crate::TypeIgnore::TypeIgnore(cons) => cons.to_pyo3_ast(py)?, }; @@ -4797,7 +4705,7 @@ impl ToPyo3Ast for crate::generic::TypeIgnore { impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4805,9 +4713,9 @@ impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { tag, range: _range, } = self; - let instance = cache - .0 - .call1(py, (lineno.to_pyo3_ast(py)?, tag.to_pyo3_ast(py)?))?; + + let instance = Py::::as_ref(&cache.0, py) + .call1((lineno.to_u32().to_object(py), tag.to_pyo3_ast(py)?))?; Ok(instance) } diff --git a/ast/src/pyo3.rs b/ast/src/pyo3.rs index 74e51720..928b5371 100644 --- a/ast/src/pyo3.rs +++ b/ast/src/pyo3.rs @@ -3,7 +3,8 @@ use num_complex::Complex64; use once_cell::sync::OnceCell; use pyo3::{ prelude::*, - types::{PyBytes, PyList, PyString, PyTuple}, + types::{PyBool, PyBytes, PyList, PyString, PyTuple}, + ToPyObject, }; pub trait Pyo3Node { @@ -16,28 +17,28 @@ pub trait Pyo3Node { } pub trait ToPyo3Ast { - fn to_pyo3_ast(&self, py: Python) -> PyResult>; + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>; } impl ToPyo3Ast for Box { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { (**self).to_pyo3_ast(py) } } impl ToPyo3Ast for Option { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { match self { Some(ast) => ast.to_pyo3_ast(py), - None => Ok(py.None()), + None => Ok(ast_cache().none_ref(py)), } } } impl ToPyo3Ast for Vec { - fn to_pyo3_ast(&self, py: Python) -> PyResult> { + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let elts = self .iter() .map(|item| item.to_pyo3_ast(py)) @@ -49,60 +50,74 @@ impl ToPyo3Ast for Vec { impl ToPyo3Ast for crate::Identifier { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - Ok(self.as_str().to_object(py)) + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + Ok(PyString::new(py, self.as_str()).into()) } } 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)) + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + Ok(PyString::new(py, self.as_str()).into()) } } impl ToPyo3Ast for bool { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - Ok((*self as u32).to_object(py)) + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + Ok(ast_cache().bool_int(py, *self)) } } impl ToPyo3Ast for ConversionFlag { #[inline] - fn to_pyo3_ast(&self, py: Python) -> PyResult> { - Ok((*self as i8).to_object(py)) + fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + Ok(ast_cache().conversion_flag(py, *self)) } } -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), +impl ToPyObject for crate::Constant { + fn to_object(&self, py: Python) -> PyObject { + let cache = ast_cache(); + match self { + crate::Constant::None => cache.none.clone_ref(py), + crate::Constant::Bool(bool) => cache.bool(py, *bool).into(), 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() + let elts: Vec<_> = elts.iter().map(|c| c.to_object(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 ToPyo3Ast for crate::Constant { +// #[inline] +// fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { +// let cache = ast_cache(); +// let value = match self { +// crate::Constant::None => cache.none_ref(py), +// crate::Constant::Bool(bool) => cache.bool_ref(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; @@ -125,26 +140,70 @@ fn cache_py_type(ast_module: &PyAny) -> PyResult<()> { Ok(()) } -struct AstKeyCache { +// 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_key_cache() -> &'static OnceCell { +fn ast_cache_cell() -> &'static OnceCell { { - static PY_TYPE: OnceCell = OnceCell::new(); + 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_key_cache().get_or_init(|| AstKeyCache { + 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) From 7d384d88d0d113975fabd0d4b768456a1f041bc6 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Tue, 23 May 2023 02:24:03 +0900 Subject: [PATCH 2/2] Separate rustpython_ast_pyo3 --- Cargo.toml | 1 + ast-pyo3/Cargo.toml | 16 + .../src/gen/to_py_ast.rs | 2136 ++++++++--------- .../src/gen/wrapper_located.rs | 1968 ++++++++------- .../src/gen/wrapper_ranged.rs | 1820 +++++++------- ast-pyo3/src/lib.rs | 5 + ast/src/pyo3.rs => ast-pyo3/src/py_ast.rs | 104 +- ast-pyo3/src/wrapper.rs | 141 ++ ast/Cargo.toml | 8 +- ast/asdl_rs.py | 81 +- ast/src/lib.rs | 5 - ast/src/pyo3_wrapper.rs | 128 - scripts/update_asdl.sh | 4 +- 13 files changed, 3209 insertions(+), 3208 deletions(-) create mode 100644 ast-pyo3/Cargo.toml rename ast/src/gen/to_pyo3.rs => ast-pyo3/src/gen/to_py_ast.rs (60%) rename ast/src/gen/pyo3_wrapper_located.rs => ast-pyo3/src/gen/wrapper_located.rs (54%) rename ast/src/gen/pyo3_wrapper_ranged.rs => ast-pyo3/src/gen/wrapper_ranged.rs (55%) create mode 100644 ast-pyo3/src/lib.rs rename ast/src/pyo3.rs => ast-pyo3/src/py_ast.rs (53%) create mode 100644 ast-pyo3/src/wrapper.rs delete mode 100644 ast/src/pyo3_wrapper.rs 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/src/gen/to_pyo3.rs b/ast-pyo3/src/gen/to_py_ast.rs similarity index 60% rename from ast/src/gen/to_pyo3.rs rename to ast-pyo3/src/gen/to_py_ast.rs index 07c4bb06..16ccadb9 100644 --- a/ast/src/gen/to_pyo3.rs +++ b/ast-pyo3/src/gen/to_py_ast.rs @@ -1,6 +1,6 @@ // File automatically generated by ast/asdl_rs.py. -impl Pyo3Node for crate::generic::Mod { +impl PyNode for ast::Mod { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -8,7 +8,7 @@ impl Pyo3Node for crate::generic::Mod { } } -impl Pyo3Node for crate::generic::ModModule { +impl PyNode for ast::ModModule { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -16,7 +16,7 @@ impl Pyo3Node for crate::generic::ModModule { } } -impl Pyo3Node for crate::generic::ModInteractive { +impl PyNode for ast::ModInteractive { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -24,7 +24,7 @@ impl Pyo3Node for crate::generic::ModInteractive { } } -impl Pyo3Node for crate::generic::ModExpression { +impl PyNode for ast::ModExpression { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -32,7 +32,7 @@ impl Pyo3Node for crate::generic::ModExpression { } } -impl Pyo3Node for crate::generic::ModFunctionType { +impl PyNode for ast::ModFunctionType { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -40,7 +40,7 @@ impl Pyo3Node for crate::generic::ModFunctionType { } } -impl Pyo3Node for crate::generic::Stmt { +impl PyNode for ast::Stmt { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -48,7 +48,7 @@ impl Pyo3Node for crate::generic::Stmt { } } -impl Pyo3Node for crate::generic::StmtFunctionDef { +impl PyNode for ast::StmtFunctionDef { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -56,7 +56,7 @@ impl Pyo3Node for crate::generic::StmtFunctionDef { } } -impl Pyo3Node for crate::generic::StmtAsyncFunctionDef { +impl PyNode for ast::StmtAsyncFunctionDef { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -64,7 +64,7 @@ impl Pyo3Node for crate::generic::StmtAsyncFunctionDef { } } -impl Pyo3Node for crate::generic::StmtClassDef { +impl PyNode for ast::StmtClassDef { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -72,7 +72,7 @@ impl Pyo3Node for crate::generic::StmtClassDef { } } -impl Pyo3Node for crate::generic::StmtReturn { +impl PyNode for ast::StmtReturn { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -80,7 +80,7 @@ impl Pyo3Node for crate::generic::StmtReturn { } } -impl Pyo3Node for crate::generic::StmtDelete { +impl PyNode for ast::StmtDelete { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -88,7 +88,7 @@ impl Pyo3Node for crate::generic::StmtDelete { } } -impl Pyo3Node for crate::generic::StmtAssign { +impl PyNode for ast::StmtAssign { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -96,7 +96,7 @@ impl Pyo3Node for crate::generic::StmtAssign { } } -impl Pyo3Node for crate::generic::StmtAugAssign { +impl PyNode for ast::StmtAugAssign { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -104,7 +104,7 @@ impl Pyo3Node for crate::generic::StmtAugAssign { } } -impl Pyo3Node for crate::generic::StmtAnnAssign { +impl PyNode for ast::StmtAnnAssign { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -112,7 +112,7 @@ impl Pyo3Node for crate::generic::StmtAnnAssign { } } -impl Pyo3Node for crate::generic::StmtFor { +impl PyNode for ast::StmtFor { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -120,7 +120,7 @@ impl Pyo3Node for crate::generic::StmtFor { } } -impl Pyo3Node for crate::generic::StmtAsyncFor { +impl PyNode for ast::StmtAsyncFor { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -128,7 +128,7 @@ impl Pyo3Node for crate::generic::StmtAsyncFor { } } -impl Pyo3Node for crate::generic::StmtWhile { +impl PyNode for ast::StmtWhile { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -136,7 +136,7 @@ impl Pyo3Node for crate::generic::StmtWhile { } } -impl Pyo3Node for crate::generic::StmtIf { +impl PyNode for ast::StmtIf { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -144,7 +144,7 @@ impl Pyo3Node for crate::generic::StmtIf { } } -impl Pyo3Node for crate::generic::StmtWith { +impl PyNode for ast::StmtWith { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -152,7 +152,7 @@ impl Pyo3Node for crate::generic::StmtWith { } } -impl Pyo3Node for crate::generic::StmtAsyncWith { +impl PyNode for ast::StmtAsyncWith { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -160,7 +160,7 @@ impl Pyo3Node for crate::generic::StmtAsyncWith { } } -impl Pyo3Node for crate::generic::StmtMatch { +impl PyNode for ast::StmtMatch { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -168,7 +168,7 @@ impl Pyo3Node for crate::generic::StmtMatch { } } -impl Pyo3Node for crate::generic::StmtRaise { +impl PyNode for ast::StmtRaise { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -176,7 +176,7 @@ impl Pyo3Node for crate::generic::StmtRaise { } } -impl Pyo3Node for crate::generic::StmtTry { +impl PyNode for ast::StmtTry { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -184,7 +184,7 @@ impl Pyo3Node for crate::generic::StmtTry { } } -impl Pyo3Node for crate::generic::StmtTryStar { +impl PyNode for ast::StmtTryStar { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -192,7 +192,7 @@ impl Pyo3Node for crate::generic::StmtTryStar { } } -impl Pyo3Node for crate::generic::StmtAssert { +impl PyNode for ast::StmtAssert { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -200,7 +200,7 @@ impl Pyo3Node for crate::generic::StmtAssert { } } -impl Pyo3Node for crate::generic::StmtImport { +impl PyNode for ast::StmtImport { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -208,7 +208,7 @@ impl Pyo3Node for crate::generic::StmtImport { } } -impl Pyo3Node for crate::generic::StmtImportFrom { +impl PyNode for ast::StmtImportFrom { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -216,7 +216,7 @@ impl Pyo3Node for crate::generic::StmtImportFrom { } } -impl Pyo3Node for crate::generic::StmtGlobal { +impl PyNode for ast::StmtGlobal { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -224,7 +224,7 @@ impl Pyo3Node for crate::generic::StmtGlobal { } } -impl Pyo3Node for crate::generic::StmtNonlocal { +impl PyNode for ast::StmtNonlocal { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -232,7 +232,7 @@ impl Pyo3Node for crate::generic::StmtNonlocal { } } -impl Pyo3Node for crate::generic::StmtExpr { +impl PyNode for ast::StmtExpr { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -240,7 +240,7 @@ impl Pyo3Node for crate::generic::StmtExpr { } } -impl Pyo3Node for crate::generic::StmtPass { +impl PyNode for ast::StmtPass { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -248,7 +248,7 @@ impl Pyo3Node for crate::generic::StmtPass { } } -impl Pyo3Node for crate::generic::StmtBreak { +impl PyNode for ast::StmtBreak { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -256,7 +256,7 @@ impl Pyo3Node for crate::generic::StmtBreak { } } -impl Pyo3Node for crate::generic::StmtContinue { +impl PyNode for ast::StmtContinue { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -264,7 +264,7 @@ impl Pyo3Node for crate::generic::StmtContinue { } } -impl Pyo3Node for crate::generic::Expr { +impl PyNode for ast::Expr { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -272,7 +272,7 @@ impl Pyo3Node for crate::generic::Expr { } } -impl Pyo3Node for crate::generic::ExprBoolOp { +impl PyNode for ast::ExprBoolOp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -280,7 +280,7 @@ impl Pyo3Node for crate::generic::ExprBoolOp { } } -impl Pyo3Node for crate::generic::ExprNamedExpr { +impl PyNode for ast::ExprNamedExpr { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -288,7 +288,7 @@ impl Pyo3Node for crate::generic::ExprNamedExpr { } } -impl Pyo3Node for crate::generic::ExprBinOp { +impl PyNode for ast::ExprBinOp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -296,7 +296,7 @@ impl Pyo3Node for crate::generic::ExprBinOp { } } -impl Pyo3Node for crate::generic::ExprUnaryOp { +impl PyNode for ast::ExprUnaryOp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -304,7 +304,7 @@ impl Pyo3Node for crate::generic::ExprUnaryOp { } } -impl Pyo3Node for crate::generic::ExprLambda { +impl PyNode for ast::ExprLambda { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -312,7 +312,7 @@ impl Pyo3Node for crate::generic::ExprLambda { } } -impl Pyo3Node for crate::generic::ExprIfExp { +impl PyNode for ast::ExprIfExp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -320,7 +320,7 @@ impl Pyo3Node for crate::generic::ExprIfExp { } } -impl Pyo3Node for crate::generic::ExprDict { +impl PyNode for ast::ExprDict { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -328,7 +328,7 @@ impl Pyo3Node for crate::generic::ExprDict { } } -impl Pyo3Node for crate::generic::ExprSet { +impl PyNode for ast::ExprSet { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -336,7 +336,7 @@ impl Pyo3Node for crate::generic::ExprSet { } } -impl Pyo3Node for crate::generic::ExprListComp { +impl PyNode for ast::ExprListComp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -344,7 +344,7 @@ impl Pyo3Node for crate::generic::ExprListComp { } } -impl Pyo3Node for crate::generic::ExprSetComp { +impl PyNode for ast::ExprSetComp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -352,7 +352,7 @@ impl Pyo3Node for crate::generic::ExprSetComp { } } -impl Pyo3Node for crate::generic::ExprDictComp { +impl PyNode for ast::ExprDictComp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -360,7 +360,7 @@ impl Pyo3Node for crate::generic::ExprDictComp { } } -impl Pyo3Node for crate::generic::ExprGeneratorExp { +impl PyNode for ast::ExprGeneratorExp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -368,7 +368,7 @@ impl Pyo3Node for crate::generic::ExprGeneratorExp { } } -impl Pyo3Node for crate::generic::ExprAwait { +impl PyNode for ast::ExprAwait { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -376,7 +376,7 @@ impl Pyo3Node for crate::generic::ExprAwait { } } -impl Pyo3Node for crate::generic::ExprYield { +impl PyNode for ast::ExprYield { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -384,7 +384,7 @@ impl Pyo3Node for crate::generic::ExprYield { } } -impl Pyo3Node for crate::generic::ExprYieldFrom { +impl PyNode for ast::ExprYieldFrom { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -392,7 +392,7 @@ impl Pyo3Node for crate::generic::ExprYieldFrom { } } -impl Pyo3Node for crate::generic::ExprCompare { +impl PyNode for ast::ExprCompare { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -400,7 +400,7 @@ impl Pyo3Node for crate::generic::ExprCompare { } } -impl Pyo3Node for crate::generic::ExprCall { +impl PyNode for ast::ExprCall { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -408,7 +408,7 @@ impl Pyo3Node for crate::generic::ExprCall { } } -impl Pyo3Node for crate::generic::ExprFormattedValue { +impl PyNode for ast::ExprFormattedValue { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -416,7 +416,7 @@ impl Pyo3Node for crate::generic::ExprFormattedValue { } } -impl Pyo3Node for crate::generic::ExprJoinedStr { +impl PyNode for ast::ExprJoinedStr { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -424,7 +424,7 @@ impl Pyo3Node for crate::generic::ExprJoinedStr { } } -impl Pyo3Node for crate::generic::ExprConstant { +impl PyNode for ast::ExprConstant { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -432,7 +432,7 @@ impl Pyo3Node for crate::generic::ExprConstant { } } -impl Pyo3Node for crate::generic::ExprAttribute { +impl PyNode for ast::ExprAttribute { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -440,7 +440,7 @@ impl Pyo3Node for crate::generic::ExprAttribute { } } -impl Pyo3Node for crate::generic::ExprSubscript { +impl PyNode for ast::ExprSubscript { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -448,7 +448,7 @@ impl Pyo3Node for crate::generic::ExprSubscript { } } -impl Pyo3Node for crate::generic::ExprStarred { +impl PyNode for ast::ExprStarred { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -456,7 +456,7 @@ impl Pyo3Node for crate::generic::ExprStarred { } } -impl Pyo3Node for crate::generic::ExprName { +impl PyNode for ast::ExprName { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -464,7 +464,7 @@ impl Pyo3Node for crate::generic::ExprName { } } -impl Pyo3Node for crate::generic::ExprList { +impl PyNode for ast::ExprList { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -472,7 +472,7 @@ impl Pyo3Node for crate::generic::ExprList { } } -impl Pyo3Node for crate::generic::ExprTuple { +impl PyNode for ast::ExprTuple { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -480,7 +480,7 @@ impl Pyo3Node for crate::generic::ExprTuple { } } -impl Pyo3Node for crate::generic::ExprSlice { +impl PyNode for ast::ExprSlice { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -488,7 +488,7 @@ impl Pyo3Node for crate::generic::ExprSlice { } } -impl Pyo3Node for crate::generic::ExprContext { +impl PyNode for ast::ExprContext { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -496,7 +496,7 @@ impl Pyo3Node for crate::generic::ExprContext { } } -impl Pyo3Node for crate::generic::ExprContextLoad { +impl PyNode for ast::ExprContextLoad { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -504,7 +504,7 @@ impl Pyo3Node for crate::generic::ExprContextLoad { } } -impl Pyo3Node for crate::generic::ExprContextStore { +impl PyNode for ast::ExprContextStore { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -512,7 +512,7 @@ impl Pyo3Node for crate::generic::ExprContextStore { } } -impl Pyo3Node for crate::generic::ExprContextDel { +impl PyNode for ast::ExprContextDel { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -520,7 +520,7 @@ impl Pyo3Node for crate::generic::ExprContextDel { } } -impl Pyo3Node for crate::generic::Boolop { +impl PyNode for ast::Boolop { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -528,7 +528,7 @@ impl Pyo3Node for crate::generic::Boolop { } } -impl Pyo3Node for crate::generic::BoolopAnd { +impl PyNode for ast::BoolopAnd { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -536,7 +536,7 @@ impl Pyo3Node for crate::generic::BoolopAnd { } } -impl Pyo3Node for crate::generic::BoolopOr { +impl PyNode for ast::BoolopOr { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -544,7 +544,7 @@ impl Pyo3Node for crate::generic::BoolopOr { } } -impl Pyo3Node for crate::generic::Operator { +impl PyNode for ast::Operator { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -552,7 +552,7 @@ impl Pyo3Node for crate::generic::Operator { } } -impl Pyo3Node for crate::generic::OperatorAdd { +impl PyNode for ast::OperatorAdd { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -560,7 +560,7 @@ impl Pyo3Node for crate::generic::OperatorAdd { } } -impl Pyo3Node for crate::generic::OperatorSub { +impl PyNode for ast::OperatorSub { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -568,7 +568,7 @@ impl Pyo3Node for crate::generic::OperatorSub { } } -impl Pyo3Node for crate::generic::OperatorMult { +impl PyNode for ast::OperatorMult { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -576,7 +576,7 @@ impl Pyo3Node for crate::generic::OperatorMult { } } -impl Pyo3Node for crate::generic::OperatorMatMult { +impl PyNode for ast::OperatorMatMult { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -584,7 +584,7 @@ impl Pyo3Node for crate::generic::OperatorMatMult { } } -impl Pyo3Node for crate::generic::OperatorDiv { +impl PyNode for ast::OperatorDiv { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -592,7 +592,7 @@ impl Pyo3Node for crate::generic::OperatorDiv { } } -impl Pyo3Node for crate::generic::OperatorMod { +impl PyNode for ast::OperatorMod { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -600,7 +600,7 @@ impl Pyo3Node for crate::generic::OperatorMod { } } -impl Pyo3Node for crate::generic::OperatorPow { +impl PyNode for ast::OperatorPow { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -608,7 +608,7 @@ impl Pyo3Node for crate::generic::OperatorPow { } } -impl Pyo3Node for crate::generic::OperatorLShift { +impl PyNode for ast::OperatorLShift { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -616,7 +616,7 @@ impl Pyo3Node for crate::generic::OperatorLShift { } } -impl Pyo3Node for crate::generic::OperatorRShift { +impl PyNode for ast::OperatorRShift { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -624,7 +624,7 @@ impl Pyo3Node for crate::generic::OperatorRShift { } } -impl Pyo3Node for crate::generic::OperatorBitOr { +impl PyNode for ast::OperatorBitOr { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -632,7 +632,7 @@ impl Pyo3Node for crate::generic::OperatorBitOr { } } -impl Pyo3Node for crate::generic::OperatorBitXor { +impl PyNode for ast::OperatorBitXor { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -640,7 +640,7 @@ impl Pyo3Node for crate::generic::OperatorBitXor { } } -impl Pyo3Node for crate::generic::OperatorBitAnd { +impl PyNode for ast::OperatorBitAnd { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -648,7 +648,7 @@ impl Pyo3Node for crate::generic::OperatorBitAnd { } } -impl Pyo3Node for crate::generic::OperatorFloorDiv { +impl PyNode for ast::OperatorFloorDiv { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -656,7 +656,7 @@ impl Pyo3Node for crate::generic::OperatorFloorDiv { } } -impl Pyo3Node for crate::generic::Unaryop { +impl PyNode for ast::Unaryop { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -664,7 +664,7 @@ impl Pyo3Node for crate::generic::Unaryop { } } -impl Pyo3Node for crate::generic::UnaryopInvert { +impl PyNode for ast::UnaryopInvert { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -672,7 +672,7 @@ impl Pyo3Node for crate::generic::UnaryopInvert { } } -impl Pyo3Node for crate::generic::UnaryopNot { +impl PyNode for ast::UnaryopNot { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -680,7 +680,7 @@ impl Pyo3Node for crate::generic::UnaryopNot { } } -impl Pyo3Node for crate::generic::UnaryopUAdd { +impl PyNode for ast::UnaryopUAdd { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -688,7 +688,7 @@ impl Pyo3Node for crate::generic::UnaryopUAdd { } } -impl Pyo3Node for crate::generic::UnaryopUSub { +impl PyNode for ast::UnaryopUSub { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -696,7 +696,7 @@ impl Pyo3Node for crate::generic::UnaryopUSub { } } -impl Pyo3Node for crate::generic::Cmpop { +impl PyNode for ast::Cmpop { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -704,7 +704,7 @@ impl Pyo3Node for crate::generic::Cmpop { } } -impl Pyo3Node for crate::generic::CmpopEq { +impl PyNode for ast::CmpopEq { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -712,7 +712,7 @@ impl Pyo3Node for crate::generic::CmpopEq { } } -impl Pyo3Node for crate::generic::CmpopNotEq { +impl PyNode for ast::CmpopNotEq { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -720,7 +720,7 @@ impl Pyo3Node for crate::generic::CmpopNotEq { } } -impl Pyo3Node for crate::generic::CmpopLt { +impl PyNode for ast::CmpopLt { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -728,7 +728,7 @@ impl Pyo3Node for crate::generic::CmpopLt { } } -impl Pyo3Node for crate::generic::CmpopLtE { +impl PyNode for ast::CmpopLtE { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -736,7 +736,7 @@ impl Pyo3Node for crate::generic::CmpopLtE { } } -impl Pyo3Node for crate::generic::CmpopGt { +impl PyNode for ast::CmpopGt { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -744,7 +744,7 @@ impl Pyo3Node for crate::generic::CmpopGt { } } -impl Pyo3Node for crate::generic::CmpopGtE { +impl PyNode for ast::CmpopGtE { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -752,7 +752,7 @@ impl Pyo3Node for crate::generic::CmpopGtE { } } -impl Pyo3Node for crate::generic::CmpopIs { +impl PyNode for ast::CmpopIs { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -760,7 +760,7 @@ impl Pyo3Node for crate::generic::CmpopIs { } } -impl Pyo3Node for crate::generic::CmpopIsNot { +impl PyNode for ast::CmpopIsNot { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -768,7 +768,7 @@ impl Pyo3Node for crate::generic::CmpopIsNot { } } -impl Pyo3Node for crate::generic::CmpopIn { +impl PyNode for ast::CmpopIn { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -776,7 +776,7 @@ impl Pyo3Node for crate::generic::CmpopIn { } } -impl Pyo3Node for crate::generic::CmpopNotIn { +impl PyNode for ast::CmpopNotIn { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -784,7 +784,7 @@ impl Pyo3Node for crate::generic::CmpopNotIn { } } -impl Pyo3Node for crate::generic::Comprehension { +impl PyNode for ast::Comprehension { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -792,7 +792,7 @@ impl Pyo3Node for crate::generic::Comprehension { } } -impl Pyo3Node for crate::generic::Excepthandler { +impl PyNode for ast::Excepthandler { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -800,7 +800,7 @@ impl Pyo3Node for crate::generic::Excepthandler { } } -impl Pyo3Node for crate::generic::ExcepthandlerExceptHandler { +impl PyNode for ast::ExcepthandlerExceptHandler { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -808,7 +808,7 @@ impl Pyo3Node for crate::generic::ExcepthandlerExceptHandler { } } -impl Pyo3Node for crate::generic::Arguments { +impl PyNode for ast::Arguments { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -816,7 +816,7 @@ impl Pyo3Node for crate::generic::Arguments { } } -impl Pyo3Node for crate::generic::Arg { +impl PyNode for ast::Arg { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -824,7 +824,7 @@ impl Pyo3Node for crate::generic::Arg { } } -impl Pyo3Node for crate::generic::Keyword { +impl PyNode for ast::Keyword { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -832,7 +832,7 @@ impl Pyo3Node for crate::generic::Keyword { } } -impl Pyo3Node for crate::generic::Alias { +impl PyNode for ast::Alias { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -840,7 +840,7 @@ impl Pyo3Node for crate::generic::Alias { } } -impl Pyo3Node for crate::generic::Withitem { +impl PyNode for ast::Withitem { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -848,7 +848,7 @@ impl Pyo3Node for crate::generic::Withitem { } } -impl Pyo3Node for crate::generic::MatchCase { +impl PyNode for ast::MatchCase { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -856,7 +856,7 @@ impl Pyo3Node for crate::generic::MatchCase { } } -impl Pyo3Node for crate::generic::Pattern { +impl PyNode for ast::Pattern { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -864,7 +864,7 @@ impl Pyo3Node for crate::generic::Pattern { } } -impl Pyo3Node for crate::generic::PatternMatchValue { +impl PyNode for ast::PatternMatchValue { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -872,7 +872,7 @@ impl Pyo3Node for crate::generic::PatternMatchValue { } } -impl Pyo3Node for crate::generic::PatternMatchSingleton { +impl PyNode for ast::PatternMatchSingleton { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -880,7 +880,7 @@ impl Pyo3Node for crate::generic::PatternMatchSingleton { } } -impl Pyo3Node for crate::generic::PatternMatchSequence { +impl PyNode for ast::PatternMatchSequence { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -888,7 +888,7 @@ impl Pyo3Node for crate::generic::PatternMatchSequence { } } -impl Pyo3Node for crate::generic::PatternMatchMapping { +impl PyNode for ast::PatternMatchMapping { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -896,7 +896,7 @@ impl Pyo3Node for crate::generic::PatternMatchMapping { } } -impl Pyo3Node for crate::generic::PatternMatchClass { +impl PyNode for ast::PatternMatchClass { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -904,7 +904,7 @@ impl Pyo3Node for crate::generic::PatternMatchClass { } } -impl Pyo3Node for crate::generic::PatternMatchStar { +impl PyNode for ast::PatternMatchStar { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -912,7 +912,7 @@ impl Pyo3Node for crate::generic::PatternMatchStar { } } -impl Pyo3Node for crate::generic::PatternMatchAs { +impl PyNode for ast::PatternMatchAs { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -920,7 +920,7 @@ impl Pyo3Node for crate::generic::PatternMatchAs { } } -impl Pyo3Node for crate::generic::PatternMatchOr { +impl PyNode for ast::PatternMatchOr { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -928,7 +928,7 @@ impl Pyo3Node for crate::generic::PatternMatchOr { } } -impl Pyo3Node for crate::generic::TypeIgnore { +impl PyNode for ast::TypeIgnore { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -936,7 +936,7 @@ impl Pyo3Node for crate::generic::TypeIgnore { } } -impl Pyo3Node for crate::generic::TypeIgnoreTypeIgnore { +impl PyNode for ast::TypeIgnoreTypeIgnore { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -944,99 +944,99 @@ impl Pyo3Node for crate::generic::TypeIgnoreTypeIgnore { } } -impl ToPyo3Ast for crate::generic::ExprContext { +impl ToPyAst for ast::ExprContext { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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(), + 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 ToPyo3Ast for crate::generic::Boolop { +impl ToPyAst for ast::Boolop { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cell = match &self { - crate::Boolop::And => crate::BoolopAnd::py_type_cache(), - crate::Boolop::Or => crate::BoolopOr::py_type_cache(), + 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 ToPyo3Ast for crate::generic::Operator { +impl ToPyAst for ast::Operator { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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(), + 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 ToPyo3Ast for crate::generic::Unaryop { +impl ToPyAst for ast::Unaryop { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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(), + 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 ToPyo3Ast for crate::generic::Cmpop { +impl ToPyAst for ast::Cmpop { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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(), + 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 ToPyo3Ast for crate::generic::Mod { +impl ToPyAst for ast::Mod { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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)?, + 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 ToPyo3Ast for crate::ModModule { +impl ToPyAst for ast::ModModule { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1046,15 +1046,15 @@ impl ToPyo3Ast for crate::ModModule { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((body.to_pyo3_ast(py)?, type_ignores.to_pyo3_ast(py)?))?; + .call1((body.to_py_ast(py)?, type_ignores.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ModInteractive { +impl ToPyAst for ast::ModInteractive { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1062,15 +1062,15 @@ impl ToPyo3Ast for crate::ModInteractive { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((body.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((body.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ModExpression { +impl ToPyAst for ast::ModExpression { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1078,15 +1078,15 @@ impl ToPyo3Ast for crate::ModExpression { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((body.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((body.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ModFunctionType { +impl ToPyAst for ast::ModFunctionType { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1096,51 +1096,51 @@ impl ToPyo3Ast for crate::ModFunctionType { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((argtypes.to_pyo3_ast(py)?, returns.to_pyo3_ast(py)?))?; + .call1((argtypes.to_py_ast(py)?, returns.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::generic::Stmt { +impl ToPyAst for ast::Stmt { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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)?, + 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 ToPyo3Ast for crate::StmtFunctionDef { +impl ToPyAst for ast::StmtFunctionDef { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1154,21 +1154,21 @@ impl ToPyo3Ast for crate::StmtFunctionDef { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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 ToPyo3Ast for crate::StmtAsyncFunctionDef { +impl ToPyAst for ast::StmtAsyncFunctionDef { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1182,21 +1182,21 @@ impl ToPyo3Ast for crate::StmtAsyncFunctionDef { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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 ToPyo3Ast for crate::StmtClassDef { +impl ToPyAst for ast::StmtClassDef { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1209,20 +1209,20 @@ impl ToPyo3Ast for crate::StmtClassDef { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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 ToPyo3Ast for crate::StmtReturn { +impl ToPyAst for ast::StmtReturn { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1230,15 +1230,15 @@ impl ToPyo3Ast for crate::StmtReturn { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtDelete { +impl ToPyAst for ast::StmtDelete { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1246,15 +1246,15 @@ impl ToPyo3Ast for crate::StmtDelete { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((targets.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((targets.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtAssign { +impl ToPyAst for ast::StmtAssign { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1265,18 +1265,18 @@ impl ToPyo3Ast for crate::StmtAssign { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - targets.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, + targets.to_py_ast(py)?, + value.to_py_ast(py)?, + type_comment.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtAugAssign { +impl ToPyAst for ast::StmtAugAssign { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1287,18 +1287,18 @@ impl ToPyo3Ast for crate::StmtAugAssign { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - target.to_pyo3_ast(py)?, - op.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, + target.to_py_ast(py)?, + op.to_py_ast(py)?, + value.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtAnnAssign { +impl ToPyAst for ast::StmtAnnAssign { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1310,19 +1310,19 @@ impl ToPyo3Ast for crate::StmtAnnAssign { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - target.to_pyo3_ast(py)?, - annotation.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - simple.to_pyo3_ast(py)?, + target.to_py_ast(py)?, + annotation.to_py_ast(py)?, + value.to_py_ast(py)?, + simple.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtFor { +impl ToPyAst for ast::StmtFor { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1335,20 +1335,20 @@ impl ToPyo3Ast for crate::StmtFor { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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 ToPyo3Ast for crate::StmtAsyncFor { +impl ToPyAst for ast::StmtAsyncFor { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1361,20 +1361,20 @@ impl ToPyo3Ast for crate::StmtAsyncFor { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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 ToPyo3Ast for crate::StmtWhile { +impl ToPyAst for ast::StmtWhile { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1385,18 +1385,18 @@ impl ToPyo3Ast for crate::StmtWhile { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtIf { +impl ToPyAst for ast::StmtIf { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1407,18 +1407,18 @@ impl ToPyo3Ast for crate::StmtIf { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtWith { +impl ToPyAst for ast::StmtWith { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1429,18 +1429,18 @@ impl ToPyo3Ast for crate::StmtWith { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - items.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, + items.to_py_ast(py)?, + body.to_py_ast(py)?, + type_comment.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtAsyncWith { +impl ToPyAst for ast::StmtAsyncWith { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1451,18 +1451,18 @@ impl ToPyo3Ast for crate::StmtAsyncWith { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - items.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, + items.to_py_ast(py)?, + body.to_py_ast(py)?, + type_comment.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtMatch { +impl ToPyAst for ast::StmtMatch { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1472,15 +1472,15 @@ impl ToPyo3Ast for crate::StmtMatch { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((subject.to_pyo3_ast(py)?, cases.to_pyo3_ast(py)?))?; + .call1((subject.to_py_ast(py)?, cases.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtRaise { +impl ToPyAst for ast::StmtRaise { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1489,16 +1489,16 @@ impl ToPyo3Ast for crate::StmtRaise { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((exc.to_pyo3_ast(py)?, cause.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((exc.to_py_ast(py)?, cause.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtTry { +impl ToPyAst for ast::StmtTry { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1510,19 +1510,19 @@ impl ToPyo3Ast for crate::StmtTry { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - body.to_pyo3_ast(py)?, - handlers.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - finalbody.to_pyo3_ast(py)?, + body.to_py_ast(py)?, + handlers.to_py_ast(py)?, + orelse.to_py_ast(py)?, + finalbody.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtTryStar { +impl ToPyAst for ast::StmtTryStar { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1534,19 +1534,19 @@ impl ToPyo3Ast for crate::StmtTryStar { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - body.to_pyo3_ast(py)?, - handlers.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - finalbody.to_pyo3_ast(py)?, + body.to_py_ast(py)?, + handlers.to_py_ast(py)?, + orelse.to_py_ast(py)?, + finalbody.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtAssert { +impl ToPyAst for ast::StmtAssert { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1555,16 +1555,16 @@ impl ToPyo3Ast for crate::StmtAssert { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((test.to_pyo3_ast(py)?, msg.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((test.to_py_ast(py)?, msg.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtImport { +impl ToPyAst for ast::StmtImport { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1572,15 +1572,15 @@ impl ToPyo3Ast for crate::StmtImport { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtImportFrom { +impl ToPyAst for ast::StmtImportFrom { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1591,8 +1591,8 @@ impl ToPyo3Ast for crate::StmtImportFrom { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - module.to_pyo3_ast(py)?, - names.to_pyo3_ast(py)?, + module.to_py_ast(py)?, + names.to_py_ast(py)?, level.map_or_else(|| py.None(), |level| level.to_u32().to_object(py)), ))?; @@ -1600,9 +1600,9 @@ impl ToPyo3Ast for crate::StmtImportFrom { } } -impl ToPyo3Ast for crate::StmtGlobal { +impl ToPyAst for ast::StmtGlobal { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1610,15 +1610,15 @@ impl ToPyo3Ast for crate::StmtGlobal { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtNonlocal { +impl ToPyAst for ast::StmtNonlocal { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1626,15 +1626,15 @@ impl ToPyo3Ast for crate::StmtNonlocal { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((names.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtExpr { +impl ToPyAst for ast::StmtExpr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1642,15 +1642,15 @@ impl ToPyo3Ast for crate::StmtExpr { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::StmtPass { +impl ToPyAst for ast::StmtPass { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + 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()?; @@ -1660,9 +1660,9 @@ impl ToPyo3Ast for crate::StmtPass { } } -impl ToPyo3Ast for crate::StmtBreak { +impl ToPyAst for ast::StmtBreak { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + 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()?; @@ -1672,9 +1672,9 @@ impl ToPyo3Ast for crate::StmtBreak { } } -impl ToPyo3Ast for crate::StmtContinue { +impl ToPyAst for ast::StmtContinue { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + 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()?; @@ -1684,45 +1684,45 @@ impl ToPyo3Ast for crate::StmtContinue { } } -impl ToPyo3Ast for crate::generic::Expr { +impl ToPyAst for ast::Expr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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)?, + 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 ToPyo3Ast for crate::ExprBoolOp { +impl ToPyAst for ast::ExprBoolOp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1731,16 +1731,16 @@ impl ToPyo3Ast for crate::ExprBoolOp { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((op.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((op.to_py_ast(py)?, values.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprNamedExpr { +impl ToPyAst for ast::ExprNamedExpr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1750,15 +1750,15 @@ impl ToPyo3Ast for crate::ExprNamedExpr { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((target.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; + .call1((target.to_py_ast(py)?, value.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprBinOp { +impl ToPyAst for ast::ExprBinOp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1769,18 +1769,18 @@ impl ToPyo3Ast for crate::ExprBinOp { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - left.to_pyo3_ast(py)?, - op.to_pyo3_ast(py)?, - right.to_pyo3_ast(py)?, + left.to_py_ast(py)?, + op.to_py_ast(py)?, + right.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprUnaryOp { +impl ToPyAst for ast::ExprUnaryOp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1789,16 +1789,16 @@ impl ToPyo3Ast for crate::ExprUnaryOp { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((op.to_pyo3_ast(py)?, operand.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((op.to_py_ast(py)?, operand.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprLambda { +impl ToPyAst for ast::ExprLambda { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1807,16 +1807,16 @@ impl ToPyo3Ast for crate::ExprLambda { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((args.to_pyo3_ast(py)?, body.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((args.to_py_ast(py)?, body.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprIfExp { +impl ToPyAst for ast::ExprIfExp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1827,18 +1827,18 @@ impl ToPyo3Ast for crate::ExprIfExp { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprDict { +impl ToPyAst for ast::ExprDict { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1848,15 +1848,15 @@ impl ToPyo3Ast for crate::ExprDict { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((keys.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; + .call1((keys.to_py_ast(py)?, values.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprSet { +impl ToPyAst for ast::ExprSet { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1864,15 +1864,15 @@ impl ToPyo3Ast for crate::ExprSet { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((elts.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprListComp { +impl ToPyAst for ast::ExprListComp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1882,15 +1882,15 @@ impl ToPyo3Ast for crate::ExprListComp { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprSetComp { +impl ToPyAst for ast::ExprSetComp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1900,15 +1900,15 @@ impl ToPyo3Ast for crate::ExprSetComp { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprDictComp { +impl ToPyAst for ast::ExprDictComp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1919,18 +1919,18 @@ impl ToPyo3Ast for crate::ExprDictComp { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - key.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - generators.to_pyo3_ast(py)?, + key.to_py_ast(py)?, + value.to_py_ast(py)?, + generators.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprGeneratorExp { +impl ToPyAst for ast::ExprGeneratorExp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1940,15 +1940,15 @@ impl ToPyo3Ast for crate::ExprGeneratorExp { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(py)?))?; + .call1((elt.to_py_ast(py)?, generators.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprAwait { +impl ToPyAst for ast::ExprAwait { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1956,15 +1956,15 @@ impl ToPyo3Ast for crate::ExprAwait { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprYield { +impl ToPyAst for ast::ExprYield { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1972,15 +1972,15 @@ impl ToPyo3Ast for crate::ExprYield { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprYieldFrom { +impl ToPyAst for ast::ExprYieldFrom { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -1988,15 +1988,15 @@ impl ToPyo3Ast for crate::ExprYieldFrom { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprCompare { +impl ToPyAst for ast::ExprCompare { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2007,18 +2007,18 @@ impl ToPyo3Ast for crate::ExprCompare { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - left.to_pyo3_ast(py)?, - ops.to_pyo3_ast(py)?, - comparators.to_pyo3_ast(py)?, + left.to_py_ast(py)?, + ops.to_py_ast(py)?, + comparators.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprCall { +impl ToPyAst for ast::ExprCall { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2029,18 +2029,18 @@ impl ToPyo3Ast for crate::ExprCall { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - func.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - keywords.to_pyo3_ast(py)?, + func.to_py_ast(py)?, + args.to_py_ast(py)?, + keywords.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprFormattedValue { +impl ToPyAst for ast::ExprFormattedValue { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2051,18 +2051,18 @@ impl ToPyo3Ast for crate::ExprFormattedValue { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - value.to_pyo3_ast(py)?, - conversion.to_pyo3_ast(py)?, - format_spec.to_pyo3_ast(py)?, + value.to_py_ast(py)?, + conversion.to_py_ast(py)?, + format_spec.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprJoinedStr { +impl ToPyAst for ast::ExprJoinedStr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2070,15 +2070,15 @@ impl ToPyo3Ast for crate::ExprJoinedStr { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((values.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((values.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprConstant { +impl ToPyAst for ast::ExprConstant { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2088,15 +2088,15 @@ impl ToPyo3Ast for crate::ExprConstant { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((value.to_object(py), kind.to_pyo3_ast(py)?))?; + .call1((constant_to_object(value, py), kind.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprAttribute { +impl ToPyAst for ast::ExprAttribute { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2107,18 +2107,18 @@ impl ToPyo3Ast for crate::ExprAttribute { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - value.to_pyo3_ast(py)?, - attr.to_pyo3_ast(py)?, - ctx.to_pyo3_ast(py)?, + value.to_py_ast(py)?, + attr.to_py_ast(py)?, + ctx.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprSubscript { +impl ToPyAst for ast::ExprSubscript { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2129,18 +2129,18 @@ impl ToPyo3Ast for crate::ExprSubscript { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - value.to_pyo3_ast(py)?, - slice.to_pyo3_ast(py)?, - ctx.to_pyo3_ast(py)?, + value.to_py_ast(py)?, + slice.to_py_ast(py)?, + ctx.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprStarred { +impl ToPyAst for ast::ExprStarred { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2149,16 +2149,16 @@ impl ToPyo3Ast for crate::ExprStarred { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((value.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?, ctx.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprName { +impl ToPyAst for ast::ExprName { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2168,15 +2168,15 @@ impl ToPyo3Ast for crate::ExprName { } = self; let instance = - Py::::as_ref(&cache.0, py).call1((id.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + Py::::as_ref(&cache.0, py).call1((id.to_py_ast(py)?, ctx.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprList { +impl ToPyAst for ast::ExprList { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2185,16 +2185,16 @@ impl ToPyo3Ast for crate::ExprList { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?, ctx.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprTuple { +impl ToPyAst for ast::ExprTuple { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2203,16 +2203,16 @@ impl ToPyo3Ast for crate::ExprTuple { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((elts.to_py_ast(py)?, ctx.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ExprSlice { +impl ToPyAst for ast::ExprSlice { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2223,18 +2223,18 @@ impl ToPyo3Ast for crate::ExprSlice { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - lower.to_pyo3_ast(py)?, - upper.to_pyo3_ast(py)?, - step.to_pyo3_ast(py)?, + lower.to_py_ast(py)?, + upper.to_py_ast(py)?, + step.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::Comprehension { +impl ToPyAst for ast::Comprehension { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2246,29 +2246,29 @@ impl ToPyo3Ast for crate::Comprehension { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - target.to_pyo3_ast(py)?, - iter.to_pyo3_ast(py)?, - ifs.to_pyo3_ast(py)?, - is_async.to_pyo3_ast(py)?, + target.to_py_ast(py)?, + iter.to_py_ast(py)?, + ifs.to_py_ast(py)?, + is_async.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::generic::Excepthandler { +impl ToPyAst for ast::Excepthandler { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { - crate::Excepthandler::ExceptHandler(cons) => cons.to_pyo3_ast(py)?, + ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?, }; Ok(instance) } } -impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { +impl ToPyAst for ast::ExcepthandlerExceptHandler { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2279,18 +2279,18 @@ impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - type_.to_pyo3_ast(py)?, - name.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, + type_.to_py_ast(py)?, + name.to_py_ast(py)?, + body.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::Arguments { +impl ToPyAst for ast::Arguments { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2305,22 +2305,22 @@ impl ToPyo3Ast for crate::Arguments { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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 ToPyo3Ast for crate::Arg { +impl ToPyAst for ast::Arg { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2331,18 +2331,18 @@ impl ToPyo3Ast for crate::Arg { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - arg.to_pyo3_ast(py)?, - annotation.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, + arg.to_py_ast(py)?, + annotation.to_py_ast(py)?, + type_comment.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::Keyword { +impl ToPyAst for ast::Keyword { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2351,16 +2351,16 @@ impl ToPyo3Ast for crate::Keyword { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((arg.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; + let instance = + Py::::as_ref(&cache.0, py).call1((arg.to_py_ast(py)?, value.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::Alias { +impl ToPyAst for ast::Alias { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2370,15 +2370,15 @@ impl ToPyo3Ast for crate::Alias { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((name.to_pyo3_ast(py)?, asname.to_pyo3_ast(py)?))?; + .call1((name.to_py_ast(py)?, asname.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::Withitem { +impl ToPyAst for ast::Withitem { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2387,18 +2387,16 @@ impl ToPyo3Ast for crate::Withitem { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1(( - context_expr.to_pyo3_ast(py)?, - optional_vars.to_pyo3_ast(py)?, - ))?; + let instance = Py::::as_ref(&cache.0, py) + .call1((context_expr.to_py_ast(py)?, optional_vars.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::MatchCase { +impl ToPyAst for ast::MatchCase { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2409,35 +2407,35 @@ impl ToPyo3Ast for crate::MatchCase { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - pattern.to_pyo3_ast(py)?, - guard.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, + pattern.to_py_ast(py)?, + guard.to_py_ast(py)?, + body.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::generic::Pattern { +impl ToPyAst for ast::Pattern { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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)?, + 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 ToPyo3Ast for crate::PatternMatchValue { +impl ToPyAst for ast::PatternMatchValue { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2445,15 +2443,15 @@ impl ToPyo3Ast for crate::PatternMatchValue { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((value.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::PatternMatchSingleton { +impl ToPyAst for ast::PatternMatchSingleton { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2461,15 +2459,15 @@ impl ToPyo3Ast for crate::PatternMatchSingleton { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_object(py),))?; + let instance = Py::::as_ref(&cache.0, py).call1((constant_to_object(value, py),))?; Ok(instance) } } -impl ToPyo3Ast for crate::PatternMatchSequence { +impl ToPyAst for ast::PatternMatchSequence { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2477,15 +2475,15 @@ impl ToPyo3Ast for crate::PatternMatchSequence { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::PatternMatchMapping { +impl ToPyAst for ast::PatternMatchMapping { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2496,18 +2494,18 @@ impl ToPyo3Ast for crate::PatternMatchMapping { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - keys.to_pyo3_ast(py)?, - patterns.to_pyo3_ast(py)?, - rest.to_pyo3_ast(py)?, + keys.to_py_ast(py)?, + patterns.to_py_ast(py)?, + rest.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::PatternMatchClass { +impl ToPyAst for ast::PatternMatchClass { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2519,19 +2517,19 @@ impl ToPyo3Ast for crate::PatternMatchClass { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - cls.to_pyo3_ast(py)?, - patterns.to_pyo3_ast(py)?, - kwd_attrs.to_pyo3_ast(py)?, - kwd_patterns.to_pyo3_ast(py)?, + 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 ToPyo3Ast for crate::PatternMatchStar { +impl ToPyAst for ast::PatternMatchStar { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2539,15 +2537,15 @@ impl ToPyo3Ast for crate::PatternMatchStar { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((name.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((name.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::PatternMatchAs { +impl ToPyAst for ast::PatternMatchAs { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2557,15 +2555,15 @@ impl ToPyo3Ast for crate::PatternMatchAs { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((pattern.to_pyo3_ast(py)?, name.to_pyo3_ast(py)?))?; + .call1((pattern.to_py_ast(py)?, name.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::PatternMatchOr { +impl ToPyAst for ast::PatternMatchOr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2573,25 +2571,25 @@ impl ToPyo3Ast for crate::PatternMatchOr { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::generic::TypeIgnore { +impl ToPyAst for ast::TypeIgnore { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { - crate::TypeIgnore::TypeIgnore(cons) => cons.to_pyo3_ast(py)?, + ast::TypeIgnore::TypeIgnore(cons) => cons.to_py_ast(py)?, }; Ok(instance) } } -impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { +impl ToPyAst for ast::TypeIgnoreTypeIgnore { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2601,28 +2599,28 @@ impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((lineno.to_u32().to_object(py), tag.to_pyo3_ast(py)?))?; + .call1((lineno.to_u32().to_object(py), tag.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::generic::Mod { +impl ToPyAst for ast::Mod { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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)?, + 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 ToPyo3Ast for crate::ModModule { +impl ToPyAst for ast::ModModule { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2632,15 +2630,15 @@ impl ToPyo3Ast for crate::ModModule { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((body.to_pyo3_ast(py)?, type_ignores.to_pyo3_ast(py)?))?; + .call1((body.to_py_ast(py)?, type_ignores.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::ModInteractive { +impl ToPyAst for ast::ModInteractive { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2648,15 +2646,15 @@ impl ToPyo3Ast for crate::ModInteractive { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((body.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((body.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ModExpression { +impl ToPyAst for ast::ModExpression { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2664,15 +2662,15 @@ impl ToPyo3Ast for crate::ModExpression { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((body.to_pyo3_ast(py)?,))?; + let instance = Py::::as_ref(&cache.0, py).call1((body.to_py_ast(py)?,))?; Ok(instance) } } -impl ToPyo3Ast for crate::ModFunctionType { +impl ToPyAst for ast::ModFunctionType { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2682,51 +2680,51 @@ impl ToPyo3Ast for crate::ModFunctionType { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((argtypes.to_pyo3_ast(py)?, returns.to_pyo3_ast(py)?))?; + .call1((argtypes.to_py_ast(py)?, returns.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::generic::Stmt { +impl ToPyAst for ast::Stmt { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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)?, + 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 ToPyo3Ast for crate::StmtFunctionDef { +impl ToPyAst for ast::StmtFunctionDef { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2740,12 +2738,12 @@ impl ToPyo3Ast for crate::StmtFunctionDef { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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(); @@ -2760,9 +2758,9 @@ impl ToPyo3Ast for crate::StmtFunctionDef { } } -impl ToPyo3Ast for crate::StmtAsyncFunctionDef { +impl ToPyAst for ast::StmtAsyncFunctionDef { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2776,12 +2774,12 @@ impl ToPyo3Ast for crate::StmtAsyncFunctionDef { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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(); @@ -2796,9 +2794,9 @@ impl ToPyo3Ast for crate::StmtAsyncFunctionDef { } } -impl ToPyo3Ast for crate::StmtClassDef { +impl ToPyAst for ast::StmtClassDef { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2811,11 +2809,11 @@ impl ToPyo3Ast for crate::StmtClassDef { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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(); @@ -2830,9 +2828,9 @@ impl ToPyo3Ast for crate::StmtClassDef { } } -impl ToPyo3Ast for crate::StmtReturn { +impl ToPyAst for ast::StmtReturn { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2840,7 +2838,7 @@ impl ToPyo3Ast for crate::StmtReturn { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + 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())?; @@ -2854,9 +2852,9 @@ impl ToPyo3Ast for crate::StmtReturn { } } -impl ToPyo3Ast for crate::StmtDelete { +impl ToPyAst for ast::StmtDelete { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2864,7 +2862,7 @@ impl ToPyo3Ast for crate::StmtDelete { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((targets.to_pyo3_ast(py)?,))?; + 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())?; @@ -2878,9 +2876,9 @@ impl ToPyo3Ast for crate::StmtDelete { } } -impl ToPyo3Ast for crate::StmtAssign { +impl ToPyAst for ast::StmtAssign { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2891,9 +2889,9 @@ impl ToPyo3Ast for crate::StmtAssign { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - targets.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, + targets.to_py_ast(py)?, + value.to_py_ast(py)?, + type_comment.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -2908,9 +2906,9 @@ impl ToPyo3Ast for crate::StmtAssign { } } -impl ToPyo3Ast for crate::StmtAugAssign { +impl ToPyAst for ast::StmtAugAssign { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2921,9 +2919,9 @@ impl ToPyo3Ast for crate::StmtAugAssign { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - target.to_pyo3_ast(py)?, - op.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, + target.to_py_ast(py)?, + op.to_py_ast(py)?, + value.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -2938,9 +2936,9 @@ impl ToPyo3Ast for crate::StmtAugAssign { } } -impl ToPyo3Ast for crate::StmtAnnAssign { +impl ToPyAst for ast::StmtAnnAssign { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2952,10 +2950,10 @@ impl ToPyo3Ast for crate::StmtAnnAssign { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - target.to_pyo3_ast(py)?, - annotation.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - simple.to_pyo3_ast(py)?, + target.to_py_ast(py)?, + annotation.to_py_ast(py)?, + value.to_py_ast(py)?, + simple.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -2970,9 +2968,9 @@ impl ToPyo3Ast for crate::StmtAnnAssign { } } -impl ToPyo3Ast for crate::StmtFor { +impl ToPyAst for ast::StmtFor { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -2985,11 +2983,11 @@ impl ToPyo3Ast for crate::StmtFor { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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(); @@ -3004,9 +3002,9 @@ impl ToPyo3Ast for crate::StmtFor { } } -impl ToPyo3Ast for crate::StmtAsyncFor { +impl ToPyAst for ast::StmtAsyncFor { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3019,11 +3017,11 @@ impl ToPyo3Ast for crate::StmtAsyncFor { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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(); @@ -3038,9 +3036,9 @@ impl ToPyo3Ast for crate::StmtAsyncFor { } } -impl ToPyo3Ast for crate::StmtWhile { +impl ToPyAst for ast::StmtWhile { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3051,9 +3049,9 @@ impl ToPyo3Ast for crate::StmtWhile { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3068,9 +3066,9 @@ impl ToPyo3Ast for crate::StmtWhile { } } -impl ToPyo3Ast for crate::StmtIf { +impl ToPyAst for ast::StmtIf { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3081,9 +3079,9 @@ impl ToPyo3Ast for crate::StmtIf { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3098,9 +3096,9 @@ impl ToPyo3Ast for crate::StmtIf { } } -impl ToPyo3Ast for crate::StmtWith { +impl ToPyAst for ast::StmtWith { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3111,9 +3109,9 @@ impl ToPyo3Ast for crate::StmtWith { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - items.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, + items.to_py_ast(py)?, + body.to_py_ast(py)?, + type_comment.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3128,9 +3126,9 @@ impl ToPyo3Ast for crate::StmtWith { } } -impl ToPyo3Ast for crate::StmtAsyncWith { +impl ToPyAst for ast::StmtAsyncWith { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3141,9 +3139,9 @@ impl ToPyo3Ast for crate::StmtAsyncWith { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - items.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, + items.to_py_ast(py)?, + body.to_py_ast(py)?, + type_comment.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3158,9 +3156,9 @@ impl ToPyo3Ast for crate::StmtAsyncWith { } } -impl ToPyo3Ast for crate::StmtMatch { +impl ToPyAst for ast::StmtMatch { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3170,7 +3168,7 @@ impl ToPyo3Ast for crate::StmtMatch { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((subject.to_pyo3_ast(py)?, cases.to_pyo3_ast(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())?; @@ -3184,9 +3182,9 @@ impl ToPyo3Ast for crate::StmtMatch { } } -impl ToPyo3Ast for crate::StmtRaise { +impl ToPyAst for ast::StmtRaise { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3195,8 +3193,8 @@ impl ToPyo3Ast for crate::StmtRaise { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((exc.to_pyo3_ast(py)?, cause.to_pyo3_ast(py)?))?; + 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())?; @@ -3210,9 +3208,9 @@ impl ToPyo3Ast for crate::StmtRaise { } } -impl ToPyo3Ast for crate::StmtTry { +impl ToPyAst for ast::StmtTry { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3224,10 +3222,10 @@ impl ToPyo3Ast for crate::StmtTry { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - body.to_pyo3_ast(py)?, - handlers.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - finalbody.to_pyo3_ast(py)?, + body.to_py_ast(py)?, + handlers.to_py_ast(py)?, + orelse.to_py_ast(py)?, + finalbody.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3242,9 +3240,9 @@ impl ToPyo3Ast for crate::StmtTry { } } -impl ToPyo3Ast for crate::StmtTryStar { +impl ToPyAst for ast::StmtTryStar { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3256,10 +3254,10 @@ impl ToPyo3Ast for crate::StmtTryStar { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - body.to_pyo3_ast(py)?, - handlers.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, - finalbody.to_pyo3_ast(py)?, + body.to_py_ast(py)?, + handlers.to_py_ast(py)?, + orelse.to_py_ast(py)?, + finalbody.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3274,9 +3272,9 @@ impl ToPyo3Ast for crate::StmtTryStar { } } -impl ToPyo3Ast for crate::StmtAssert { +impl ToPyAst for ast::StmtAssert { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3285,8 +3283,8 @@ impl ToPyo3Ast for crate::StmtAssert { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((test.to_pyo3_ast(py)?, msg.to_pyo3_ast(py)?))?; + 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())?; @@ -3300,9 +3298,9 @@ impl ToPyo3Ast for crate::StmtAssert { } } -impl ToPyo3Ast for crate::StmtImport { +impl ToPyAst for ast::StmtImport { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3310,7 +3308,7 @@ impl ToPyo3Ast for crate::StmtImport { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; + 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())?; @@ -3324,9 +3322,9 @@ impl ToPyo3Ast for crate::StmtImport { } } -impl ToPyo3Ast for crate::StmtImportFrom { +impl ToPyAst for ast::StmtImportFrom { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3337,8 +3335,8 @@ impl ToPyo3Ast for crate::StmtImportFrom { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - module.to_pyo3_ast(py)?, - names.to_pyo3_ast(py)?, + module.to_py_ast(py)?, + names.to_py_ast(py)?, level.map_or_else(|| py.None(), |level| level.to_u32().to_object(py)), ))?; @@ -3354,9 +3352,9 @@ impl ToPyo3Ast for crate::StmtImportFrom { } } -impl ToPyo3Ast for crate::StmtGlobal { +impl ToPyAst for ast::StmtGlobal { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3364,7 +3362,7 @@ impl ToPyo3Ast for crate::StmtGlobal { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; + 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())?; @@ -3378,9 +3376,9 @@ impl ToPyo3Ast for crate::StmtGlobal { } } -impl ToPyo3Ast for crate::StmtNonlocal { +impl ToPyAst for ast::StmtNonlocal { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3388,7 +3386,7 @@ impl ToPyo3Ast for crate::StmtNonlocal { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((names.to_pyo3_ast(py)?,))?; + 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())?; @@ -3402,9 +3400,9 @@ impl ToPyo3Ast for crate::StmtNonlocal { } } -impl ToPyo3Ast for crate::StmtExpr { +impl ToPyAst for ast::StmtExpr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3412,7 +3410,7 @@ impl ToPyo3Ast for crate::StmtExpr { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + 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())?; @@ -3426,9 +3424,9 @@ impl ToPyo3Ast for crate::StmtExpr { } } -impl ToPyo3Ast for crate::StmtPass { +impl ToPyAst for ast::StmtPass { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + 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()?; @@ -3446,9 +3444,9 @@ impl ToPyo3Ast for crate::StmtPass { } } -impl ToPyo3Ast for crate::StmtBreak { +impl ToPyAst for ast::StmtBreak { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + 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()?; @@ -3466,9 +3464,9 @@ impl ToPyo3Ast for crate::StmtBreak { } } -impl ToPyo3Ast for crate::StmtContinue { +impl ToPyAst for ast::StmtContinue { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + 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()?; @@ -3486,45 +3484,45 @@ impl ToPyo3Ast for crate::StmtContinue { } } -impl ToPyo3Ast for crate::generic::Expr { +impl ToPyAst for ast::Expr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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)?, + 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 ToPyo3Ast for crate::ExprBoolOp { +impl ToPyAst for ast::ExprBoolOp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3533,8 +3531,8 @@ impl ToPyo3Ast for crate::ExprBoolOp { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((op.to_pyo3_ast(py)?, values.to_pyo3_ast(py)?))?; + 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())?; @@ -3548,9 +3546,9 @@ impl ToPyo3Ast for crate::ExprBoolOp { } } -impl ToPyo3Ast for crate::ExprNamedExpr { +impl ToPyAst for ast::ExprNamedExpr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3560,7 +3558,7 @@ impl ToPyo3Ast for crate::ExprNamedExpr { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((target.to_pyo3_ast(py)?, value.to_pyo3_ast(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())?; @@ -3574,9 +3572,9 @@ impl ToPyo3Ast for crate::ExprNamedExpr { } } -impl ToPyo3Ast for crate::ExprBinOp { +impl ToPyAst for ast::ExprBinOp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3587,9 +3585,9 @@ impl ToPyo3Ast for crate::ExprBinOp { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - left.to_pyo3_ast(py)?, - op.to_pyo3_ast(py)?, - right.to_pyo3_ast(py)?, + left.to_py_ast(py)?, + op.to_py_ast(py)?, + right.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3604,9 +3602,9 @@ impl ToPyo3Ast for crate::ExprBinOp { } } -impl ToPyo3Ast for crate::ExprUnaryOp { +impl ToPyAst for ast::ExprUnaryOp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3615,8 +3613,8 @@ impl ToPyo3Ast for crate::ExprUnaryOp { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((op.to_pyo3_ast(py)?, operand.to_pyo3_ast(py)?))?; + 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())?; @@ -3630,9 +3628,9 @@ impl ToPyo3Ast for crate::ExprUnaryOp { } } -impl ToPyo3Ast for crate::ExprLambda { +impl ToPyAst for ast::ExprLambda { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3641,8 +3639,8 @@ impl ToPyo3Ast for crate::ExprLambda { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((args.to_pyo3_ast(py)?, body.to_pyo3_ast(py)?))?; + 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())?; @@ -3656,9 +3654,9 @@ impl ToPyo3Ast for crate::ExprLambda { } } -impl ToPyo3Ast for crate::ExprIfExp { +impl ToPyAst for ast::ExprIfExp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3669,9 +3667,9 @@ impl ToPyo3Ast for crate::ExprIfExp { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - test.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, - orelse.to_pyo3_ast(py)?, + test.to_py_ast(py)?, + body.to_py_ast(py)?, + orelse.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3686,9 +3684,9 @@ impl ToPyo3Ast for crate::ExprIfExp { } } -impl ToPyo3Ast for crate::ExprDict { +impl ToPyAst for ast::ExprDict { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3698,7 +3696,7 @@ impl ToPyo3Ast for crate::ExprDict { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((keys.to_pyo3_ast(py)?, values.to_pyo3_ast(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())?; @@ -3712,9 +3710,9 @@ impl ToPyo3Ast for crate::ExprDict { } } -impl ToPyo3Ast for crate::ExprSet { +impl ToPyAst for ast::ExprSet { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3722,7 +3720,7 @@ impl ToPyo3Ast for crate::ExprSet { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((elts.to_pyo3_ast(py)?,))?; + 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())?; @@ -3736,9 +3734,9 @@ impl ToPyo3Ast for crate::ExprSet { } } -impl ToPyo3Ast for crate::ExprListComp { +impl ToPyAst for ast::ExprListComp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3748,7 +3746,7 @@ impl ToPyo3Ast for crate::ExprListComp { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(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())?; @@ -3762,9 +3760,9 @@ impl ToPyo3Ast for crate::ExprListComp { } } -impl ToPyo3Ast for crate::ExprSetComp { +impl ToPyAst for ast::ExprSetComp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3774,7 +3772,7 @@ impl ToPyo3Ast for crate::ExprSetComp { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(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())?; @@ -3788,9 +3786,9 @@ impl ToPyo3Ast for crate::ExprSetComp { } } -impl ToPyo3Ast for crate::ExprDictComp { +impl ToPyAst for ast::ExprDictComp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3801,9 +3799,9 @@ impl ToPyo3Ast for crate::ExprDictComp { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - key.to_pyo3_ast(py)?, - value.to_pyo3_ast(py)?, - generators.to_pyo3_ast(py)?, + key.to_py_ast(py)?, + value.to_py_ast(py)?, + generators.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3818,9 +3816,9 @@ impl ToPyo3Ast for crate::ExprDictComp { } } -impl ToPyo3Ast for crate::ExprGeneratorExp { +impl ToPyAst for ast::ExprGeneratorExp { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3830,7 +3828,7 @@ impl ToPyo3Ast for crate::ExprGeneratorExp { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((elt.to_pyo3_ast(py)?, generators.to_pyo3_ast(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())?; @@ -3844,9 +3842,9 @@ impl ToPyo3Ast for crate::ExprGeneratorExp { } } -impl ToPyo3Ast for crate::ExprAwait { +impl ToPyAst for ast::ExprAwait { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3854,7 +3852,7 @@ impl ToPyo3Ast for crate::ExprAwait { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + 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())?; @@ -3868,9 +3866,9 @@ impl ToPyo3Ast for crate::ExprAwait { } } -impl ToPyo3Ast for crate::ExprYield { +impl ToPyAst for ast::ExprYield { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3878,7 +3876,7 @@ impl ToPyo3Ast for crate::ExprYield { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + 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())?; @@ -3892,9 +3890,9 @@ impl ToPyo3Ast for crate::ExprYield { } } -impl ToPyo3Ast for crate::ExprYieldFrom { +impl ToPyAst for ast::ExprYieldFrom { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3902,7 +3900,7 @@ impl ToPyo3Ast for crate::ExprYieldFrom { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + 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())?; @@ -3916,9 +3914,9 @@ impl ToPyo3Ast for crate::ExprYieldFrom { } } -impl ToPyo3Ast for crate::ExprCompare { +impl ToPyAst for ast::ExprCompare { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3929,9 +3927,9 @@ impl ToPyo3Ast for crate::ExprCompare { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - left.to_pyo3_ast(py)?, - ops.to_pyo3_ast(py)?, - comparators.to_pyo3_ast(py)?, + left.to_py_ast(py)?, + ops.to_py_ast(py)?, + comparators.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3946,9 +3944,9 @@ impl ToPyo3Ast for crate::ExprCompare { } } -impl ToPyo3Ast for crate::ExprCall { +impl ToPyAst for ast::ExprCall { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3959,9 +3957,9 @@ impl ToPyo3Ast for crate::ExprCall { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - func.to_pyo3_ast(py)?, - args.to_pyo3_ast(py)?, - keywords.to_pyo3_ast(py)?, + func.to_py_ast(py)?, + args.to_py_ast(py)?, + keywords.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -3976,9 +3974,9 @@ impl ToPyo3Ast for crate::ExprCall { } } -impl ToPyo3Ast for crate::ExprFormattedValue { +impl ToPyAst for ast::ExprFormattedValue { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -3989,9 +3987,9 @@ impl ToPyo3Ast for crate::ExprFormattedValue { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - value.to_pyo3_ast(py)?, - conversion.to_pyo3_ast(py)?, - format_spec.to_pyo3_ast(py)?, + value.to_py_ast(py)?, + conversion.to_py_ast(py)?, + format_spec.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -4006,9 +4004,9 @@ impl ToPyo3Ast for crate::ExprFormattedValue { } } -impl ToPyo3Ast for crate::ExprJoinedStr { +impl ToPyAst for ast::ExprJoinedStr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4016,7 +4014,7 @@ impl ToPyo3Ast for crate::ExprJoinedStr { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((values.to_pyo3_ast(py)?,))?; + 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())?; @@ -4030,9 +4028,9 @@ impl ToPyo3Ast for crate::ExprJoinedStr { } } -impl ToPyo3Ast for crate::ExprConstant { +impl ToPyAst for ast::ExprConstant { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4042,7 +4040,7 @@ impl ToPyo3Ast for crate::ExprConstant { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((value.to_object(py), kind.to_pyo3_ast(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())?; @@ -4056,9 +4054,9 @@ impl ToPyo3Ast for crate::ExprConstant { } } -impl ToPyo3Ast for crate::ExprAttribute { +impl ToPyAst for ast::ExprAttribute { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4069,9 +4067,9 @@ impl ToPyo3Ast for crate::ExprAttribute { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - value.to_pyo3_ast(py)?, - attr.to_pyo3_ast(py)?, - ctx.to_pyo3_ast(py)?, + value.to_py_ast(py)?, + attr.to_py_ast(py)?, + ctx.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -4086,9 +4084,9 @@ impl ToPyo3Ast for crate::ExprAttribute { } } -impl ToPyo3Ast for crate::ExprSubscript { +impl ToPyAst for ast::ExprSubscript { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4099,9 +4097,9 @@ impl ToPyo3Ast for crate::ExprSubscript { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - value.to_pyo3_ast(py)?, - slice.to_pyo3_ast(py)?, - ctx.to_pyo3_ast(py)?, + value.to_py_ast(py)?, + slice.to_py_ast(py)?, + ctx.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -4116,9 +4114,9 @@ impl ToPyo3Ast for crate::ExprSubscript { } } -impl ToPyo3Ast for crate::ExprStarred { +impl ToPyAst for ast::ExprStarred { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4127,8 +4125,8 @@ impl ToPyo3Ast for crate::ExprStarred { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((value.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + 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())?; @@ -4142,9 +4140,9 @@ impl ToPyo3Ast for crate::ExprStarred { } } -impl ToPyo3Ast for crate::ExprName { +impl ToPyAst for ast::ExprName { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4154,7 +4152,7 @@ impl ToPyo3Ast for crate::ExprName { } = self; let instance = - Py::::as_ref(&cache.0, py).call1((id.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + 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())?; @@ -4168,9 +4166,9 @@ impl ToPyo3Ast for crate::ExprName { } } -impl ToPyo3Ast for crate::ExprList { +impl ToPyAst for ast::ExprList { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4179,8 +4177,8 @@ impl ToPyo3Ast for crate::ExprList { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + 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())?; @@ -4194,9 +4192,9 @@ impl ToPyo3Ast for crate::ExprList { } } -impl ToPyo3Ast for crate::ExprTuple { +impl ToPyAst for ast::ExprTuple { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4205,8 +4203,8 @@ impl ToPyo3Ast for crate::ExprTuple { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((elts.to_pyo3_ast(py)?, ctx.to_pyo3_ast(py)?))?; + 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())?; @@ -4220,9 +4218,9 @@ impl ToPyo3Ast for crate::ExprTuple { } } -impl ToPyo3Ast for crate::ExprSlice { +impl ToPyAst for ast::ExprSlice { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4233,9 +4231,9 @@ impl ToPyo3Ast for crate::ExprSlice { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - lower.to_pyo3_ast(py)?, - upper.to_pyo3_ast(py)?, - step.to_pyo3_ast(py)?, + lower.to_py_ast(py)?, + upper.to_py_ast(py)?, + step.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -4250,9 +4248,9 @@ impl ToPyo3Ast for crate::ExprSlice { } } -impl ToPyo3Ast for crate::Comprehension { +impl ToPyAst for ast::Comprehension { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4264,29 +4262,29 @@ impl ToPyo3Ast for crate::Comprehension { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - target.to_pyo3_ast(py)?, - iter.to_pyo3_ast(py)?, - ifs.to_pyo3_ast(py)?, - is_async.to_pyo3_ast(py)?, + target.to_py_ast(py)?, + iter.to_py_ast(py)?, + ifs.to_py_ast(py)?, + is_async.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::generic::Excepthandler { +impl ToPyAst for ast::Excepthandler { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { - crate::Excepthandler::ExceptHandler(cons) => cons.to_pyo3_ast(py)?, + ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?, }; Ok(instance) } } -impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { +impl ToPyAst for ast::ExcepthandlerExceptHandler { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4297,9 +4295,9 @@ impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - type_.to_pyo3_ast(py)?, - name.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, + type_.to_py_ast(py)?, + name.to_py_ast(py)?, + body.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -4314,9 +4312,9 @@ impl ToPyo3Ast for crate::ExcepthandlerExceptHandler { } } -impl ToPyo3Ast for crate::Arguments { +impl ToPyAst for ast::Arguments { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4331,22 +4329,22 @@ impl ToPyo3Ast for crate::Arguments { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - 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)?, + 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 ToPyo3Ast for crate::Arg { +impl ToPyAst for ast::Arg { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4357,9 +4355,9 @@ impl ToPyo3Ast for crate::Arg { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - arg.to_pyo3_ast(py)?, - annotation.to_pyo3_ast(py)?, - type_comment.to_pyo3_ast(py)?, + arg.to_py_ast(py)?, + annotation.to_py_ast(py)?, + type_comment.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -4374,9 +4372,9 @@ impl ToPyo3Ast for crate::Arg { } } -impl ToPyo3Ast for crate::Keyword { +impl ToPyAst for ast::Keyword { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4385,8 +4383,8 @@ impl ToPyo3Ast for crate::Keyword { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py) - .call1((arg.to_pyo3_ast(py)?, value.to_pyo3_ast(py)?))?; + 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())?; @@ -4400,9 +4398,9 @@ impl ToPyo3Ast for crate::Keyword { } } -impl ToPyo3Ast for crate::Alias { +impl ToPyAst for ast::Alias { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4412,7 +4410,7 @@ impl ToPyo3Ast for crate::Alias { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((name.to_pyo3_ast(py)?, asname.to_pyo3_ast(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())?; @@ -4426,9 +4424,9 @@ impl ToPyo3Ast for crate::Alias { } } -impl ToPyo3Ast for crate::Withitem { +impl ToPyAst for ast::Withitem { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4437,18 +4435,16 @@ impl ToPyo3Ast for crate::Withitem { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1(( - context_expr.to_pyo3_ast(py)?, - optional_vars.to_pyo3_ast(py)?, - ))?; + let instance = Py::::as_ref(&cache.0, py) + .call1((context_expr.to_py_ast(py)?, optional_vars.to_py_ast(py)?))?; Ok(instance) } } -impl ToPyo3Ast for crate::MatchCase { +impl ToPyAst for ast::MatchCase { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4459,35 +4455,35 @@ impl ToPyo3Ast for crate::MatchCase { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - pattern.to_pyo3_ast(py)?, - guard.to_pyo3_ast(py)?, - body.to_pyo3_ast(py)?, + pattern.to_py_ast(py)?, + guard.to_py_ast(py)?, + body.to_py_ast(py)?, ))?; Ok(instance) } } -impl ToPyo3Ast for crate::generic::Pattern { +impl ToPyAst for ast::Pattern { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { 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)?, + 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 ToPyo3Ast for crate::PatternMatchValue { +impl ToPyAst for ast::PatternMatchValue { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4495,7 +4491,7 @@ impl ToPyo3Ast for crate::PatternMatchValue { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_pyo3_ast(py)?,))?; + 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())?; @@ -4509,9 +4505,9 @@ impl ToPyo3Ast for crate::PatternMatchValue { } } -impl ToPyo3Ast for crate::PatternMatchSingleton { +impl ToPyAst for ast::PatternMatchSingleton { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4519,7 +4515,7 @@ impl ToPyo3Ast for crate::PatternMatchSingleton { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((value.to_object(py),))?; + 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())?; @@ -4533,9 +4529,9 @@ impl ToPyo3Ast for crate::PatternMatchSingleton { } } -impl ToPyo3Ast for crate::PatternMatchSequence { +impl ToPyAst for ast::PatternMatchSequence { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4543,7 +4539,7 @@ impl ToPyo3Ast for crate::PatternMatchSequence { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_pyo3_ast(py)?,))?; + 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())?; @@ -4557,9 +4553,9 @@ impl ToPyo3Ast for crate::PatternMatchSequence { } } -impl ToPyo3Ast for crate::PatternMatchMapping { +impl ToPyAst for ast::PatternMatchMapping { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4570,9 +4566,9 @@ impl ToPyo3Ast for crate::PatternMatchMapping { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - keys.to_pyo3_ast(py)?, - patterns.to_pyo3_ast(py)?, - rest.to_pyo3_ast(py)?, + keys.to_py_ast(py)?, + patterns.to_py_ast(py)?, + rest.to_py_ast(py)?, ))?; let cache = ast_cache(); @@ -4587,9 +4583,9 @@ impl ToPyo3Ast for crate::PatternMatchMapping { } } -impl ToPyo3Ast for crate::PatternMatchClass { +impl ToPyAst for ast::PatternMatchClass { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4601,10 +4597,10 @@ impl ToPyo3Ast for crate::PatternMatchClass { } = self; let instance = Py::::as_ref(&cache.0, py).call1(( - cls.to_pyo3_ast(py)?, - patterns.to_pyo3_ast(py)?, - kwd_attrs.to_pyo3_ast(py)?, - kwd_patterns.to_pyo3_ast(py)?, + 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(); @@ -4619,9 +4615,9 @@ impl ToPyo3Ast for crate::PatternMatchClass { } } -impl ToPyo3Ast for crate::PatternMatchStar { +impl ToPyAst for ast::PatternMatchStar { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4629,7 +4625,7 @@ impl ToPyo3Ast for crate::PatternMatchStar { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((name.to_pyo3_ast(py)?,))?; + 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())?; @@ -4643,9 +4639,9 @@ impl ToPyo3Ast for crate::PatternMatchStar { } } -impl ToPyo3Ast for crate::PatternMatchAs { +impl ToPyAst for ast::PatternMatchAs { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4655,7 +4651,7 @@ impl ToPyo3Ast for crate::PatternMatchAs { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((pattern.to_pyo3_ast(py)?, name.to_pyo3_ast(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())?; @@ -4669,9 +4665,9 @@ impl ToPyo3Ast for crate::PatternMatchAs { } } -impl ToPyo3Ast for crate::PatternMatchOr { +impl ToPyAst for ast::PatternMatchOr { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4679,7 +4675,7 @@ impl ToPyo3Ast for crate::PatternMatchOr { range: _range, } = self; - let instance = Py::::as_ref(&cache.0, py).call1((patterns.to_pyo3_ast(py)?,))?; + 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())?; @@ -4693,19 +4689,19 @@ impl ToPyo3Ast for crate::PatternMatchOr { } } -impl ToPyo3Ast for crate::generic::TypeIgnore { +impl ToPyAst for ast::TypeIgnore { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { - crate::TypeIgnore::TypeIgnore(cons) => cons.to_pyo3_ast(py)?, + ast::TypeIgnore::TypeIgnore(cons) => cons.to_py_ast(py)?, }; Ok(instance) } } -impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { +impl ToPyAst for ast::TypeIgnoreTypeIgnore { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); let Self { @@ -4715,7 +4711,7 @@ impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { } = self; let instance = Py::::as_ref(&cache.0, py) - .call1((lineno.to_u32().to_object(py), tag.to_pyo3_ast(py)?))?; + .call1((lineno.to_u32().to_object(py), tag.to_py_ast(py)?))?; Ok(instance) } @@ -4723,123 +4719,123 @@ impl ToPyo3Ast for crate::TypeIgnoreTypeIgnore { 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)?; + 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/src/pyo3.rs b/ast-pyo3/src/py_ast.rs similarity index 53% rename from ast/src/pyo3.rs rename to ast-pyo3/src/py_ast.rs index 928b5371..e53e7b2a 100644 --- a/ast/src/pyo3.rs +++ b/ast-pyo3/src/py_ast.rs @@ -1,4 +1,3 @@ -use crate::{source_code::SourceRange, text_size::TextRange, ConversionFlag, Node}; use num_complex::Complex64; use once_cell::sync::OnceCell; use pyo3::{ @@ -6,8 +5,11 @@ use pyo3::{ types::{PyBool, PyBytes, PyList, PyString, PyTuple}, ToPyObject, }; +use rustpython_ast::{ + self as ast, source_code::SourceRange, text_size::TextRange, ConversionFlag, Node, +}; -pub trait Pyo3Node { +pub trait PyNode { fn py_type_cache() -> &'static OnceCell<(Py, Py)> { { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -16,120 +18,96 @@ pub trait Pyo3Node { } } -pub trait ToPyo3Ast { - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>; +pub trait ToPyAst { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>; } -impl ToPyo3Ast for Box { +impl ToPyAst for Box { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { - (**self).to_pyo3_ast(py) + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + (**self).to_py_ast(py) } } -impl ToPyo3Ast for Option { +impl ToPyAst for Option { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { match self { - Some(ast) => ast.to_pyo3_ast(py), + Some(ast) => ast.to_py_ast(py), None => Ok(ast_cache().none_ref(py)), } } } -impl ToPyo3Ast for Vec { - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { +impl ToPyAst for Vec { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let elts = self .iter() - .map(|item| item.to_pyo3_ast(py)) + .map(|item| item.to_py_ast(py)) .collect::, _>>()?; let list = PyList::new(py, elts); Ok(list.into()) } } -impl ToPyo3Ast for crate::Identifier { +impl ToPyAst for ast::Identifier { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { Ok(PyString::new(py, self.as_str()).into()) } } -impl ToPyo3Ast for crate::String { +impl ToPyAst for ast::String { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { Ok(PyString::new(py, self.as_str()).into()) } } -impl ToPyo3Ast for bool { +impl ToPyAst for bool { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { Ok(ast_cache().bool_int(py, *self)) } } -impl ToPyo3Ast for ConversionFlag { +impl ToPyAst for ConversionFlag { #[inline] - fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { Ok(ast_cache().conversion_flag(py, *self)) } } -impl ToPyObject for crate::Constant { - fn to_object(&self, py: Python) -> PyObject { - let cache = ast_cache(); - match self { - crate::Constant::None => cache.none.clone_ref(py), - crate::Constant::Bool(bool) => cache.bool(py, *bool).into(), - 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: Vec<_> = elts.iter().map(|c| c.to_object(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(), +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(), } } -// impl ToPyo3Ast for crate::Constant { -// #[inline] -// fn to_pyo3_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { -// let cache = ast_cache(); -// let value = match self { -// crate::Constant::None => cache.none_ref(py), -// crate::Constant::Bool(bool) => cache.bool_ref(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; +pub struct Ast; #[pymethods] -impl AST { +impl Ast { #[new] fn new() -> Self { Self } } -fn cache_py_type(ast_module: &PyAny) -> PyResult<()> { +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()? @@ -209,4 +187,4 @@ pub fn init(py: Python) -> PyResult<()> { init_types(py) } -include!("gen/to_pyo3.rs"); +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 c61a553e..9fc36393 100755 --- a/ast/asdl_rs.py +++ b/ast/asdl_rs.py @@ -1102,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<'py>(&self, {"_" if simple else ""}py: Python<'py>) -> PyResult<&'py PyAny> {{ + 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( @@ -1135,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<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {{ + fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {{ let cache = Self::py_type_cache().get().unwrap(); """, 0, @@ -1159,7 +1159,7 @@ def emit_to_pyo3_with_fields(self, cons, type, name): for field in cons.fields: if field.type == "constant": self.emit( - f"{rust_field(field.name)}.to_object(py),", + f"constant_to_object({rust_field(field.name)}, py),", 3, ) continue @@ -1183,7 +1183,7 @@ def emit_to_pyo3_with_fields(self, cons, type, name): ) continue self.emit( - f"{rust_field(field.name)}.to_pyo3_ast(py)?,", + f"{rust_field(field.name)}.to_py_ast(py)?,", 3, ) self.emit( @@ -1252,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 = "" @@ -1264,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( @@ -1273,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} }} }} @@ -1288,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) }} @@ -1303,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 = "" @@ -1311,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) @@ -1339,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, @@ -1365,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, ) @@ -1383,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)) }} }} @@ -1409,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( """ @@ -1447,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) @@ -1496,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): @@ -1846,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(); @@ -1876,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}") @@ -1890,15 +1888,15 @@ 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<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {{ + 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( """ @@ -1921,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 {{ """, ) @@ -1942,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)) }} }} @@ -1983,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, ): @@ -2005,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) @@ -2024,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") @@ -2031,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/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_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