Fix lints from recent PR (#248)

master
Caleb Hattingh 2024-04-23 01:36:48 +02:00 committed by GitHub
parent 0f35aa450e
commit 41f72b2513
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 5 deletions

View File

@ -1,12 +1,14 @@
use crate::{make_term, Schema};
use pyo3::{exceptions, prelude::*, types::PyAny, types::PyString, types::PyTuple};
use pyo3::{
exceptions, prelude::*, types::PyAny, types::PyString, types::PyTuple,
};
use tantivy as tv;
/// Custom Tuple struct to represent a pair of Occur and Query
/// for the BooleanQuery
struct OccurQueryPair(Occur, Query);
impl <'source> FromPyObject<'source> for OccurQueryPair {
impl<'source> FromPyObject<'source> for OccurQueryPair {
fn extract(ob: &'source PyAny) -> PyResult<Self> {
let tuple = ob.downcast::<PyTuple>()?;
let occur = tuple.get_item(0)?.extract()?;
@ -16,7 +18,6 @@ impl <'source> FromPyObject<'source> for OccurQueryPair {
}
}
/// Tantivy's Occur
#[pyclass(frozen, module = "tantivy.tantivy")]
#[derive(Clone)]
@ -137,7 +138,7 @@ impl Query {
#[staticmethod]
#[pyo3(signature = (subqueries))]
pub(crate) fn boolean_query(
subqueries: Vec<(Occur, Query)>
subqueries: Vec<(Occur, Query)>,
) -> PyResult<Query> {
let dyn_subqueries = subqueries
.into_iter()