Skip to content

Commit 1188072

Browse files
committed
Refactor _get_column_expr and opt_dtype for improved readability by formatting function arguments
1 parent a828d0b commit 1188072

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/flowerpower/plugins/io/helpers/polars.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ def _optimize_string_column(
133133

134134

135135
def _get_column_expr(
136-
df: pl.DataFrame, col_name: str, shrink_numerics: bool, allow_unsigned: bool, time_zone: str | None = None
136+
df: pl.DataFrame,
137+
col_name: str,
138+
shrink_numerics: bool,
139+
allow_unsigned: bool,
140+
time_zone: str | None = None,
137141
) -> pl.Expr:
138142
"""Generate optimization expression for a single column."""
139143
series = df[col_name]
@@ -144,7 +148,9 @@ def _get_column_expr(
144148

145149
# Process based on current type
146150
if series.dtype.is_numeric():
147-
return _optimize_numeric_column(series, col_name, shrink_numerics, allow_unsigned)
151+
return _optimize_numeric_column(
152+
series, col_name, shrink_numerics, allow_unsigned
153+
)
148154
elif series.dtype == pl.Utf8:
149155
return _optimize_string_column(series, col_name, shrink_numerics, time_zone)
150156

@@ -198,7 +204,9 @@ def opt_dtype(
198204
for col_name in cols_to_process:
199205
try:
200206
expressions.append(
201-
_get_column_expr(df, col_name, shrink_numerics, allow_unsigned, time_zone)
207+
_get_column_expr(
208+
df, col_name, shrink_numerics, allow_unsigned, time_zone
209+
)
202210
)
203211
except Exception as e:
204212
if strict:

0 commit comments

Comments
 (0)