|
19 | 19 |
|
20 | 20 | from __future__ import annotations |
21 | 21 |
|
22 | | -from typing import TYPE_CHECKING, Any, Protocol |
| 22 | +from typing import TYPE_CHECKING, Any, Optional, Protocol |
23 | 23 |
|
24 | 24 | try: |
25 | 25 | from warnings import deprecated # Python 3.13+ |
@@ -87,18 +87,22 @@ class DataframeDisplayConfig: |
87 | 87 |
|
88 | 88 | def __init__( |
89 | 89 | self, |
90 | | - max_table_bytes: int = None, |
91 | | - min_table_rows: int = None, |
92 | | - max_cell_length: int = None, |
93 | | - max_table_rows_in_repr: int = None, |
| 90 | + max_table_bytes: Optional[int] = None, |
| 91 | + min_table_rows: Optional[int] = None, |
| 92 | + max_cell_length: Optional[int] = None, |
| 93 | + max_table_rows_in_repr: Optional[int] = None, |
94 | 94 | ) -> None: |
95 | 95 | """Create a new :py:class:`DataframeDisplayConfig` instance. |
96 | 96 |
|
97 | 97 | Args: |
98 | | - max_table_bytes: Maximum bytes to display for table presentation (default: 2MB) |
99 | | - min_table_rows: Minimum number of table rows to display (default: 20) |
100 | | - max_cell_length: Maximum length of a cell before it gets minimized (default: 25) |
101 | | - max_table_rows_in_repr: Maximum number of rows to display in repr string output (default: 10) |
| 98 | + max_table_bytes: Maximum bytes to display for table presentation |
| 99 | + (default: 2MB) |
| 100 | + min_table_rows: Minimum number of table rows to display |
| 101 | + (default: 20) |
| 102 | + max_cell_length: Maximum length of a cell before it gets minimized |
| 103 | + (default: 25) |
| 104 | + max_table_rows_in_repr: Maximum number of rows to display in repr |
| 105 | + string output (default: 10) |
102 | 106 | """ |
103 | 107 | self.config_internal = DataframeDisplayConfigInternal( |
104 | 108 | max_table_bytes=max_table_bytes, |
@@ -161,22 +165,31 @@ def __init__(self, config_options: dict[str, str] | None = None) -> None: |
161 | 165 |
|
162 | 166 | def with_dataframe_display_config( |
163 | 167 | self, |
164 | | - max_table_bytes: int = None, |
165 | | - min_table_rows: int = None, |
166 | | - max_cell_length: int = None, |
167 | | - max_table_rows_in_repr: int = None, |
| 168 | + max_table_bytes: Optional[int] = None, |
| 169 | + min_table_rows: Optional[int] = None, |
| 170 | + max_cell_length: Optional[int] = None, |
| 171 | + max_table_rows_in_repr: Optional[int] = None, |
168 | 172 | ) -> SessionConfig: |
169 | 173 | """Configure the display options for DataFrames. |
170 | 174 |
|
171 | 175 | Args: |
172 | | - max_table_bytes: Maximum bytes to display for table presentation (default: 2MB) |
| 176 | + max_table_bytes: Maximum bytes to display for table presentation |
| 177 | + (default: 2MB) |
173 | 178 | min_table_rows: Minimum number of table rows to display (default: 20) |
174 | | - max_cell_length: Maximum length of a cell before it gets minimized (default: 25) |
175 | | - max_table_rows_in_repr: Maximum number of rows to display in repr string output (default: 10) |
| 179 | + max_cell_length: Maximum length of a cell before it gets minimized |
| 180 | + (default: 25) |
| 181 | + max_table_rows_in_repr: Maximum number of rows to display in repr string |
| 182 | + output (default: 10) |
176 | 183 |
|
177 | 184 | Returns: |
178 | 185 | A new :py:class:`SessionConfig` object with the updated display settings. |
179 | 186 | """ |
| 187 | + display_config = DataframeDisplayConfigInternal( |
| 188 | + max_table_bytes=max_table_bytes, |
| 189 | + min_table_rows=min_table_rows, |
| 190 | + max_cell_length=max_cell_length, |
| 191 | + max_table_rows_in_repr=max_table_rows_in_repr, |
| 192 | + ) |
180 | 193 |
|
181 | 194 | display_config = DataframeDisplayConfigInternal( |
182 | 195 | max_table_bytes=max_table_bytes, |
|
0 commit comments