Rename unconventional nodes (#74)

This commit is contained in:
Jeong, YunWon 2023-06-17 01:54:00 +09:00 committed by GitHub
parent 5270020423
commit 69d27d924c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 2407 additions and 2302 deletions

View file

@ -520,7 +520,7 @@ impl PyNode for ast::ExprContextDel {
}
}
impl PyNode for ast::Boolop {
impl PyNode for ast::BoolOp {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -528,7 +528,7 @@ impl PyNode for ast::Boolop {
}
}
impl PyNode for ast::BoolopAnd {
impl PyNode for ast::BoolOpAnd {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -536,7 +536,7 @@ impl PyNode for ast::BoolopAnd {
}
}
impl PyNode for ast::BoolopOr {
impl PyNode for ast::BoolOpOr {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -656,7 +656,7 @@ impl PyNode for ast::OperatorFloorDiv {
}
}
impl PyNode for ast::Unaryop {
impl PyNode for ast::UnaryOp {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -664,7 +664,7 @@ impl PyNode for ast::Unaryop {
}
}
impl PyNode for ast::UnaryopInvert {
impl PyNode for ast::UnaryOpInvert {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -672,7 +672,7 @@ impl PyNode for ast::UnaryopInvert {
}
}
impl PyNode for ast::UnaryopNot {
impl PyNode for ast::UnaryOpNot {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -680,7 +680,7 @@ impl PyNode for ast::UnaryopNot {
}
}
impl PyNode for ast::UnaryopUAdd {
impl PyNode for ast::UnaryOpUAdd {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -688,7 +688,7 @@ impl PyNode for ast::UnaryopUAdd {
}
}
impl PyNode for ast::UnaryopUSub {
impl PyNode for ast::UnaryOpUSub {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -696,7 +696,7 @@ impl PyNode for ast::UnaryopUSub {
}
}
impl PyNode for ast::Cmpop {
impl PyNode for ast::CmpOp {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -704,7 +704,7 @@ impl PyNode for ast::Cmpop {
}
}
impl PyNode for ast::CmpopEq {
impl PyNode for ast::CmpOpEq {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -712,7 +712,7 @@ impl PyNode for ast::CmpopEq {
}
}
impl PyNode for ast::CmpopNotEq {
impl PyNode for ast::CmpOpNotEq {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -720,7 +720,7 @@ impl PyNode for ast::CmpopNotEq {
}
}
impl PyNode for ast::CmpopLt {
impl PyNode for ast::CmpOpLt {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -728,7 +728,7 @@ impl PyNode for ast::CmpopLt {
}
}
impl PyNode for ast::CmpopLtE {
impl PyNode for ast::CmpOpLtE {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -736,7 +736,7 @@ impl PyNode for ast::CmpopLtE {
}
}
impl PyNode for ast::CmpopGt {
impl PyNode for ast::CmpOpGt {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -744,7 +744,7 @@ impl PyNode for ast::CmpopGt {
}
}
impl PyNode for ast::CmpopGtE {
impl PyNode for ast::CmpOpGtE {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -752,7 +752,7 @@ impl PyNode for ast::CmpopGtE {
}
}
impl PyNode for ast::CmpopIs {
impl PyNode for ast::CmpOpIs {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -760,7 +760,7 @@ impl PyNode for ast::CmpopIs {
}
}
impl PyNode for ast::CmpopIsNot {
impl PyNode for ast::CmpOpIsNot {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -768,7 +768,7 @@ impl PyNode for ast::CmpopIsNot {
}
}
impl PyNode for ast::CmpopIn {
impl PyNode for ast::CmpOpIn {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -776,7 +776,7 @@ impl PyNode for ast::CmpopIn {
}
}
impl PyNode for ast::CmpopNotIn {
impl PyNode for ast::CmpOpNotIn {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -792,7 +792,7 @@ impl<R> PyNode for ast::Comprehension<R> {
}
}
impl<R> PyNode for ast::Excepthandler<R> {
impl<R> PyNode for ast::ExceptHandler<R> {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -800,7 +800,7 @@ impl<R> PyNode for ast::Excepthandler<R> {
}
}
impl<R> PyNode for ast::ExcepthandlerExceptHandler<R> {
impl<R> PyNode for ast::ExceptHandlerExceptHandler<R> {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -840,7 +840,7 @@ impl<R> PyNode for ast::Alias<R> {
}
}
impl<R> PyNode for ast::Withitem<R> {
impl<R> PyNode for ast::WithItem<R> {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@ -956,12 +956,12 @@ impl ToPyAst for ast::ExprContext {
}
}
impl ToPyAst for ast::Boolop {
impl ToPyAst for ast::BoolOp {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cell = match &self {
ast::Boolop::And => ast::BoolopAnd::py_type_cache(),
ast::Boolop::Or => ast::BoolopOr::py_type_cache(),
ast::BoolOp::And => ast::BoolOpAnd::py_type_cache(),
ast::BoolOp::Or => ast::BoolOpOr::py_type_cache(),
};
Ok(Py::<PyAny>::as_ref(&cell.get().unwrap().1, py))
}
@ -989,33 +989,33 @@ impl ToPyAst for ast::Operator {
}
}
impl ToPyAst for ast::Unaryop {
impl ToPyAst for ast::UnaryOp {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cell = match &self {
ast::Unaryop::Invert => ast::UnaryopInvert::py_type_cache(),
ast::Unaryop::Not => ast::UnaryopNot::py_type_cache(),
ast::Unaryop::UAdd => ast::UnaryopUAdd::py_type_cache(),
ast::Unaryop::USub => ast::UnaryopUSub::py_type_cache(),
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::<PyAny>::as_ref(&cell.get().unwrap().1, py))
}
}
impl ToPyAst for ast::Cmpop {
impl ToPyAst for ast::CmpOp {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cell = match &self {
ast::Cmpop::Eq => ast::CmpopEq::py_type_cache(),
ast::Cmpop::NotEq => ast::CmpopNotEq::py_type_cache(),
ast::Cmpop::Lt => ast::CmpopLt::py_type_cache(),
ast::Cmpop::LtE => ast::CmpopLtE::py_type_cache(),
ast::Cmpop::Gt => ast::CmpopGt::py_type_cache(),
ast::Cmpop::GtE => ast::CmpopGtE::py_type_cache(),
ast::Cmpop::Is => ast::CmpopIs::py_type_cache(),
ast::Cmpop::IsNot => ast::CmpopIsNot::py_type_cache(),
ast::Cmpop::In => ast::CmpopIn::py_type_cache(),
ast::Cmpop::NotIn => ast::CmpopNotIn::py_type_cache(),
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::<PyAny>::as_ref(&cell.get().unwrap().1, py))
}
@ -2256,17 +2256,17 @@ impl ToPyAst for ast::Comprehension<TextRange> {
}
}
impl ToPyAst for ast::Excepthandler<TextRange> {
impl ToPyAst for ast::ExceptHandler<TextRange> {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let instance = match &self {
ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?,
ast::ExceptHandler::ExceptHandler(cons) => cons.to_py_ast(py)?,
};
Ok(instance)
}
}
impl ToPyAst for ast::ExcepthandlerExceptHandler<TextRange> {
impl ToPyAst for ast::ExceptHandlerExceptHandler<TextRange> {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cache = Self::py_type_cache().get().unwrap();
@ -2376,7 +2376,7 @@ impl ToPyAst for ast::Alias<TextRange> {
}
}
impl ToPyAst for ast::Withitem<TextRange> {
impl ToPyAst for ast::WithItem<TextRange> {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cache = Self::py_type_cache().get().unwrap();
@ -4272,17 +4272,17 @@ impl ToPyAst for ast::Comprehension<SourceRange> {
}
}
impl ToPyAst for ast::Excepthandler<SourceRange> {
impl ToPyAst for ast::ExceptHandler<SourceRange> {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let instance = match &self {
ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?,
ast::ExceptHandler::ExceptHandler(cons) => cons.to_py_ast(py)?,
};
Ok(instance)
}
}
impl ToPyAst for ast::ExcepthandlerExceptHandler<SourceRange> {
impl ToPyAst for ast::ExceptHandlerExceptHandler<SourceRange> {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cache = Self::py_type_cache().get().unwrap();
@ -4424,7 +4424,7 @@ impl ToPyAst for ast::Alias<SourceRange> {
}
}
impl ToPyAst for ast::Withitem<SourceRange> {
impl ToPyAst for ast::WithItem<SourceRange> {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cache = Self::py_type_cache().get().unwrap();
@ -4784,9 +4784,9 @@ fn init_types(py: Python) -> PyResult<()> {
cache_py_type::<ast::ExprContextLoad>(ast_module)?;
cache_py_type::<ast::ExprContextStore>(ast_module)?;
cache_py_type::<ast::ExprContextDel>(ast_module)?;
cache_py_type::<ast::Boolop>(ast_module)?;
cache_py_type::<ast::BoolopAnd>(ast_module)?;
cache_py_type::<ast::BoolopOr>(ast_module)?;
cache_py_type::<ast::BoolOp>(ast_module)?;
cache_py_type::<ast::BoolOpAnd>(ast_module)?;
cache_py_type::<ast::BoolOpOr>(ast_module)?;
cache_py_type::<ast::Operator>(ast_module)?;
cache_py_type::<ast::OperatorAdd>(ast_module)?;
cache_py_type::<ast::OperatorSub>(ast_module)?;
@ -4801,30 +4801,30 @@ fn init_types(py: Python) -> PyResult<()> {
cache_py_type::<ast::OperatorBitXor>(ast_module)?;
cache_py_type::<ast::OperatorBitAnd>(ast_module)?;
cache_py_type::<ast::OperatorFloorDiv>(ast_module)?;
cache_py_type::<ast::Unaryop>(ast_module)?;
cache_py_type::<ast::UnaryopInvert>(ast_module)?;
cache_py_type::<ast::UnaryopNot>(ast_module)?;
cache_py_type::<ast::UnaryopUAdd>(ast_module)?;
cache_py_type::<ast::UnaryopUSub>(ast_module)?;
cache_py_type::<ast::Cmpop>(ast_module)?;
cache_py_type::<ast::CmpopEq>(ast_module)?;
cache_py_type::<ast::CmpopNotEq>(ast_module)?;
cache_py_type::<ast::CmpopLt>(ast_module)?;
cache_py_type::<ast::CmpopLtE>(ast_module)?;
cache_py_type::<ast::CmpopGt>(ast_module)?;
cache_py_type::<ast::CmpopGtE>(ast_module)?;
cache_py_type::<ast::CmpopIs>(ast_module)?;
cache_py_type::<ast::CmpopIsNot>(ast_module)?;
cache_py_type::<ast::CmpopIn>(ast_module)?;
cache_py_type::<ast::CmpopNotIn>(ast_module)?;
cache_py_type::<ast::UnaryOp>(ast_module)?;
cache_py_type::<ast::UnaryOpInvert>(ast_module)?;
cache_py_type::<ast::UnaryOpNot>(ast_module)?;
cache_py_type::<ast::UnaryOpUAdd>(ast_module)?;
cache_py_type::<ast::UnaryOpUSub>(ast_module)?;
cache_py_type::<ast::CmpOp>(ast_module)?;
cache_py_type::<ast::CmpOpEq>(ast_module)?;
cache_py_type::<ast::CmpOpNotEq>(ast_module)?;
cache_py_type::<ast::CmpOpLt>(ast_module)?;
cache_py_type::<ast::CmpOpLtE>(ast_module)?;
cache_py_type::<ast::CmpOpGt>(ast_module)?;
cache_py_type::<ast::CmpOpGtE>(ast_module)?;
cache_py_type::<ast::CmpOpIs>(ast_module)?;
cache_py_type::<ast::CmpOpIsNot>(ast_module)?;
cache_py_type::<ast::CmpOpIn>(ast_module)?;
cache_py_type::<ast::CmpOpNotIn>(ast_module)?;
cache_py_type::<ast::Comprehension>(ast_module)?;
cache_py_type::<ast::Excepthandler>(ast_module)?;
cache_py_type::<ast::ExcepthandlerExceptHandler>(ast_module)?;
cache_py_type::<ast::ExceptHandler>(ast_module)?;
cache_py_type::<ast::ExceptHandlerExceptHandler>(ast_module)?;
cache_py_type::<ast::PythonArguments>(ast_module)?;
cache_py_type::<ast::Arg>(ast_module)?;
cache_py_type::<ast::Keyword>(ast_module)?;
cache_py_type::<ast::Alias>(ast_module)?;
cache_py_type::<ast::Withitem>(ast_module)?;
cache_py_type::<ast::WithItem>(ast_module)?;
cache_py_type::<ast::MatchCase>(ast_module)?;
cache_py_type::<ast::Pattern>(ast_module)?;
cache_py_type::<ast::PatternMatchValue>(ast_module)?;

View file

@ -2714,47 +2714,47 @@ impl ToPyObject for ExprContextDel {
#[pyclass(module="rustpython_ast.located", name="_boolop", extends=super::Ast, frozen, subclass)]
#[derive(Clone, Debug)]
pub struct Boolop;
pub struct BoolOp;
impl From<&'static ast::Boolop> for Boolop {
fn from(_node: &'static ast::Boolop) -> Self {
Boolop
impl From<&'static ast::BoolOp> for BoolOp {
fn from(_node: &'static ast::BoolOp) -> Self {
BoolOp
}
}
#[pymethods]
impl Boolop {
impl BoolOp {
#[new]
fn new() -> PyClassInitializer<Self> {
PyClassInitializer::from(Ast).add_subclass(Self)
}
}
impl ToPyObject for Boolop {
impl ToPyObject for BoolOp {
fn to_object(&self, py: Python) -> PyObject {
let initializer = Self::new();
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_And", extends=Boolop)]
pub struct BoolopAnd;
#[pyclass(module="rustpython_ast.located", name="_And", extends=BoolOp)]
pub struct BoolOpAnd;
impl ToPyObject for BoolopAnd {
impl ToPyObject for BoolOpAnd {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Boolop)
.add_subclass(BoolOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_Or", extends=Boolop)]
pub struct BoolopOr;
#[pyclass(module="rustpython_ast.located", name="_Or", extends=BoolOp)]
pub struct BoolOpOr;
impl ToPyObject for BoolopOr {
impl ToPyObject for BoolOpOr {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Boolop)
.add_subclass(BoolOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
@ -2942,71 +2942,71 @@ impl ToPyObject for OperatorFloorDiv {
#[pyclass(module="rustpython_ast.located", name="_unaryop", extends=super::Ast, frozen, subclass)]
#[derive(Clone, Debug)]
pub struct Unaryop;
pub struct UnaryOp;
impl From<&'static ast::Unaryop> for Unaryop {
fn from(_node: &'static ast::Unaryop) -> Self {
Unaryop
impl From<&'static ast::UnaryOp> for UnaryOp {
fn from(_node: &'static ast::UnaryOp) -> Self {
UnaryOp
}
}
#[pymethods]
impl Unaryop {
impl UnaryOp {
#[new]
fn new() -> PyClassInitializer<Self> {
PyClassInitializer::from(Ast).add_subclass(Self)
}
}
impl ToPyObject for Unaryop {
impl ToPyObject for UnaryOp {
fn to_object(&self, py: Python) -> PyObject {
let initializer = Self::new();
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_Invert", extends=Unaryop)]
pub struct UnaryopInvert;
#[pyclass(module="rustpython_ast.located", name="_Invert", extends=UnaryOp)]
pub struct UnaryOpInvert;
impl ToPyObject for UnaryopInvert {
impl ToPyObject for UnaryOpInvert {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Unaryop)
.add_subclass(UnaryOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_Not", extends=Unaryop)]
pub struct UnaryopNot;
#[pyclass(module="rustpython_ast.located", name="_Not", extends=UnaryOp)]
pub struct UnaryOpNot;
impl ToPyObject for UnaryopNot {
impl ToPyObject for UnaryOpNot {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Unaryop)
.add_subclass(UnaryOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_UAdd", extends=Unaryop)]
pub struct UnaryopUAdd;
#[pyclass(module="rustpython_ast.located", name="_UAdd", extends=UnaryOp)]
pub struct UnaryOpUAdd;
impl ToPyObject for UnaryopUAdd {
impl ToPyObject for UnaryOpUAdd {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Unaryop)
.add_subclass(UnaryOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_USub", extends=Unaryop)]
pub struct UnaryopUSub;
#[pyclass(module="rustpython_ast.located", name="_USub", extends=UnaryOp)]
pub struct UnaryOpUSub;
impl ToPyObject for UnaryopUSub {
impl ToPyObject for UnaryOpUSub {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Unaryop)
.add_subclass(UnaryOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
@ -3014,143 +3014,143 @@ impl ToPyObject for UnaryopUSub {
#[pyclass(module="rustpython_ast.located", name="_cmpop", extends=super::Ast, frozen, subclass)]
#[derive(Clone, Debug)]
pub struct Cmpop;
pub struct CmpOp;
impl From<&'static ast::Cmpop> for Cmpop {
fn from(_node: &'static ast::Cmpop) -> Self {
Cmpop
impl From<&'static ast::CmpOp> for CmpOp {
fn from(_node: &'static ast::CmpOp) -> Self {
CmpOp
}
}
#[pymethods]
impl Cmpop {
impl CmpOp {
#[new]
fn new() -> PyClassInitializer<Self> {
PyClassInitializer::from(Ast).add_subclass(Self)
}
}
impl ToPyObject for Cmpop {
impl ToPyObject for CmpOp {
fn to_object(&self, py: Python) -> PyObject {
let initializer = Self::new();
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_Eq", extends=Cmpop)]
pub struct CmpopEq;
#[pyclass(module="rustpython_ast.located", name="_Eq", extends=CmpOp)]
pub struct CmpOpEq;
impl ToPyObject for CmpopEq {
impl ToPyObject for CmpOpEq {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_NotEq", extends=Cmpop)]
pub struct CmpopNotEq;
#[pyclass(module="rustpython_ast.located", name="_NotEq", extends=CmpOp)]
pub struct CmpOpNotEq;
impl ToPyObject for CmpopNotEq {
impl ToPyObject for CmpOpNotEq {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_Lt", extends=Cmpop)]
pub struct CmpopLt;
#[pyclass(module="rustpython_ast.located", name="_Lt", extends=CmpOp)]
pub struct CmpOpLt;
impl ToPyObject for CmpopLt {
impl ToPyObject for CmpOpLt {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_LtE", extends=Cmpop)]
pub struct CmpopLtE;
#[pyclass(module="rustpython_ast.located", name="_LtE", extends=CmpOp)]
pub struct CmpOpLtE;
impl ToPyObject for CmpopLtE {
impl ToPyObject for CmpOpLtE {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_Gt", extends=Cmpop)]
pub struct CmpopGt;
#[pyclass(module="rustpython_ast.located", name="_Gt", extends=CmpOp)]
pub struct CmpOpGt;
impl ToPyObject for CmpopGt {
impl ToPyObject for CmpOpGt {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_GtE", extends=Cmpop)]
pub struct CmpopGtE;
#[pyclass(module="rustpython_ast.located", name="_GtE", extends=CmpOp)]
pub struct CmpOpGtE;
impl ToPyObject for CmpopGtE {
impl ToPyObject for CmpOpGtE {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_Is", extends=Cmpop)]
pub struct CmpopIs;
#[pyclass(module="rustpython_ast.located", name="_Is", extends=CmpOp)]
pub struct CmpOpIs;
impl ToPyObject for CmpopIs {
impl ToPyObject for CmpOpIs {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_IsNot", extends=Cmpop)]
pub struct CmpopIsNot;
#[pyclass(module="rustpython_ast.located", name="_IsNot", extends=CmpOp)]
pub struct CmpOpIsNot;
impl ToPyObject for CmpopIsNot {
impl ToPyObject for CmpOpIsNot {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_In", extends=Cmpop)]
pub struct CmpopIn;
#[pyclass(module="rustpython_ast.located", name="_In", extends=CmpOp)]
pub struct CmpOpIn;
impl ToPyObject for CmpopIn {
impl ToPyObject for CmpOpIn {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.located", name="_NotIn", extends=Cmpop)]
pub struct CmpopNotIn;
#[pyclass(module="rustpython_ast.located", name="_NotIn", extends=CmpOp)]
pub struct CmpOpNotIn;
impl ToPyObject for CmpopNotIn {
impl ToPyObject for CmpOpNotIn {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
@ -3209,29 +3209,29 @@ impl Comprehension {
#[pyclass(module="rustpython_ast.located", name="_excepthandler", extends=super::Ast, frozen, subclass)]
#[derive(Clone, Debug)]
pub struct Excepthandler;
pub struct ExceptHandler;
impl From<&'static ast::Excepthandler<SourceRange>> for Excepthandler {
fn from(_node: &'static ast::Excepthandler<SourceRange>) -> Self {
Excepthandler
impl From<&'static ast::ExceptHandler<SourceRange>> for ExceptHandler {
fn from(_node: &'static ast::ExceptHandler<SourceRange>) -> Self {
ExceptHandler
}
}
#[pymethods]
impl Excepthandler {
impl ExceptHandler {
#[new]
fn new() -> PyClassInitializer<Self> {
PyClassInitializer::from(Ast).add_subclass(Self)
}
}
impl ToPyObject for Excepthandler {
impl ToPyObject for ExceptHandler {
fn to_object(&self, py: Python) -> PyObject {
let initializer = Self::new();
Py::new(py, initializer).unwrap().into_py(py)
}
}
impl ToPyWrapper for ast::Excepthandler<SourceRange> {
impl ToPyWrapper for ast::ExceptHandler<SourceRange> {
#[inline]
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
match &self {
@ -3240,34 +3240,34 @@ impl ToPyWrapper for ast::Excepthandler<SourceRange> {
}
}
#[pyclass(module="rustpython_ast.located", name="_ExceptHandler", extends=Excepthandler, frozen)]
#[pyclass(module="rustpython_ast.located", name="_ExceptHandler", extends=ExceptHandler, frozen)]
#[derive(Clone, Debug)]
pub struct ExcepthandlerExceptHandler(pub &'static ast::ExcepthandlerExceptHandler<SourceRange>);
pub struct ExceptHandlerExceptHandler(pub &'static ast::ExceptHandlerExceptHandler<SourceRange>);
impl From<&'static ast::ExcepthandlerExceptHandler<SourceRange>> for ExcepthandlerExceptHandler {
fn from(node: &'static ast::ExcepthandlerExceptHandler<SourceRange>) -> Self {
ExcepthandlerExceptHandler(node)
impl From<&'static ast::ExceptHandlerExceptHandler<SourceRange>> for ExceptHandlerExceptHandler {
fn from(node: &'static ast::ExceptHandlerExceptHandler<SourceRange>) -> Self {
ExceptHandlerExceptHandler(node)
}
}
impl ToPyObject for ExcepthandlerExceptHandler {
impl ToPyObject for ExceptHandlerExceptHandler {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Excepthandler)
.add_subclass(ExceptHandler)
.add_subclass(self.clone());
Py::new(py, initializer).unwrap().into_py(py)
}
}
impl ToPyWrapper for ast::ExcepthandlerExceptHandler<SourceRange> {
impl ToPyWrapper for ast::ExceptHandlerExceptHandler<SourceRange> {
#[inline]
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
Ok(ExcepthandlerExceptHandler(self).to_object(py))
Ok(ExceptHandlerExceptHandler(self).to_object(py))
}
}
#[pymethods]
impl ExcepthandlerExceptHandler {
impl ExceptHandlerExceptHandler {
#[getter]
#[inline]
fn get_type(&self, py: Python) -> PyResult<PyObject> {
@ -3481,30 +3481,30 @@ impl Alias {
#[pyclass(module="rustpython_ast.located", name="_withitem", extends=super::Ast, frozen)]
#[derive(Clone, Debug)]
pub struct Withitem(pub &'static ast::Withitem<SourceRange>);
pub struct WithItem(pub &'static ast::WithItem<SourceRange>);
impl From<&'static ast::Withitem<SourceRange>> for Withitem {
fn from(node: &'static ast::Withitem<SourceRange>) -> Self {
Withitem(node)
impl From<&'static ast::WithItem<SourceRange>> for WithItem {
fn from(node: &'static ast::WithItem<SourceRange>) -> Self {
WithItem(node)
}
}
impl ToPyObject for Withitem {
impl ToPyObject for WithItem {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone());
Py::new(py, initializer).unwrap().into_py(py)
}
}
impl ToPyWrapper for ast::Withitem<SourceRange> {
impl ToPyWrapper for ast::WithItem<SourceRange> {
#[inline]
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
Ok(Withitem(self).to_object(py))
Ok(WithItem(self).to_object(py))
}
}
#[pymethods]
impl Withitem {
impl WithItem {
#[getter]
#[inline]
fn get_context_expr(&self, py: Python) -> PyResult<PyObject> {
@ -4025,27 +4025,27 @@ impl ToPyWrapper for ast::ExprContextDel {
}
}
impl ToPyWrapper for ast::Boolop {
impl ToPyWrapper for ast::BoolOp {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
match &self {
Self::And => Ok(BoolopAnd.to_object(py)),
Self::Or => Ok(BoolopOr.to_object(py)),
Self::And => Ok(BoolOpAnd.to_object(py)),
Self::Or => Ok(BoolOpOr.to_object(py)),
}
}
}
impl ToPyWrapper for ast::BoolopAnd {
impl ToPyWrapper for ast::BoolOpAnd {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(BoolopAnd.to_object(py))
Ok(BoolOpAnd.to_object(py))
}
}
impl ToPyWrapper for ast::BoolopOr {
impl ToPyWrapper for ast::BoolOpOr {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(BoolopOr.to_object(py))
Ok(BoolOpOr.to_object(py))
}
}
@ -4161,131 +4161,131 @@ impl ToPyWrapper for ast::OperatorFloorDiv {
}
}
impl ToPyWrapper for ast::Unaryop {
impl ToPyWrapper for ast::UnaryOp {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
match &self {
Self::Invert => Ok(UnaryopInvert.to_object(py)),
Self::Not => Ok(UnaryopNot.to_object(py)),
Self::UAdd => Ok(UnaryopUAdd.to_object(py)),
Self::USub => Ok(UnaryopUSub.to_object(py)),
Self::Invert => Ok(UnaryOpInvert.to_object(py)),
Self::Not => Ok(UnaryOpNot.to_object(py)),
Self::UAdd => Ok(UnaryOpUAdd.to_object(py)),
Self::USub => Ok(UnaryOpUSub.to_object(py)),
}
}
}
impl ToPyWrapper for ast::UnaryopInvert {
impl ToPyWrapper for ast::UnaryOpInvert {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(UnaryopInvert.to_object(py))
Ok(UnaryOpInvert.to_object(py))
}
}
impl ToPyWrapper for ast::UnaryopNot {
impl ToPyWrapper for ast::UnaryOpNot {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(UnaryopNot.to_object(py))
Ok(UnaryOpNot.to_object(py))
}
}
impl ToPyWrapper for ast::UnaryopUAdd {
impl ToPyWrapper for ast::UnaryOpUAdd {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(UnaryopUAdd.to_object(py))
Ok(UnaryOpUAdd.to_object(py))
}
}
impl ToPyWrapper for ast::UnaryopUSub {
impl ToPyWrapper for ast::UnaryOpUSub {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(UnaryopUSub.to_object(py))
Ok(UnaryOpUSub.to_object(py))
}
}
impl ToPyWrapper for ast::Cmpop {
impl ToPyWrapper for ast::CmpOp {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
match &self {
Self::Eq => Ok(CmpopEq.to_object(py)),
Self::NotEq => Ok(CmpopNotEq.to_object(py)),
Self::Lt => Ok(CmpopLt.to_object(py)),
Self::LtE => Ok(CmpopLtE.to_object(py)),
Self::Gt => Ok(CmpopGt.to_object(py)),
Self::GtE => Ok(CmpopGtE.to_object(py)),
Self::Is => Ok(CmpopIs.to_object(py)),
Self::IsNot => Ok(CmpopIsNot.to_object(py)),
Self::In => Ok(CmpopIn.to_object(py)),
Self::NotIn => Ok(CmpopNotIn.to_object(py)),
Self::Eq => Ok(CmpOpEq.to_object(py)),
Self::NotEq => Ok(CmpOpNotEq.to_object(py)),
Self::Lt => Ok(CmpOpLt.to_object(py)),
Self::LtE => Ok(CmpOpLtE.to_object(py)),
Self::Gt => Ok(CmpOpGt.to_object(py)),
Self::GtE => Ok(CmpOpGtE.to_object(py)),
Self::Is => Ok(CmpOpIs.to_object(py)),
Self::IsNot => Ok(CmpOpIsNot.to_object(py)),
Self::In => Ok(CmpOpIn.to_object(py)),
Self::NotIn => Ok(CmpOpNotIn.to_object(py)),
}
}
}
impl ToPyWrapper for ast::CmpopEq {
impl ToPyWrapper for ast::CmpOpEq {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopEq.to_object(py))
Ok(CmpOpEq.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopNotEq {
impl ToPyWrapper for ast::CmpOpNotEq {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopNotEq.to_object(py))
Ok(CmpOpNotEq.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopLt {
impl ToPyWrapper for ast::CmpOpLt {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopLt.to_object(py))
Ok(CmpOpLt.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopLtE {
impl ToPyWrapper for ast::CmpOpLtE {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopLtE.to_object(py))
Ok(CmpOpLtE.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopGt {
impl ToPyWrapper for ast::CmpOpGt {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopGt.to_object(py))
Ok(CmpOpGt.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopGtE {
impl ToPyWrapper for ast::CmpOpGtE {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopGtE.to_object(py))
Ok(CmpOpGtE.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopIs {
impl ToPyWrapper for ast::CmpOpIs {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopIs.to_object(py))
Ok(CmpOpIs.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopIsNot {
impl ToPyWrapper for ast::CmpOpIsNot {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopIsNot.to_object(py))
Ok(CmpOpIsNot.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopIn {
impl ToPyWrapper for ast::CmpOpIn {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopIn.to_object(py))
Ok(CmpOpIn.to_object(py))
}
}
impl ToPyWrapper for ast::CmpopNotIn {
impl ToPyWrapper for ast::CmpOpNotIn {
#[inline]
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
Ok(CmpopNotIn.to_object(py))
Ok(CmpOpNotIn.to_object(py))
}
}
@ -4356,9 +4356,9 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
super::init_type::<ExprContextLoad, ast::ExprContextLoad>(py, m)?;
super::init_type::<ExprContextStore, ast::ExprContextStore>(py, m)?;
super::init_type::<ExprContextDel, ast::ExprContextDel>(py, m)?;
super::init_type::<Boolop, ast::Boolop>(py, m)?;
super::init_type::<BoolopAnd, ast::BoolopAnd>(py, m)?;
super::init_type::<BoolopOr, ast::BoolopOr>(py, m)?;
super::init_type::<BoolOp, ast::BoolOp>(py, m)?;
super::init_type::<BoolOpAnd, ast::BoolOpAnd>(py, m)?;
super::init_type::<BoolOpOr, ast::BoolOpOr>(py, m)?;
super::init_type::<Operator, ast::Operator>(py, m)?;
super::init_type::<OperatorAdd, ast::OperatorAdd>(py, m)?;
super::init_type::<OperatorSub, ast::OperatorSub>(py, m)?;
@ -4373,30 +4373,30 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
super::init_type::<OperatorBitXor, ast::OperatorBitXor>(py, m)?;
super::init_type::<OperatorBitAnd, ast::OperatorBitAnd>(py, m)?;
super::init_type::<OperatorFloorDiv, ast::OperatorFloorDiv>(py, m)?;
super::init_type::<Unaryop, ast::Unaryop>(py, m)?;
super::init_type::<UnaryopInvert, ast::UnaryopInvert>(py, m)?;
super::init_type::<UnaryopNot, ast::UnaryopNot>(py, m)?;
super::init_type::<UnaryopUAdd, ast::UnaryopUAdd>(py, m)?;
super::init_type::<UnaryopUSub, ast::UnaryopUSub>(py, m)?;
super::init_type::<Cmpop, ast::Cmpop>(py, m)?;
super::init_type::<CmpopEq, ast::CmpopEq>(py, m)?;
super::init_type::<CmpopNotEq, ast::CmpopNotEq>(py, m)?;
super::init_type::<CmpopLt, ast::CmpopLt>(py, m)?;
super::init_type::<CmpopLtE, ast::CmpopLtE>(py, m)?;
super::init_type::<CmpopGt, ast::CmpopGt>(py, m)?;
super::init_type::<CmpopGtE, ast::CmpopGtE>(py, m)?;
super::init_type::<CmpopIs, ast::CmpopIs>(py, m)?;
super::init_type::<CmpopIsNot, ast::CmpopIsNot>(py, m)?;
super::init_type::<CmpopIn, ast::CmpopIn>(py, m)?;
super::init_type::<CmpopNotIn, ast::CmpopNotIn>(py, m)?;
super::init_type::<UnaryOp, ast::UnaryOp>(py, m)?;
super::init_type::<UnaryOpInvert, ast::UnaryOpInvert>(py, m)?;
super::init_type::<UnaryOpNot, ast::UnaryOpNot>(py, m)?;
super::init_type::<UnaryOpUAdd, ast::UnaryOpUAdd>(py, m)?;
super::init_type::<UnaryOpUSub, ast::UnaryOpUSub>(py, m)?;
super::init_type::<CmpOp, ast::CmpOp>(py, m)?;
super::init_type::<CmpOpEq, ast::CmpOpEq>(py, m)?;
super::init_type::<CmpOpNotEq, ast::CmpOpNotEq>(py, m)?;
super::init_type::<CmpOpLt, ast::CmpOpLt>(py, m)?;
super::init_type::<CmpOpLtE, ast::CmpOpLtE>(py, m)?;
super::init_type::<CmpOpGt, ast::CmpOpGt>(py, m)?;
super::init_type::<CmpOpGtE, ast::CmpOpGtE>(py, m)?;
super::init_type::<CmpOpIs, ast::CmpOpIs>(py, m)?;
super::init_type::<CmpOpIsNot, ast::CmpOpIsNot>(py, m)?;
super::init_type::<CmpOpIn, ast::CmpOpIn>(py, m)?;
super::init_type::<CmpOpNotIn, ast::CmpOpNotIn>(py, m)?;
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
super::init_type::<ExceptHandler, ast::ExceptHandler>(py, m)?;
super::init_type::<ExceptHandlerExceptHandler, ast::ExceptHandlerExceptHandler>(py, m)?;
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
super::init_type::<Arg, ast::Arg>(py, m)?;
super::init_type::<Keyword, ast::Keyword>(py, m)?;
super::init_type::<Alias, ast::Alias>(py, m)?;
super::init_type::<Withitem, ast::Withitem>(py, m)?;
super::init_type::<WithItem, ast::WithItem>(py, m)?;
super::init_type::<MatchCase, ast::MatchCase>(py, m)?;
super::init_type::<Pattern, ast::Pattern>(py, m)?;
super::init_type::<PatternMatchValue, ast::PatternMatchValue>(py, m)?;

View file

@ -2714,47 +2714,47 @@ impl ToPyObject for ExprContextDel {
#[pyclass(module="rustpython_ast.ranged", name="_boolop", extends=super::Ast, frozen, subclass)]
#[derive(Clone, Debug)]
pub struct Boolop;
pub struct BoolOp;
impl From<&'static ast::Boolop> for Boolop {
fn from(_node: &'static ast::Boolop) -> Self {
Boolop
impl From<&'static ast::BoolOp> for BoolOp {
fn from(_node: &'static ast::BoolOp) -> Self {
BoolOp
}
}
#[pymethods]
impl Boolop {
impl BoolOp {
#[new]
fn new() -> PyClassInitializer<Self> {
PyClassInitializer::from(Ast).add_subclass(Self)
}
}
impl ToPyObject for Boolop {
impl ToPyObject for BoolOp {
fn to_object(&self, py: Python) -> PyObject {
let initializer = Self::new();
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_And", extends=Boolop)]
pub struct BoolopAnd;
#[pyclass(module="rustpython_ast.ranged", name="_And", extends=BoolOp)]
pub struct BoolOpAnd;
impl ToPyObject for BoolopAnd {
impl ToPyObject for BoolOpAnd {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Boolop)
.add_subclass(BoolOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_Or", extends=Boolop)]
pub struct BoolopOr;
#[pyclass(module="rustpython_ast.ranged", name="_Or", extends=BoolOp)]
pub struct BoolOpOr;
impl ToPyObject for BoolopOr {
impl ToPyObject for BoolOpOr {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Boolop)
.add_subclass(BoolOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
@ -2942,71 +2942,71 @@ impl ToPyObject for OperatorFloorDiv {
#[pyclass(module="rustpython_ast.ranged", name="_unaryop", extends=super::Ast, frozen, subclass)]
#[derive(Clone, Debug)]
pub struct Unaryop;
pub struct UnaryOp;
impl From<&'static ast::Unaryop> for Unaryop {
fn from(_node: &'static ast::Unaryop) -> Self {
Unaryop
impl From<&'static ast::UnaryOp> for UnaryOp {
fn from(_node: &'static ast::UnaryOp) -> Self {
UnaryOp
}
}
#[pymethods]
impl Unaryop {
impl UnaryOp {
#[new]
fn new() -> PyClassInitializer<Self> {
PyClassInitializer::from(Ast).add_subclass(Self)
}
}
impl ToPyObject for Unaryop {
impl ToPyObject for UnaryOp {
fn to_object(&self, py: Python) -> PyObject {
let initializer = Self::new();
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_Invert", extends=Unaryop)]
pub struct UnaryopInvert;
#[pyclass(module="rustpython_ast.ranged", name="_Invert", extends=UnaryOp)]
pub struct UnaryOpInvert;
impl ToPyObject for UnaryopInvert {
impl ToPyObject for UnaryOpInvert {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Unaryop)
.add_subclass(UnaryOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_Not", extends=Unaryop)]
pub struct UnaryopNot;
#[pyclass(module="rustpython_ast.ranged", name="_Not", extends=UnaryOp)]
pub struct UnaryOpNot;
impl ToPyObject for UnaryopNot {
impl ToPyObject for UnaryOpNot {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Unaryop)
.add_subclass(UnaryOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_UAdd", extends=Unaryop)]
pub struct UnaryopUAdd;
#[pyclass(module="rustpython_ast.ranged", name="_UAdd", extends=UnaryOp)]
pub struct UnaryOpUAdd;
impl ToPyObject for UnaryopUAdd {
impl ToPyObject for UnaryOpUAdd {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Unaryop)
.add_subclass(UnaryOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_USub", extends=Unaryop)]
pub struct UnaryopUSub;
#[pyclass(module="rustpython_ast.ranged", name="_USub", extends=UnaryOp)]
pub struct UnaryOpUSub;
impl ToPyObject for UnaryopUSub {
impl ToPyObject for UnaryOpUSub {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Unaryop)
.add_subclass(UnaryOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
@ -3014,143 +3014,143 @@ impl ToPyObject for UnaryopUSub {
#[pyclass(module="rustpython_ast.ranged", name="_cmpop", extends=super::Ast, frozen, subclass)]
#[derive(Clone, Debug)]
pub struct Cmpop;
pub struct CmpOp;
impl From<&'static ast::Cmpop> for Cmpop {
fn from(_node: &'static ast::Cmpop) -> Self {
Cmpop
impl From<&'static ast::CmpOp> for CmpOp {
fn from(_node: &'static ast::CmpOp) -> Self {
CmpOp
}
}
#[pymethods]
impl Cmpop {
impl CmpOp {
#[new]
fn new() -> PyClassInitializer<Self> {
PyClassInitializer::from(Ast).add_subclass(Self)
}
}
impl ToPyObject for Cmpop {
impl ToPyObject for CmpOp {
fn to_object(&self, py: Python) -> PyObject {
let initializer = Self::new();
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_Eq", extends=Cmpop)]
pub struct CmpopEq;
#[pyclass(module="rustpython_ast.ranged", name="_Eq", extends=CmpOp)]
pub struct CmpOpEq;
impl ToPyObject for CmpopEq {
impl ToPyObject for CmpOpEq {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_NotEq", extends=Cmpop)]
pub struct CmpopNotEq;
#[pyclass(module="rustpython_ast.ranged", name="_NotEq", extends=CmpOp)]
pub struct CmpOpNotEq;
impl ToPyObject for CmpopNotEq {
impl ToPyObject for CmpOpNotEq {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_Lt", extends=Cmpop)]
pub struct CmpopLt;
#[pyclass(module="rustpython_ast.ranged", name="_Lt", extends=CmpOp)]
pub struct CmpOpLt;
impl ToPyObject for CmpopLt {
impl ToPyObject for CmpOpLt {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_LtE", extends=Cmpop)]
pub struct CmpopLtE;
#[pyclass(module="rustpython_ast.ranged", name="_LtE", extends=CmpOp)]
pub struct CmpOpLtE;
impl ToPyObject for CmpopLtE {
impl ToPyObject for CmpOpLtE {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_Gt", extends=Cmpop)]
pub struct CmpopGt;
#[pyclass(module="rustpython_ast.ranged", name="_Gt", extends=CmpOp)]
pub struct CmpOpGt;
impl ToPyObject for CmpopGt {
impl ToPyObject for CmpOpGt {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_GtE", extends=Cmpop)]
pub struct CmpopGtE;
#[pyclass(module="rustpython_ast.ranged", name="_GtE", extends=CmpOp)]
pub struct CmpOpGtE;
impl ToPyObject for CmpopGtE {
impl ToPyObject for CmpOpGtE {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_Is", extends=Cmpop)]
pub struct CmpopIs;
#[pyclass(module="rustpython_ast.ranged", name="_Is", extends=CmpOp)]
pub struct CmpOpIs;
impl ToPyObject for CmpopIs {
impl ToPyObject for CmpOpIs {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_IsNot", extends=Cmpop)]
pub struct CmpopIsNot;
#[pyclass(module="rustpython_ast.ranged", name="_IsNot", extends=CmpOp)]
pub struct CmpOpIsNot;
impl ToPyObject for CmpopIsNot {
impl ToPyObject for CmpOpIsNot {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_In", extends=Cmpop)]
pub struct CmpopIn;
#[pyclass(module="rustpython_ast.ranged", name="_In", extends=CmpOp)]
pub struct CmpOpIn;
impl ToPyObject for CmpopIn {
impl ToPyObject for CmpOpIn {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
}
#[pyclass(module="rustpython_ast.ranged", name="_NotIn", extends=Cmpop)]
pub struct CmpopNotIn;
#[pyclass(module="rustpython_ast.ranged", name="_NotIn", extends=CmpOp)]
pub struct CmpOpNotIn;
impl ToPyObject for CmpopNotIn {
impl ToPyObject for CmpOpNotIn {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Cmpop)
.add_subclass(CmpOp)
.add_subclass(Self);
Py::new(py, initializer).unwrap().into_py(py)
}
@ -3209,29 +3209,29 @@ impl Comprehension {
#[pyclass(module="rustpython_ast.ranged", name="_excepthandler", extends=super::Ast, frozen, subclass)]
#[derive(Clone, Debug)]
pub struct Excepthandler;
pub struct ExceptHandler;
impl From<&'static ast::Excepthandler<TextRange>> for Excepthandler {
fn from(_node: &'static ast::Excepthandler<TextRange>) -> Self {
Excepthandler
impl From<&'static ast::ExceptHandler<TextRange>> for ExceptHandler {
fn from(_node: &'static ast::ExceptHandler<TextRange>) -> Self {
ExceptHandler
}
}
#[pymethods]
impl Excepthandler {
impl ExceptHandler {
#[new]
fn new() -> PyClassInitializer<Self> {
PyClassInitializer::from(Ast).add_subclass(Self)
}
}
impl ToPyObject for Excepthandler {
impl ToPyObject for ExceptHandler {
fn to_object(&self, py: Python) -> PyObject {
let initializer = Self::new();
Py::new(py, initializer).unwrap().into_py(py)
}
}
impl ToPyWrapper for ast::Excepthandler<TextRange> {
impl ToPyWrapper for ast::ExceptHandler<TextRange> {
#[inline]
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
match &self {
@ -3240,34 +3240,34 @@ impl ToPyWrapper for ast::Excepthandler<TextRange> {
}
}
#[pyclass(module="rustpython_ast.ranged", name="_ExceptHandler", extends=Excepthandler, frozen)]
#[pyclass(module="rustpython_ast.ranged", name="_ExceptHandler", extends=ExceptHandler, frozen)]
#[derive(Clone, Debug)]
pub struct ExcepthandlerExceptHandler(pub &'static ast::ExcepthandlerExceptHandler<TextRange>);
pub struct ExceptHandlerExceptHandler(pub &'static ast::ExceptHandlerExceptHandler<TextRange>);
impl From<&'static ast::ExcepthandlerExceptHandler<TextRange>> for ExcepthandlerExceptHandler {
fn from(node: &'static ast::ExcepthandlerExceptHandler<TextRange>) -> Self {
ExcepthandlerExceptHandler(node)
impl From<&'static ast::ExceptHandlerExceptHandler<TextRange>> for ExceptHandlerExceptHandler {
fn from(node: &'static ast::ExceptHandlerExceptHandler<TextRange>) -> Self {
ExceptHandlerExceptHandler(node)
}
}
impl ToPyObject for ExcepthandlerExceptHandler {
impl ToPyObject for ExceptHandlerExceptHandler {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast)
.add_subclass(Excepthandler)
.add_subclass(ExceptHandler)
.add_subclass(self.clone());
Py::new(py, initializer).unwrap().into_py(py)
}
}
impl ToPyWrapper for ast::ExcepthandlerExceptHandler<TextRange> {
impl ToPyWrapper for ast::ExceptHandlerExceptHandler<TextRange> {
#[inline]
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
Ok(ExcepthandlerExceptHandler(self).to_object(py))
Ok(ExceptHandlerExceptHandler(self).to_object(py))
}
}
#[pymethods]
impl ExcepthandlerExceptHandler {
impl ExceptHandlerExceptHandler {
#[getter]
#[inline]
fn get_type(&self, py: Python) -> PyResult<PyObject> {
@ -3481,30 +3481,30 @@ impl Alias {
#[pyclass(module="rustpython_ast.ranged", name="_withitem", extends=super::Ast, frozen)]
#[derive(Clone, Debug)]
pub struct Withitem(pub &'static ast::Withitem<TextRange>);
pub struct WithItem(pub &'static ast::WithItem<TextRange>);
impl From<&'static ast::Withitem<TextRange>> for Withitem {
fn from(node: &'static ast::Withitem<TextRange>) -> Self {
Withitem(node)
impl From<&'static ast::WithItem<TextRange>> for WithItem {
fn from(node: &'static ast::WithItem<TextRange>) -> Self {
WithItem(node)
}
}
impl ToPyObject for Withitem {
impl ToPyObject for WithItem {
fn to_object(&self, py: Python) -> PyObject {
let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone());
Py::new(py, initializer).unwrap().into_py(py)
}
}
impl ToPyWrapper for ast::Withitem<TextRange> {
impl ToPyWrapper for ast::WithItem<TextRange> {
#[inline]
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
Ok(Withitem(self).to_object(py))
Ok(WithItem(self).to_object(py))
}
}
#[pymethods]
impl Withitem {
impl WithItem {
#[getter]
#[inline]
fn get_context_expr(&self, py: Python) -> PyResult<PyObject> {
@ -4060,9 +4060,9 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
super::init_type::<ExprContextLoad, ast::ExprContextLoad>(py, m)?;
super::init_type::<ExprContextStore, ast::ExprContextStore>(py, m)?;
super::init_type::<ExprContextDel, ast::ExprContextDel>(py, m)?;
super::init_type::<Boolop, ast::Boolop>(py, m)?;
super::init_type::<BoolopAnd, ast::BoolopAnd>(py, m)?;
super::init_type::<BoolopOr, ast::BoolopOr>(py, m)?;
super::init_type::<BoolOp, ast::BoolOp>(py, m)?;
super::init_type::<BoolOpAnd, ast::BoolOpAnd>(py, m)?;
super::init_type::<BoolOpOr, ast::BoolOpOr>(py, m)?;
super::init_type::<Operator, ast::Operator>(py, m)?;
super::init_type::<OperatorAdd, ast::OperatorAdd>(py, m)?;
super::init_type::<OperatorSub, ast::OperatorSub>(py, m)?;
@ -4077,30 +4077,30 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
super::init_type::<OperatorBitXor, ast::OperatorBitXor>(py, m)?;
super::init_type::<OperatorBitAnd, ast::OperatorBitAnd>(py, m)?;
super::init_type::<OperatorFloorDiv, ast::OperatorFloorDiv>(py, m)?;
super::init_type::<Unaryop, ast::Unaryop>(py, m)?;
super::init_type::<UnaryopInvert, ast::UnaryopInvert>(py, m)?;
super::init_type::<UnaryopNot, ast::UnaryopNot>(py, m)?;
super::init_type::<UnaryopUAdd, ast::UnaryopUAdd>(py, m)?;
super::init_type::<UnaryopUSub, ast::UnaryopUSub>(py, m)?;
super::init_type::<Cmpop, ast::Cmpop>(py, m)?;
super::init_type::<CmpopEq, ast::CmpopEq>(py, m)?;
super::init_type::<CmpopNotEq, ast::CmpopNotEq>(py, m)?;
super::init_type::<CmpopLt, ast::CmpopLt>(py, m)?;
super::init_type::<CmpopLtE, ast::CmpopLtE>(py, m)?;
super::init_type::<CmpopGt, ast::CmpopGt>(py, m)?;
super::init_type::<CmpopGtE, ast::CmpopGtE>(py, m)?;
super::init_type::<CmpopIs, ast::CmpopIs>(py, m)?;
super::init_type::<CmpopIsNot, ast::CmpopIsNot>(py, m)?;
super::init_type::<CmpopIn, ast::CmpopIn>(py, m)?;
super::init_type::<CmpopNotIn, ast::CmpopNotIn>(py, m)?;
super::init_type::<UnaryOp, ast::UnaryOp>(py, m)?;
super::init_type::<UnaryOpInvert, ast::UnaryOpInvert>(py, m)?;
super::init_type::<UnaryOpNot, ast::UnaryOpNot>(py, m)?;
super::init_type::<UnaryOpUAdd, ast::UnaryOpUAdd>(py, m)?;
super::init_type::<UnaryOpUSub, ast::UnaryOpUSub>(py, m)?;
super::init_type::<CmpOp, ast::CmpOp>(py, m)?;
super::init_type::<CmpOpEq, ast::CmpOpEq>(py, m)?;
super::init_type::<CmpOpNotEq, ast::CmpOpNotEq>(py, m)?;
super::init_type::<CmpOpLt, ast::CmpOpLt>(py, m)?;
super::init_type::<CmpOpLtE, ast::CmpOpLtE>(py, m)?;
super::init_type::<CmpOpGt, ast::CmpOpGt>(py, m)?;
super::init_type::<CmpOpGtE, ast::CmpOpGtE>(py, m)?;
super::init_type::<CmpOpIs, ast::CmpOpIs>(py, m)?;
super::init_type::<CmpOpIsNot, ast::CmpOpIsNot>(py, m)?;
super::init_type::<CmpOpIn, ast::CmpOpIn>(py, m)?;
super::init_type::<CmpOpNotIn, ast::CmpOpNotIn>(py, m)?;
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
super::init_type::<ExceptHandler, ast::ExceptHandler>(py, m)?;
super::init_type::<ExceptHandlerExceptHandler, ast::ExceptHandlerExceptHandler>(py, m)?;
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
super::init_type::<Arg, ast::Arg>(py, m)?;
super::init_type::<Keyword, ast::Keyword>(py, m)?;
super::init_type::<Alias, ast::Alias>(py, m)?;
super::init_type::<Withitem, ast::Withitem>(py, m)?;
super::init_type::<WithItem, ast::WithItem>(py, m)?;
super::init_type::<MatchCase, ast::MatchCase>(py, m)?;
super::init_type::<Pattern, ast::Pattern>(py, m)?;
super::init_type::<PatternMatchValue, ast::PatternMatchValue>(py, m)?;