Skip to content

Commit 5dfb9ce

Browse files
committed
Fix ruff errors
1 parent 625a1f2 commit 5dfb9ce

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

python/datafusion/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"DFSchema",
6262
"DataFrame",
6363
"Database",
64+
"DataframeDisplayConfig",
6465
"ExecutionPlan",
6566
"Expr",
6667
"LogicalPlan",
@@ -71,7 +72,6 @@
7172
"ScalarUDF",
7273
"SessionConfig",
7374
"SessionContext",
74-
"DataframeDisplayConfig",
7575
"Table",
7676
"WindowFrame",
7777
"WindowUDF",

python/datafusion/context.py

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from __future__ import annotations
2121

22-
from typing import TYPE_CHECKING, Any, Protocol
22+
from typing import TYPE_CHECKING, Any, Optional, Protocol
2323

2424
try:
2525
from warnings import deprecated # Python 3.13+
@@ -87,18 +87,22 @@ class DataframeDisplayConfig:
8787

8888
def __init__(
8989
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,
9494
) -> None:
9595
"""Create a new :py:class:`DataframeDisplayConfig` instance.
9696
9797
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)
102106
"""
103107
self.config_internal = DataframeDisplayConfigInternal(
104108
max_table_bytes=max_table_bytes,
@@ -161,22 +165,31 @@ def __init__(self, config_options: dict[str, str] | None = None) -> None:
161165

162166
def with_dataframe_display_config(
163167
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,
168172
) -> SessionConfig:
169173
"""Configure the display options for DataFrames.
170174
171175
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)
173178
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)
176183
177184
Returns:
178185
A new :py:class:`SessionConfig` object with the updated display settings.
179186
"""
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+
)
180193

181194
display_config = DataframeDisplayConfigInternal(
182195
max_table_bytes=max_table_bytes,

0 commit comments

Comments
 (0)