@@ -267,7 +267,7 @@ def get_schema(self, params: GetSchemaParams):
267
267
column_schemas .append (self ._get_single_column_schema (column_index ))
268
268
269
269
# Return the column schemas.
270
- return TableSchema (columns = column_schemas ). dict ()
270
+ return TableSchema (columns = column_schemas )
271
271
272
272
def _get_single_column_schema (self , column_index : int ) -> ColumnSchema :
273
273
raise NotImplementedError
@@ -289,7 +289,7 @@ def search_schema(self, params: SearchSchemaParams):
289
289
return SearchSchemaResult (
290
290
matches = TableSchema (columns = [self ._get_single_column_schema (i ) for i in matches_slice ]),
291
291
total_num_matches = len (matches ),
292
- ). dict ()
292
+ )
293
293
294
294
def _column_filter_get_matches (self , filters : list [ColumnFilter ]):
295
295
matchers = self ._get_column_filter_functions (filters )
@@ -429,7 +429,7 @@ def _set_row_filters(self, filters: list[RowFilter]):
429
429
# Simply reset if empty filter set passed
430
430
self .filtered_indices = None
431
431
self ._update_row_view_indices ()
432
- return FilterResult (selected_num_rows = len (self .table ), had_errors = False ). dict ()
432
+ return FilterResult (selected_num_rows = len (self .table ), had_errors = False )
433
433
434
434
# Evaluate all the filters and combine them using the
435
435
# indicated conditions
@@ -469,7 +469,7 @@ def _set_row_filters(self, filters: list[RowFilter]):
469
469
470
470
# Update the view indices, re-sorting if needed
471
471
self ._update_row_view_indices ()
472
- return FilterResult (selected_num_rows = selected_num_rows , had_errors = had_errors ). dict ()
472
+ return FilterResult (selected_num_rows = selected_num_rows , had_errors = had_errors )
473
473
474
474
def _mask_to_indices (self , mask ):
475
475
raise NotImplementedError
@@ -582,7 +582,7 @@ def get_state(self, _unused):
582
582
row_filters = self .state .row_filters ,
583
583
sort_keys = self .state .sort_keys ,
584
584
supported_features = self .FEATURES ,
585
- ). dict ()
585
+ )
586
586
587
587
def _recompute (self ):
588
588
# Re-setting the column filters will trigger filtering AND
@@ -1583,10 +1583,10 @@ def _export_tabular(self, row_selector, column_selector, fmt: ExportFormat):
1583
1583
if result [- 1 ] == "\n " :
1584
1584
result = result [:- 1 ]
1585
1585
1586
- return ExportedData (data = result , format = fmt ). dict ()
1586
+ return ExportedData (data = result , format = fmt )
1587
1587
1588
1588
def _export_cell (self , row_index : int , column_index : int , fmt : ExportFormat ):
1589
- return ExportedData (data = str (self .table .iloc [row_index , column_index ]), format = fmt ). dict ()
1589
+ return ExportedData (data = str (self .table .iloc [row_index , column_index ]), format = fmt )
1590
1590
1591
1591
def _mask_to_indices (self , mask ):
1592
1592
if mask is not None :
@@ -2415,10 +2415,10 @@ def _export_tabular(self, row_selector, column_selector, fmt: ExportFormat):
2415
2415
elif fmt == ExportFormat .Html :
2416
2416
raise NotImplementedError (f"Unsupported export format { fmt } " )
2417
2417
2418
- return ExportedData (data = result , format = fmt ). dict ()
2418
+ return ExportedData (data = result , format = fmt )
2419
2419
2420
2420
def _export_cell (self , row_index : int , column_index : int , fmt : ExportFormat ):
2421
- return ExportedData (data = str (self .table [row_index , column_index ]), format = fmt ). dict ()
2421
+ return ExportedData (data = str (self .table [row_index , column_index ]), format = fmt )
2422
2422
2423
2423
SUPPORTED_FILTERS = frozenset (
2424
2424
{
@@ -3032,6 +3032,9 @@ def handle_msg(self, msg: CommMessage[DataExplorerBackendMessageContent], _raw_m
3032
3032
3033
3033
# To help remember to convert pydantic types to dicts
3034
3034
if result is not None :
3035
+ # Convert pydantic types to dict
3036
+ if not isinstance (result , dict ):
3037
+ result = result .dict ()
3035
3038
if isinstance (result , list ):
3036
3039
for x in result :
3037
3040
assert isinstance (x , dict )
0 commit comments