remove manual signature

This commit is contained in:
Jeong YunWon
2021-08-22 01:08:53 +09:00
parent fb461c287c
commit 573b28f35f

View File

@@ -33,9 +33,6 @@ impl PyValue for PyBaseObject {
#[pyimpl(flags(BASETYPE))]
impl PyBaseObject {
/// __new__($type, *args, **kwargs)
/// --
///
/// Create and return a new object. See help(type) for accurate signature.
#[pyslot]
fn tp_new(mut args: FuncArgs, vm: &VirtualMachine) -> PyResult {
@@ -92,105 +89,81 @@ impl PyBaseObject {
Ok(res)
}
/// __eq__($self, value, /)
/// --
///
/// Return self==value.
#[pymethod(magic)]
fn eq(
zelf: PyObjectRef,
other: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &other, PyComparisonOp::Eq, vm)
Self::cmp(&zelf, &value, PyComparisonOp::Eq, vm)
}
/// __ne__($self, value, /)
/// --
///
/// Return self!=value.
#[pymethod(magic)]
fn ne(
zelf: PyObjectRef,
other: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &other, PyComparisonOp::Ne, vm)
Self::cmp(&zelf, &value, PyComparisonOp::Ne, vm)
}
/// __lt__($self, value, /)
/// --
///
/// Return self<value.
#[pymethod(magic)]
fn lt(
zelf: PyObjectRef,
other: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &other, PyComparisonOp::Lt, vm)
Self::cmp(&zelf, &value, PyComparisonOp::Lt, vm)
}
/// __le__($self, value, /)
/// --
///
/// Return self<=value.
#[pymethod(magic)]
fn le(
zelf: PyObjectRef,
other: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &other, PyComparisonOp::Le, vm)
Self::cmp(&zelf, &value, PyComparisonOp::Le, vm)
}
/// __ge__($self, value, /)
/// --
///
/// Return self>=value.
#[pymethod(magic)]
fn ge(
zelf: PyObjectRef,
other: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &other, PyComparisonOp::Ge, vm)
Self::cmp(&zelf, &value, PyComparisonOp::Ge, vm)
}
/// __gt__($self, value, /)
/// --
///
/// Return self>value.
#[pymethod(magic)]
fn gt(
zelf: PyObjectRef,
other: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &other, PyComparisonOp::Gt, vm)
Self::cmp(&zelf, &value, PyComparisonOp::Gt, vm)
}
/// __setattr__($self, name, value /)
/// --
///
/// Implement setattr(self, name, value).
#[pymethod]
fn __setattr__(
obj: PyObjectRef,
attr_name: PyStrRef,
name: PyStrRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<()> {
setattr(&obj, attr_name, Some(value), vm)
setattr(&obj, name, Some(value), vm)
}
/// __delattr__($self, name, /)
/// --
///
/// Implement delattr(self, name).
#[pymethod]
fn __delattr__(obj: PyObjectRef, attr_name: PyStrRef, vm: &VirtualMachine) -> PyResult<()> {
setattr(&obj, attr_name, None, vm)
fn __delattr__(obj: PyObjectRef, name: PyStrRef, vm: &VirtualMachine) -> PyResult<()> {
setattr(&obj, name, None, vm)
}
#[pyslot]
@@ -203,18 +176,12 @@ impl PyBaseObject {
setattr(obj, attr_name, value, vm)
}
/// __str__($self, /)
/// --
///
/// Return str(self).
#[pymethod(magic)]
fn str(zelf: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyStrRef> {
vm.to_repr(&zelf)
}
/// __repr__($self, /)
/// --
///
/// Return repr(self).
#[pymethod(magic)]
fn repr(zelf: PyObjectRef) -> String {
@@ -288,9 +255,6 @@ impl PyBaseObject {
}
}
/// __getattribute__($self, name, /)
/// --
///
/// Return getattr(self, name).
#[pymethod(name = "__getattribute__")]
#[pyslot]
@@ -321,9 +285,6 @@ impl PyBaseObject {
Ok(zelf.get_id() as _)
}
/// __hash__($self, /)
/// --
///
/// Return hash(self).
#[pymethod(magic)]
fn hash(zelf: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyHash> {