Fix redundant imports in doc tests thereby fixing the careful CI job.

This commit is contained in:
Adam Reichold 2023-04-10 08:09:06 +02:00
parent 77fc6e6734
commit 48f79718f9
6 changed files with 2 additions and 11 deletions

View File

@ -39,7 +39,6 @@ the module like this, so that it is importable from Python:
```rust
use pyo3::prelude::*;
use pyo3::types::PyModule;
use pyo3::exceptions::PyException;
pyo3::create_exception!(mymodule, CustomError, PyException);

View File

@ -65,7 +65,6 @@ The following wrapper will call the Python model from Rust, using a struct to ho
```rust
use pyo3::prelude::*;
use pyo3::types::PyAny;
# pub trait Model {
# fn set_variables(&mut self, inputs: &Vec<f64>);
@ -125,7 +124,6 @@ Let's add the PyO3 annotations and add a constructor:
# fn get_results(&self) -> Vec<f64>;
# }
# use pyo3::prelude::*;
# use pyo3::types::PyAny;
#[pyclass]
struct UserModel {
@ -165,7 +163,6 @@ This wrapper will also perform the type conversions between Python and Rust.
```rust
# use pyo3::prelude::*;
# use pyo3::types::PyAny;
#
# pub trait Model {
# fn set_variables(&mut self, inputs: &Vec<f64>);
@ -334,7 +331,6 @@ We used in our `get_results` method the following call that performs the type co
```rust
# use pyo3::prelude::*;
# use pyo3::types::PyAny;
#
# pub trait Model {
# fn set_variables(&mut self, inputs: &Vec<f64>);
@ -387,7 +383,6 @@ Let's break it down in order to perform better error handling:
```rust
# use pyo3::prelude::*;
# use pyo3::types::PyAny;
#
# pub trait Model {
# fn set_variables(&mut self, inputs: &Vec<f64>);
@ -466,7 +461,6 @@ It is also required to make the struct public.
```rust
use pyo3::prelude::*;
use pyo3::types::PyAny;
pub trait Model {
fn set_variables(&mut self, var: &Vec<f64>);

View File

@ -89,7 +89,6 @@ For a `&PyAny` object reference `any` where the underlying object is a `#[pyclas
```rust
# use pyo3::prelude::*;
# use pyo3::{Py, Python, PyAny, PyResult};
# #[pyclass] #[derive(Clone)] struct MyClass { }
# Python::with_gil(|py| -> PyResult<()> {
let obj: &PyAny = Py::new(py, MyClass {})?.into_ref(py);

View File

@ -75,7 +75,6 @@ pub trait AsPyPointer {
///
/// ```rust
/// use pyo3::prelude::*;
/// use pyo3::IntoPyPointer;
/// use pyo3::types::PyString;
/// use pyo3::ffi;
///

View File

@ -20,7 +20,7 @@
/// You can use this macro to test pyfunctions or pyclasses quickly.
///
/// ```
/// use pyo3::{prelude::*, py_run, PyCell};
/// use pyo3::{prelude::*, py_run};
///
/// #[pyclass]
/// #[derive(Debug)]

View File

@ -774,7 +774,7 @@ impl PyAny {
///
/// ```rust
/// use pyo3::prelude::*;
/// use pyo3::types::{PyAny, PyDict, PyList};
/// use pyo3::types::{PyDict, PyList};
///
/// Python::with_gil(|py| {
/// let dict = PyDict::new(py);