Skip to content

Commit c9b7c2e

Browse files
committed
Refactor function signatures for improved readability in pyarrow.py
1 parent 0b70eb9 commit c9b7c2e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
F32_MIN = float(np.finfo(np.float32).min)
2828
F32_MAX = float(np.finfo(np.float32).max)
2929

30-
def dominant_timezone_per_column(schemas: list[pa.Schema]) -> dict[str, tuple[str | None, str | None]]:
30+
31+
def dominant_timezone_per_column(
32+
schemas: list[pa.Schema],
33+
) -> dict[str, tuple[str | None, str | None]]:
3134
"""
3235
For each timestamp column (by name) across all schemas, detect the most frequent timezone (including None).
3336
If None and a timezone are tied, prefer the timezone.
@@ -64,7 +67,10 @@ def dominant_timezone_per_column(schemas: list[pa.Schema]) -> dict[str, tuple[st
6467
dominant[name] = (units[name], tz)
6568
return dominant
6669

67-
def standardize_schema_timezones_by_majority(schemas:list[pa.Schema]) -> list[pa.Schema]:
70+
71+
def standardize_schema_timezones_by_majority(
72+
schemas: list[pa.Schema],
73+
) -> list[pa.Schema]:
6874
"""
6975
For each timestamp column (by name) across all schemas, set the timezone to the most frequent (with tie-breaking).
7076
Returns a new list of schemas with updated timestamp timezones.
@@ -89,7 +95,10 @@ def standardize_schema_timezones_by_majority(schemas:list[pa.Schema]) -> list[pa
8995
new_schemas.append(pa.schema(fields, schema.metadata))
9096
return new_schemas
9197

92-
def standardize_schema_timezones(schemas:list[pa.Schema], timezone:str|None=None) -> list[pa.Schema]:
98+
99+
def standardize_schema_timezones(
100+
schemas: list[pa.Schema], timezone: str | None = None
101+
) -> list[pa.Schema]:
93102
"""
94103
Standardize timezone info for all timestamp columns in a list of PyArrow schemas.
95104
@@ -125,7 +134,10 @@ def standardize_schema_timezones(schemas:list[pa.Schema], timezone:str|None=None
125134

126135

127136
def unify_schemas(
128-
schemas: list[pa.Schema], use_large_dtypes: bool = False, timezone: str | None = None, standardize_timezones: bool = True
137+
schemas: list[pa.Schema],
138+
use_large_dtypes: bool = False,
139+
timezone: str | None = None,
140+
standardize_timezones: bool = True,
129141
) -> pa.Schema:
130142
"""
131143
Unify a list of PyArrow schemas into a single schema.

0 commit comments

Comments
 (0)