@@ -4,7 +4,6 @@ use std::str::FromStr;
44use std:: { collections:: HashMap , path:: Path } ;
55
66use anyhow:: { anyhow, bail, Context , Result } ;
7- use once_cell:: sync:: Lazy ;
87use pgrx:: * ;
98use pyo3:: prelude:: * ;
109use pyo3:: types:: PyTuple ;
@@ -47,22 +46,22 @@ pub fn transform(
4746)
4847. format_traceback ( py) ?;
4948
50- Ok ( output. extract ( py) . format_traceback ( py) ? )
49+ output. extract ( py) . format_traceback ( py)
5150} ) ?;
5251
5352Ok ( serde_json:: from_str ( & results) ?)
5453}
5554
5655pub fn get_model_from ( task : & Value ) ->Result < String > {
57- Ok ( Python :: with_gil ( |py| ->Result < String > {
56+ Python :: with_gil ( |py| ->Result < String > {
5857let get_model_from =get_module ! ( PY_MODULE )
5958. getattr ( py, "get_model_from" )
6059. format_traceback ( py) ?;
6160let model = get_model_from
6261. call1 ( py, PyTuple :: new ( py, & [ task. to_string ( ) . into_py ( py) ] ) )
6362. format_traceback ( py) ?;
64- Ok ( model. extract ( py) . format_traceback ( py) ? )
65- } ) ? )
63+ model. extract ( py) . format_traceback ( py)
64+ } )
6665}
6766
6867pub fn embed (
@@ -91,7 +90,7 @@ pub fn embed(
9190)
9291. format_traceback ( py) ?;
9392
94- Ok ( output. extract ( py) . format_traceback ( py) ? )
93+ output. extract ( py) . format_traceback ( py)
9594} )
9695}
9796
@@ -126,7 +125,7 @@ pub fn tune(
126125)
127126. format_traceback ( py) ?;
128127
129- Ok ( output. extract ( py) . format_traceback ( py) ? )
128+ output. extract ( py) . format_traceback ( py)
130129} )
131130}
132131
@@ -176,7 +175,7 @@ pub fn generate(model_id: i64, inputs: Vec<&str>, config: JsonB) -> Result<Vec<S
176175}
177176Ok ( o) => o,
178177} ;
179- Ok ( result. extract ( py) . format_traceback ( py) ? )
178+ result. extract ( py) . format_traceback ( py)
180179} )
181180}
182181
@@ -227,7 +226,7 @@ pub fn load_dataset(
227226let load_dataset: Py < PyAny > =get_module ! ( PY_MODULE )
228227. getattr ( py, "load_dataset" )
229228. format_traceback ( py) ?;
230- Ok ( load_dataset
229+ load_dataset
231230. call1 (
232231 py,
233232PyTuple :: new (
@@ -242,7 +241,7 @@ pub fn load_dataset(
242241)
243242. format_traceback ( py) ?
244243. extract ( py)
245- . format_traceback ( py) ? )
244+ . format_traceback ( py)
246245} ) ?;
247246
248247let table_name =format ! ( "pgml.\" {}\" " , name) ;