File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,10 +93,15 @@ impl Default for FormatterConfig {
9393 }
9494}
9595
96- fn get_formatter_config ( py : Python ) -> PyResult < FormatterConfig > {
96+ /// Get the Python formatter from the datafusion.html_formatter module
97+ fn get_python_formatter ( py : Python ) -> PyResult < Bound < ' _ , PyAny > > {
9798 let formatter_module = py. import ( "datafusion.html_formatter" ) ?;
9899 let get_formatter = formatter_module. getattr ( "get_formatter" ) ?;
99- let formatter = get_formatter. call0 ( ) ?;
100+ get_formatter. call0 ( )
101+ }
102+
103+ fn get_formatter_config ( py : Python ) -> PyResult < FormatterConfig > {
104+ let formatter = get_python_formatter ( py) ?;
100105
101106 // Helper function to extract attributes with fallback to default
102107 fn get_attr < ' a > (
@@ -205,9 +210,7 @@ impl PyDataFrame {
205210 let py_schema = self . schema ( ) . into_pyobject ( py) ?;
206211
207212 // Get the Python formatter module and call format_html
208- let formatter_module = py. import ( "datafusion.html_formatter" ) ?;
209- let get_formatter = formatter_module. getattr ( "get_formatter" ) ?;
210- let formatter = get_formatter. call0 ( ) ?;
213+ let formatter = get_python_formatter ( py) ?;
211214
212215 // Call format_html method on the formatter
213216 let kwargs = pyo3:: types:: PyDict :: new ( py) ;
You can’t perform that action at this time.
0 commit comments