Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert SIArray1 interfaces #71

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions si-units/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,7 @@ struct SIArray1;

#[pymethods]
impl SIArray1 {
#[staticmethod]
#[expect(clippy::new_ret_no_self)]
fn new(value: Bound<'_, PyAny>) -> PyResult<Bound<'_, PySIObject>> {
fn __call__<'py>(&self, value: Bound<'py, PyAny>) -> PyResult<Bound<'py, PySIObject>> {
let py = value.py();
if let Ok(v) = value.extract::<SINumber>() {
let value = arr1(&[1.0]) * v.value;
Expand Down Expand Up @@ -508,7 +506,7 @@ pub fn si_units(m: &Bound<'_, PyModule>) -> PyResult<()> {

m.add_class::<PySIObject>()?;
m.add_class::<PyAngle>()?;
m.add_class::<SIArray1>()?;
m.add("SIArray1", SIArray1)?;

add_constant(m, "SECOND", 1.0, _SECOND)?;
add_constant(m, "METER", 1.0, _METER)?;
Expand Down
Loading