We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a function like this:
#[gen_stub_pyfunction(module="symbolica_community.tensors")] #[pyfunction] pub fn dense(structure: Bound<'_, PyAny>, data: Bound<'_, PyAny>) -> PyResult<Spensor> { let structure = PossiblyIndexed::extract_bound(&structure)?; if let Ok(d) = data.extract::<Vec<f64>>() { Ok(Spensor { tensor: DenseTensor::<f64, _>::from_data(d, structure) .map_err(|e| PyOverflowError::new_err(e.to_string()))? .into(), }) } else if let Ok(d) = data.extract::<Vec<PythonExpression>>() { let data = d.into_iter().map(|e| e.expr).collect(); Ok(Spensor { tensor: ParamOrConcrete::Param(ParamTensor::from( DenseTensor::<Atom, _>::from_data(data, structure) .map_err(|e| PyOverflowError::new_err(e.to_string()))?, )), }) } else { Err(PyTypeError::new_err("Only float type supported")) } }
where I try different types for extracting. Is there any way to communicate the set of allowed types to pyo3-stub-gen?
The text was updated successfully, but these errors were encountered:
Based on #82, it seems like there are some issues with function type signatures, but it's worth noting that if you impl PyStubType, you can return a union of TypeInfo. The crate does this to support a string-or-path type here: https://github.com/Jij-Inc/pyo3-stub-gen/blob/0.6.0/pyo3-stub-gen/src/stub_type/builtins.rs#L55-L57
PyStubType
TypeInfo
Sorry, something went wrong.
No branches or pull requests
I have a function like this:
where I try different types for extracting. Is there any way to communicate the set of allowed types to pyo3-stub-gen?
The text was updated successfully, but these errors were encountered: