From 80340a46514e499ed643d1468a018be3832b865d Mon Sep 17 00:00:00 2001 From: jianfengmao Date: Fri, 10 Nov 2023 12:20:07 -0700 Subject: [PATCH] Apply Literal to to_pandas() --- py/server/deephaven/pandas.py | 6 +++--- py/server/deephaven/table_factory.py | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/py/server/deephaven/pandas.py b/py/server/deephaven/pandas.py index 5181428fa9c..14e74ece14c 100644 --- a/py/server/deephaven/pandas.py +++ b/py/server/deephaven/pandas.py @@ -3,7 +3,7 @@ # """ This module supports the conversion between Deephaven tables and pandas DataFrames. """ -from typing import List, Dict, Tuple +from typing import List, Dict, Tuple, Literal import jpy import numpy as np @@ -112,8 +112,8 @@ def _column_to_series(table: Table, col_def: Column, conv_null: bool) -> pd.Seri } -def to_pandas(table: Table, cols: List[str] = None, dtype_backend: str = None, conv_null: bool = True) -> \ - pd.DataFrame: +def to_pandas(table: Table, cols: List[str] = None, dtype_backend: Literal[None, "pyarrow", "numpy_nullable"] = None, + conv_null: bool = True) -> pd.DataFrame: """Produces a pandas DataFrame from a table. Note that the **entire table** is going to be cloned into memory, so the total number of entries in the table diff --git a/py/server/deephaven/table_factory.py b/py/server/deephaven/table_factory.py index 5a06cb6cfba..9e01cda8147 100644 --- a/py/server/deephaven/table_factory.py +++ b/py/server/deephaven/table_factory.py @@ -36,7 +36,6 @@ _JFunctionGeneratedTableFactory = jpy.get_type("io.deephaven.engine.table.impl.util.FunctionGeneratedTableFactory") - def empty_table(size: int) -> Table: """Creates a table with rows but no columns. @@ -395,7 +394,6 @@ def function_generated_table(table_generator: Callable[..., Table], if exec_ctx is None: raise ValueError("No execution context is available and exec_ctx was not provided! ") - def table_generator_function(): with exec_ctx: result = table_generator(*args, **kwargs)